10 int m_ComponentIndexRecived;
20 override void CreateActionComponent()
22 float time = SetCallbackDuration(m_ActionData.m_MainItem);
26 float SetCallbackDuration(
ItemBase item )
52 override void CreateConditionComponents()
61 m_Text =
"#repair " + construction_action_data.GetTargetPart().GetName();
64 override string GetText()
70 ConstructionPart constrution_part = construction_action_data.GetTargetPart();
72 if ( constrution_part )
74 return "#repair" +
" " + constrution_part.GetName();
84 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
87 return RepairCondition( player, target, item,
true );
90 override bool ActionConditionContinue(
ActionData action_data )
92 return RepairCondition( action_data.m_Player, action_data.m_Target, action_data.m_MainItem ,
false );
95 override void OnFinishProgressServer(
ActionData action_data )
98 Construction construction = base_building.GetConstruction();
101 string part_name = action_data.m_Target.GetObject().GetActionComponentName( RepairPartActionData.Cast(action_data).m_ComponentIndex );
103 PluginRepairing module_repairing;
106 DamageSystem.GetDamageZoneFromComponentName(base_building,part_name,zone_name);
107 module_repairing.Repair(action_data.m_Player,action_data.m_MainItem,base_building,
m_SpecialtyWeight,zone_name);
110 construction.TakeMaterialsServer(part_name,
true);
113 action_data.m_MainItem.DecreaseHealth(
UADamageApplied.REPAIR,
false );
118 protected override void SetBuildingAnimation(
ItemBase item )
120 switch( item.Type() )
139 RepairPartActionData action_data =
new RepairPartActionData;
145 super.WriteToContext(ctx, action_data);
146 RepairPartActionData repair_action_data;
150 repair_action_data.m_ComponentIndex = action_data.m_Target.GetComponentIndex();
151 ctx.Write(repair_action_data.m_ComponentIndex);
155 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data )
157 if(!action_recive_data)
163 super.ReadFromContext(ctx, action_recive_data);
168 if ( !ctx.Read(component_index) )
171 recive_data_repair.m_ComponentIndexRecived = component_index;
176 override void HandleReciveData(ActionReciveData action_recive_data,
ActionData action_data)
178 super.HandleReciveData(action_recive_data, action_data);
181 RepairPartActionData.Cast(action_data).m_ComponentIndex = recive_data_repair.m_ComponentIndexRecived;
188 Object target_object = target.GetObject();
189 if ( target_object && target_object.CanUseConstruction() )
191 string part_name = target_object.GetActionComponentName( target.GetComponentIndex() );
194 Construction construction = base_building.GetConstruction();
195 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
197 if ( construction_part )
200 if ( !base_building.IsFacingPlayer( player, part_name ) && !player.GetInputController().CameraIsFreeLook() && base_building.HasProperDistance( construction_part.GetMainPartName(), player ) )
207 if ( base_building.IsFacingCamera( part_name ) )
215 DamageSystem.GetDamageZoneFromComponentName(base_building,part_name,zone_name);
216 if ( base_building.GetHealthLevel(zone_name) <
GameConstants.STATE_WORN || base_building.GetHealthLevel(zone_name) ==
GameConstants.STATE_RUINED )
222 if ( !construction.HasMaterials(part_name,
true) )
228 construction_action_data.SetTargetPart( construction_part );
237 override string GetAdminLogMessage(
ActionData action_data)
239 return " repaired " + action_data.m_Target.GetObject().GetDisplayName() +
" with " + action_data.m_MainItem.GetDisplayName();