3 override void CreateActionComponent()
11 static int CYCLES = 4;
24 override void CreateConditionComponents()
33 m_Text =
"#destroy " + construction_action_data.GetTargetPart();
36 override bool CanBeUsedLeaning()
44 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
47 return DestroyCondition( player, target, item,
true );
50 override bool ActionConditionContinue(
ActionData action_data )
52 return DestroyCondition( action_data.m_Player, action_data.m_Target, action_data.m_MainItem ,
false );
55 override void OnFinishProgressServer(
ActionData action_data )
58 Construction construction = base_building.GetConstruction();
60 ConstructionPart construction_part = construction_action_data.GetTargetPart();
62 if ( construction.CanDestroyPart( construction_part.GetPartName() ) )
65 string part_name = construction_part.GetPartName();
67 DamageSystem.GetDamageZoneFromComponentName(base_building,part_name,zone_name);
71 base_building.AddHealth(zone_name,
"Health",-(base_building.GetMaxHealth(zone_name,
"")/CYCLES));
72 if ( base_building.GetHealth(zone_name,
"Health") < 1 )
73 construction.DestroyPartServer( action_data.m_Player, construction_part.GetPartName(),
AT_DESTROY_PART );
77 construction.DestroyPartServer( action_data.m_Player, construction_part.GetPartName(),
AT_DESTROY_PART );
81 action_data.m_MainItem.DecreaseHealth(
UADamageApplied.DESTROY,
false );
89 Object target_object = target.GetObject();
90 if ( target_object && target_object.CanUseConstruction() )
92 string part_name = target_object.GetActionComponentName( target.GetComponentIndex() );
95 Construction construction = base_building.GetConstruction();
96 ConstructionPart construction_part = construction.GetConstructionPartToDestroy( part_name );
98 if ( construction_part )
101 if ( !player.GetInputController().CameraIsFreeLook() &&
IsInReach(player, target,
UAMaxDistances.DEFAULT) && !player.GetInputController().CameraIsFreeLook() )
108 if ( !base_building.IsFacingCamera( part_name ) )
116 construction_action_data.SetTargetPart( construction_part );
126 override string GetAdminLogMessage(
ActionData action_data)
128 return " destroyed " + action_data.m_Target.GetObject().GetDisplayName() +
" with " + action_data.m_MainItem.GetDisplayName();