Beispiel #1
0
 public void UpdatePlayer(HumanoidEntity character)
 {
     // TODO: Should this be a method on PlayerEntity?
     if (character is PlayerEntity)
     {
         ((PlayerEntity)character).Network.SendPacket(new YourStatusPacketOut(character.GetHealth(), character.GetMaxHealth(), character.Flags));
     }
 }
Beispiel #2
0
 public JetpackMotionConstraint(HumanoidEntity human)
 {
     Human = human;
     Entity = Human.Body;
 }
Beispiel #3
0
 public bool Reload(HumanoidEntity character, ItemStack item)
 {
     if (character.Flags.HasFlag(YourStatusFlags.RELOADING))
     {
         return false;
     }
     int clipSize = (int)((double)ClipSize * item.GetAttributeF("clipsize_mod", 1f));
     if (item.Datum < clipSize)
     {
         for (int i = 0; i < character.Items.Items.Count; i++)
         {
             ItemStack itemStack = character.Items.Items[i];
             if (itemStack.Info is BulletItem && itemStack.SecondaryName == AmmoType)
             {
                 if (itemStack.Count > 0)
                 {
                     int reloading = clipSize - item.Datum;
                     if (reloading > itemStack.Count)
                     {
                         reloading = itemStack.Count;
                     }
                     item.Datum += reloading;
                     if (character is PlayerEntity)
                     {
                         ((PlayerEntity)character).Network.SendPacket(new SetItemPacketOut(character.Items.Items.IndexOf(item), item));
                     }
                     itemStack.Count -= reloading;
                     if (itemStack.Count <= 0)
                     {
                         character.Items.RemoveItem(i + 1);
                     }
                     else
                     {
                         if (character is PlayerEntity)
                         {
                             ((PlayerEntity)character).Network.SendPacket(new SetItemPacketOut(i, itemStack));
                         }
                     }
                 }
                 character.Flags |= YourStatusFlags.RELOADING;
                 character.WaitingForClickRelease = true;
                 character.LastGunShot = character.TheRegion.GlobalTickTime + ReloadDelay;
                 UpdatePlayer(character);
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #4
0
 public JetpackMotionConstraint(HumanoidEntity human)
 {
     Human  = human;
     Entity = Human.Body;
 }