public LoseControlOfVehiclePacketOut(CharacterEntity driver, VehicleEntity vehicle) { ID = ServerToClientPacket.LOSE_CONTROL_OF_VEHICLE; Data = new byte[8 + 8]; Utilities.LongToBytes(driver.EID).CopyTo(Data, 0); Utilities.LongToBytes(vehicle.EID).CopyTo(Data, 8); }
public override void Accepted(CharacterEntity character, Seat seat) { base.Accepted(character, seat); // TODO: Track players entering/exiting view! FlagEntityPacketOut fepo = new FlagEntityPacketOut(this, EntityFlag.HELO_TILT_MOD, TiltMod); TheRegion.SendToVisible(lPos, fepo); }
public void HandleInput(CharacterEntity player) { if (SeatHolder is VehicleEntity) { ((VehicleEntity)SeatHolder).HandleInput(player); } }
private void Setup(CharacterEntity character, HelicopterEntity vehicle) { DataStream ds = new DataStream(); DataWriter dw = new DataWriter(ds); dw.WriteLong(character.EID); dw.WriteByte(1); // TODO: Enum? dw.WriteLong(vehicle.EID); dw.Flush(); Data = ds.ToArray(); dw.Close(); }
public override void HandleInput(CharacterEntity character) { // TODO: Dynamic multiplier values. foreach (JointVehicleMotor motor in DrivingMotors) { motor.Motor.Settings.VelocityMotor.GoalVelocity = character.YMove * 100; } foreach (JointVehicleMotor motor in SteeringMotors) { motor.Motor.Settings.Servo.Goal = MathHelper.Pi * -0.2f * character.XMove; } }
private void Setup(CharacterEntity character, CarEntity vehicle) { DataStream ds = new DataStream(); DataWriter dw = new DataWriter(ds); dw.WriteLong(character.EID); dw.WriteByte(0); // TODO: Enum? dw.WriteInt(vehicle.DrivingMotors.Count); dw.WriteInt(vehicle.SteeringMotors.Count); for (int i = 0; i < vehicle.DrivingMotors.Count; i++) { dw.WriteLong(vehicle.DrivingMotors[i].JID); } for (int i = 0; i < vehicle.SteeringMotors.Count; i++) { dw.WriteLong(vehicle.SteeringMotors[i].JID); } dw.Flush(); Data = ds.ToArray(); dw.Close(); }
public GainControlOfVehiclePacketOut(CharacterEntity character, VehicleEntity vehicle) { UsageType = NetUsageType.ENTITIES; ID = ServerToClientPacket.GAIN_CONTROL_OF_VEHICLE; if (vehicle is CarEntity) { Setup(character, (CarEntity)vehicle); } else if (vehicle is HelicopterEntity) { Setup(character, (HelicopterEntity)vehicle); } else if (vehicle is PlaneEntity) { Setup(character, (PlaneEntity)vehicle); } // TODO: Boats! else { throw new NotImplementedException(); } }
public override void SeatKicked(CharacterEntity character, Seat seat) { base.SeatKicked(character, seat); character.Solidify(); }
public override void Accepted(CharacterEntity character, Seat seat) { base.Accepted(character, seat); character.Desolidify(); }
public abstract void HandleInput(CharacterEntity character);
public bool IsAllowedToPlaceIn(CharacterEntity ent, Location block, Material mat) { if (block.Z > TheServer.CVars.g_maxheight.ValueI || block.Z < TheServer.CVars.g_minheight.ValueI) { return false; } return mat == Material.AIR; }
public void HandleWheelsInput(CharacterEntity character) { HandleWheelsSpecificInput(character.YMove, character.XMove); }
public virtual void Accepted(CharacterEntity character, Seat seat) { GainControlOfVehiclePacketOut gcovpo = new GainControlOfVehiclePacketOut(character, this); TheRegion.SendToVisible(lPos, gcovpo); // TODO: handle players coming into/out-of view of the vehicle + driver! }
public virtual void SeatKicked(CharacterEntity character, Seat seat) { LoseControlOfVehiclePacketOut gcovpo = new LoseControlOfVehiclePacketOut(character, this); TheRegion.SendToVisible(lPos, gcovpo); }
public virtual void Accepted(CharacterEntity character, Seat seat) { GainControlOfVehiclePacketOut gcovpo = new GainControlOfVehiclePacketOut(character, this); TheRegion.SendToVisible(lPos, gcovpo); }
public override void HandleInput(CharacterEntity character) { ILeft = character.ItemLeft; IRight = character.ItemRight; ForwBack = character.YMove; RightLeft = character.XMove; FastOrSlow = character.SprintOrWalk; }