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 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 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 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()); } }
public void ArmorOnUnmount(coPlayerData datablock, coPlayer player, coVehicle vehicle, int node) { if (node != 0) return; player.mountImage(player["lastWeapon"], WeaponSlot, true, ""); player.setControlObject(""); if (!player["lastperson"].AsBool()) return; coGameConnection client = player["client"]; if (client.isObject()) client.setFirstPerson(player["lastperson"].AsBool()); }
public void ArmorOnMount(coPlayerData datablock, coPlayer player, coVehicle vehicle, int node) { coVehicleData vehicleDataBlock = vehicle.getDataBlock(); if (node == 0) { player.setTransform(new TransformF("0 0 0 0 0 1 0")); string mountPose = vehicleDataBlock["mountPose[" + node + "]"]; player.setActionThread(mountPose, true, true); player["lastWeapon"] = player.getMountedImage(WeaponSlot).AsString(); coGameConnection client = player["client"]; if (client.isObject()) player["lastperson"] = client.isFirstPerson().AsString(); player.unmountImage(WeaponSlot); player.setControlObject(vehicle); if (player.getClassName() == "Player") { console.commandToClient(player["client"], console.addTaggedString("toggleVehicleMap"), new[] { "true" }); } } else { string pose = vehicleDataBlock["mountPose[" + node + "]"]; player.setActionThread(pose != "" ? pose : "root", false, true); } }