public void VehicleDataOnAdd(coVehicleData thisobj, coVehicle obj) { obj.setRechargeRate(thisobj["rechargeRate"].AsFloat()); obj.setEnergyLevel(thisobj["MaxEnergy"].AsFloat()); obj.setRepairRate(0); { if (obj["mountable"].AsBool() || (obj["mountable"] == "")) VehicleDataIsMountable(thisobj, obj, true); else VehicleDataIsMountable(thisobj, obj, false); } string nametag = thisobj["nameTag"]; if (nametag.Trim() != "") obj.setShapeName(nametag); }
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 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 void VehicleDataSetMountVehicle(coVehicleData thisobj, coVehicle vehicle, coPlayer player) { if (!vehicle.isObject() || vehicle.getDamageState() == "Destroyed") return; int node = VehicleDataFindEmptySeat(thisobj, vehicle, player); if (node == -1) return; vehicle.mountObject(player, node, new TransformF(true)); player["mVehicle"] = vehicle; }
public void VehicleDataMountPlayer(coVehicleData thisobj, coVehicle vehicle, coPlayer player) { if (!vehicle.isObject() || vehicle.getDamageState() == "Destroyed") return; player.startFade(1000, 0, true); thisobj.schedule("1000", "setMountVehicle", vehicle, player); player.schedule("1500", "startFade", "1000", "0", "false"); }
public void VehicleDataIsMountable(coVehicleData thisobj, coVehicle obj, bool val) { obj["mountable"] = val.AsString(); }
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()); } }