public FastGliderTransport( Glider.GliderMovement mover, MeshedVehicleDescription description, InventoryItem refundItems) : base(mover, description, refundItems) { }
private static void LoadGliders(JObject rootObj) { JToken jtoken1; if (!rootObj.TryGetValue("transports", out jtoken1)) { return; } if (jtoken1.Type != JTokenType.Array) { Log.WriteWarning("Didn't load gliders as transports wasn't an array"); } else { JArray jarray = (JArray)jtoken1; int count = jarray.Count; for (int index = 0; index < count; ++index) { JToken jtoken2 = jarray[index]; if (jtoken2.Type == JTokenType.Object) { JObject jobject = (JObject)jtoken2; if (jobject.TryGetValue("type", out jtoken2) && jtoken2.Type == JTokenType.String) { if (!(jtoken2.Value <string>() != "fastglider")) { try { Vector3 spawnPosition = ReadVector3((JObject)jobject["position"]); Quaternion rotation = Quaternion.Euler(ReadVector3((JObject)jobject["rotation"])); MeshedVehicleDescription vehicleDescription = FastGlider.CreateVehicleDescription(MeshedObjectID.GetNew()); Players.Player player = (Players.Player)null; JToken jtoken3; if (jobject.TryGetValue("player", out jtoken3) && jtoken3.Type == JTokenType.String) { player = Players.GetPlayer(NetworkID.Parse((string)jtoken3)); MeshedObjectManager.Attach(player, vehicleDescription); } FastGlider.CreateGlider(spawnPosition, rotation, vehicleDescription, player); } catch (Exception ex) { Log.WriteException("Exception loading gliders:", ex); } } } } } } Vector3 ReadVector3(JObject obj) { return(new Vector3(obj.Value <float>((object)"x"), obj.Value <float>((object)"y"), obj.Value <float>((object)"z"))); } }
public TrainTransport(Vector3 position, AnimationManager.AnimatedObject animatedObject, ICSType trainType) { _meshedVehicleDescription = new MeshedVehicleDescription(new ClientMeshedObject(animatedObject.ObjType), trainType.TrainConfiguration.playerSeatOffset, trainType.TrainConfiguration.AllowPlayerToEditBlocksWhileRiding); _animatedObject = animatedObject; Position = position; TrainType = trainType; _trainId = ItemId.GetItemId(trainType.name); _idealHeightFromTrack = TrainType.TrainConfiguration.IdealHeightFromTrack; Delay = TrainType.TrainConfiguration.MoveTimePerBlockMs; ManaCostPerBlock = TrainType.TrainConfiguration.EnergyCostPerBlock; }
public static FastGlider.FastGliderTransport CreateGlider( Vector3 spawnPosition, Quaternion rotation, MeshedVehicleDescription vehicle, Players.Player playerInside) { Glider.GliderMovement mover = new Glider.GliderMovement(spawnPosition, rotation, settings, playerInside); FastGlider.FastGliderTransport vehicle1 = new FastGlider.FastGliderTransport(mover, vehicle, new InventoryItem(ItemTypes.GetType(settings.ItemTypeName).ItemIndex, 1)); mover.SetParent(vehicle1); CollisionChecker.RegisterSource((CollisionChecker.ICollisionSource)mover); TransportManager.RegisterTransport((TransportManager.ITransportVehicle)vehicle1); return(vehicle1); }
public TrainTransport(TransportSave transportSave) { if (transportSave.type == _trackCalculationType.name) { Position = transportSave.position; _prevPosition = transportSave.prevPos; _trainId = transportSave.itemName; TrackPosition = transportSave.trackPos; TrainType = Train.TrainTypes[transportSave.itemName]; _animatedObject = Train.TrainAnimations[transportSave.itemName]; _meshedVehicleDescription = new MeshedVehicleDescription(new ClientMeshedObject(_animatedObject.ObjType, new MeshedObjectID(transportSave.meshid)), TrainType.TrainConfiguration.playerSeatOffset, TrainType.TrainConfiguration.AllowPlayerToEditBlocksWhileRiding); _idealHeightFromTrack = TrainType.TrainConfiguration.IdealHeightFromTrack; _energy = transportSave.energy; Delay = TrainType.TrainConfiguration.MoveTimePerBlockMs; ManaCostPerBlock = TrainType.TrainConfiguration.EnergyCostPerBlock; if (!string.IsNullOrEmpty(transportSave.player)) { _player = Players.GetPlayer(NetworkID.Parse(transportSave.player)); MeshedObjectManager.Attach(_player, _meshedVehicleDescription); } } }