public override Entity Create(Region tregion, byte[] data) { ModelEntity me = new ModelEntity(tregion.TheClient.Network.Strings.StringForIndex(Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength, 4))), tregion); me.ApplyPhysicsNetworkData(data); byte moder = data[PhysicsEntity.PhysicsNetworkDataLength + 4]; me.mode = (ModelCollisionMode)moder; me.scale = Location.FromDoubleBytes(data, PhysicsEntity.PhysicsNetworkDataLength + 4 + 1); VehicleType vt = (VehicleType)data[data.Length - 1]; if (vt == VehicleType.PLANE) { me.ForwardHelper = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 0 * 8, 8)); me.LiftHelper = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 1 * 8, 8)); me.PlaneFastStrength = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 2 * 8, 8)); me.PlaneRegularStrength = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 3 * 8, 8)); me.StrPitch = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 4 * 8, 8)); me.StrRoll = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 5 * 8, 8)); me.StrYaw = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 6 * 8, 8)); // TODO: Properly predict wheels? //me.WheelStrength = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 7 * 8, 8)); //me.TurnStrength = Utilities.BytesToDouble(Utilities.BytesPartial(data, MODDAT_LEN + 8 * 8, 8)); me.TurnIntoPlane(null); } else { // ??? SysConsole.Output(OutputType.WARNING, "Unknown vehicle type spawned!"); } return(me); }
public override Entity Create(Region tregion, byte[] data) { ModelEntity me = new ModelEntity(tregion.TheClient.Network.Strings.StringForIndex(Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength, 4))), tregion); me.ApplyPhysicsNetworkData(data); byte moder = data[PhysicsEntity.PhysicsNetworkDataLength + 4]; me.mode = (ModelCollisionMode)moder; me.scale = Location.FromDoubleBytes(data, PhysicsEntity.PhysicsNetworkDataLength + 4 + 1); return me; }