Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 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();
 }
Example #5
0
 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();
     }
 }
Example #8
0
 public override void SeatKicked(CharacterEntity character, Seat seat)
 {
     base.SeatKicked(character, seat);
     character.Solidify();
 }
Example #9
0
 public override void Accepted(CharacterEntity character, Seat seat)
 {
     base.Accepted(character, seat);
     character.Desolidify();
 }
Example #10
0
 public abstract void HandleInput(CharacterEntity character);
Example #11
0
 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;
 }
Example #12
0
 public override void Accepted(CharacterEntity character, Seat seat)
 {
     base.Accepted(character, seat);
     character.Desolidify();
 }
Example #13
0
 public void HandleWheelsInput(CharacterEntity character)
 {
     HandleWheelsSpecificInput(character.YMove, character.XMove);
 }
Example #14
0
 public abstract void HandleInput(CharacterEntity character);
Example #15
0
 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!
 }
Example #16
0
 public virtual void SeatKicked(CharacterEntity character, Seat seat)
 {
     LoseControlOfVehiclePacketOut gcovpo = new LoseControlOfVehiclePacketOut(character, this);
     TheRegion.SendToVisible(lPos, gcovpo);
 }
Example #17
0
 public override void SeatKicked(CharacterEntity character, Seat seat)
 {
     base.SeatKicked(character, seat);
     character.Solidify();
 }
Example #18
0
        public virtual void Accepted(CharacterEntity character, Seat seat)
        {
            GainControlOfVehiclePacketOut gcovpo = new GainControlOfVehiclePacketOut(character, this);

            TheRegion.SendToVisible(lPos, gcovpo);
        }
Example #19
0
 public override void HandleInput(CharacterEntity character)
 {
     ILeft = character.ItemLeft;
     IRight = character.ItemRight;
     ForwBack = character.YMove;
     RightLeft = character.XMove;
     FastOrSlow = character.SprintOrWalk;
 }
Example #20
0
        public virtual void SeatKicked(CharacterEntity character, Seat seat)
        {
            LoseControlOfVehiclePacketOut gcovpo = new LoseControlOfVehiclePacketOut(character, this);

            TheRegion.SendToVisible(lPos, gcovpo);
        }