示例#1
0
        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);
            }
示例#2
0
 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;
     }
示例#3
0
 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;
     }
示例#4
0
        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;
            }
示例#5
0
 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");
     }
示例#6
0
 public void VehicleDataIsMountable(coVehicleData thisobj, coVehicle obj, bool val)
     {
     obj["mountable"] = val.AsString();
     }
示例#7
0
 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());
         }
     }