35 override void CreateConditionComponents()
48 return other_player.CanBeRestrained();
52 return !other_player.IsRestrained();
65 override bool ActionConditionContinue(ActionData action_data)
71 if ( target_player.IsSurrendered() || !target_player.CanBeRestrained() )
80 if ( callback.GetActionComponentProgress() > 0.75 && !target_player.IsRestrainPrelocked() )
82 target_player.SetRestrainPrelocked(
true);
85 return !
GetGame().GetMission().IsPlayerDisconnecting(target_player);
91 override void OnStartServer(ActionData action_data)
93 super.OnStartServer(action_data);
96 if ( target_player.IsSurrendered() )
98 SurrenderDataRestrain sdr =
new SurrenderDataRestrain;
99 target_player.EndSurrenderRequest(sdr);
101 else if ( target_player.IsEmotePlaying() )
103 target_player.m_EmoteManager.ServerRequestEmoteCancel();
106 target_player.SetRestrainStarted(
true);
109 override void OnEndServer(ActionData action_data)
111 super.OnEndServer(action_data);
116 target_player.SetRestrainStarted(
false);
117 target_player.SetRestrainPrelocked(
false);
121 override void OnFinishProgressServer( ActionData action_data )
126 if (
CanReceiveAction(action_data.m_Target) && !target_player.IsRestrained())
128 EntityAI item_in_hands_target = target_player.GetHumanInventory().GetEntityInHands();
129 EntityAI item_in_hands_source = source_player.GetHumanInventory().GetEntityInHands();
131 if ( !item_in_hands_source )
133 Error(
"Restraining target failed, nothing in hands");
137 string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands_source);
138 if (item_in_hands_target)
141 MiscGameplayFunctions.TurnItemInHandsIntoItemEx(target_player, lambda2);
146 source_player.LocalReplaceItemInHandsWithNewElsewhere(lambda);
151 override void OnFinishProgressClient( ActionData action_data )
153 super.OnFinishProgressClient( action_data );
162 ExplosivesBase m_PairedExplosive;
166 m_SourcePlayer = src_player;
169 override void OnSuccess(
EntityAI new_item)
171 super.OnSuccess(new_item);
173 if (m_PairedExplosive)
175 m_PairedExplosive.UnpairRemote();
177 ib.PairWithDevice(m_PairedExplosive);
178 m_PairedExplosive.Arm();
182 EntityAI item_in_hands_source = m_SourcePlayer.GetHumanInventory().GetEntityInHands();
183 if (item_in_hands_source)
185 string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands_source);
188 m_SourcePlayer.LocalReplaceItemInHandsWithNewElsewhere(lambda);
190 Error(
"ChainedDropAndRestrainLambda: missing source player!");
194 Error(
"ChainedDropAndRestrainLambda: missing source item in hands!");
198 override void CopyOldPropertiesToNew (notnull
EntityAI old_item,
EntityAI new_item)
200 super.CopyOldPropertiesToNew(old_item, new_item);