public int VehicleDataFindEmptySeat(coVehicleData thisobj, coVehicle vehicle, coPlayer player) { for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++) { int node = vehicle.getMountNodeObject(i); if (node != 0) return i; } return -1; }
public int VehicleDataSwitchSeats(coVehicleData thisobj, coVehicle vehicle, coPlayer player) { for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++) { int node = vehicle.getMountNodeObject(i); if (node == player || node > 0) continue; if (node == 0) return i; } return -1; }
public void VehicleDataOnRemove(coVehicleData thisobj, coVehicle obj) { // if there are passengers/driver, kick them out for (int i = 0; i < ((coVehicleData) obj.getDataBlock())["numMountPoints"].AsInt(); i++) { coPlayer passenger = obj.getMountNodeObject(i); if (passenger != "0") passenger.call("doDismount", true.AsString()); } }