Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public PlaneMotionConstraint(ModelEntity pln)
 {
     Plane = pln;
     Entity = pln.Body;
 }
Exemplo n.º 4
0
 public HelicopterMotionConstraint(ModelEntity heli)
 {
     Helicopter = heli;
     Entity = heli.Body;
 }
Exemplo n.º 5
0
 public override void SetTextureName(string name)
 {
     if (name == null || name.Length == 0)
     {
         Tex = null;
     }
     else
     {
         if (name.Contains(":") && name.Before(":").ToLowerFast() == "render_block")
         {
             string[] blockDataToRender = name.After(":").SplitFast(',');
             if (blockDataToRender[0] == "self")
             {
                 BlockInternal bi = BlockInternal.FromItemDatum(Datum);
                 RenderedBlock = new BlockItemEntity(TheClient.TheRegion, bi.Material, bi.BlockData, bi.BlockPaint, bi.Damage);
                 RenderedBlock.GenVBO();
             }
             else
             {
                 Material mat = MaterialHelpers.FromNameOrNumber(blockDataToRender[0]);
                 byte data = (byte)(blockDataToRender.Length < 2 ? 0 : Utilities.StringToInt(blockDataToRender[1]));
                 byte paint = (byte)(blockDataToRender.Length < 3 ? 0 : Colors.ForName(blockDataToRender[2]));
                 BlockDamage damage = blockDataToRender.Length < 4 ? BlockDamage.NONE : (BlockDamage)Enum.Parse(typeof(BlockDamage), blockDataToRender[3], true);
                 RenderedBlock = new BlockItemEntity(TheClient.TheRegion, mat, data, paint, damage);
                 RenderedBlock.GenVBO();
             }
             Tex = null;
         }
         if (name.Contains(":") && name.Before(":").ToLowerFast() == "render_model")
         {
             string model = name.After(":");
             if (model.ToLowerFast() == "self")
             {
                 model = GetModelName();
             }
             RenderedModel = new ModelEntity(model, TheClient.TheRegion);
             RenderedModel.Visible = true;
             RenderedModel.PreHandleSpawn();
             Tex = null;
         }
         else
         {
             Tex = TheClient.Textures.GetTexture(name);
         }
     }
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 public PlaneMotionConstraint(ModelEntity pln)
 {
     Plane = pln;
     Entity = pln.Body;
 }
Exemplo n.º 8
0
 public HelicopterMotionConstraint(ModelEntity heli)
 {
     Helicopter = heli;
     Entity = heli.Body;
 }