123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- class RestrainingToolLocked extends ItemBase
- {
- void ~RestrainingToolLocked()
- {
- PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
- if ( player && player.IsRestrained() )
- {
- player.SetRestrained(false);
- }
- }
-
- override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
- {
- super.EEItemLocationChanged(oldLoc, newLoc);
-
- if ( GetGame().IsServer() )
- {
- if ( oldLoc.IsValid() && oldLoc.GetParent() )
- {
- PlayerBase old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
- if (old_player && old_player.IsRestrained())
- {
- old_player.SetRestrained(false);
- }
- }
- }
-
- if ( newLoc.IsValid() )
- {
- if (newLoc.GetParent())
- {
- PlayerBase player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
-
- if ( player )
- {
- if ( newLoc.GetType() == InventoryLocationType.HANDS )
- {
- if ( !player.IsRestrained() )
- {
- player.SetRestrained(true);
- player.OnItemInHandsChanged();
- }
-
- if (player.IsControlledPlayer())
- player.OnRestrainStart();
- }
- }
- }
- }
-
- if ( GetGame().IsServer() )
- {
- if ( newLoc.GetType() != InventoryLocationType.HANDS )
- {
- if (oldLoc.GetParent())
- {
- PlayerBase old_p = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
- if (old_p)
- {
- MiscGameplayFunctions.TransformRestrainItem(this, null, old_p, old_p);
- return;
- }
- }
-
- Delete();
- }
- }
- }
-
- override void EEKilled(Object killer)
- {
- super.EEKilled(killer);
-
- InventoryLocation inventoryLocation = new InventoryLocation();
- GetInventory().GetCurrentInventoryLocation(inventoryLocation);
- if (!inventoryLocation || !inventoryLocation.IsValid())
- return;
- if (inventoryLocation.GetType() == InventoryLocationType.HANDS)
- {
- PlayerBase player = PlayerBase.Cast(inventoryLocation.GetParent());
- if (player && player.IsRestrained())
- {
- player.SetRestrained(false);
- MiscGameplayFunctions.TransformRestrainItem(this, null, player, player);
- }
- }
- }
-
- override void SetActions()
- {
- super.SetActions();
-
- AddAction(ActionUnrestrainSelf);
- }
- }
- class HandcuffsLocked extends RestrainingToolLocked
- {
- }
- class RopeLocked extends RestrainingToolLocked
- {
- }
- class DuctTapeLocked extends RestrainingToolLocked
- {
- }
- class MetalWireLocked extends RestrainingToolLocked
- {
- }
- class BarbedWireLocked extends RestrainingToolLocked
- {
- }
|