1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- class ActionTurnOnHeadtorch: ActionBase
- {
- void ActionTurnOnHeadtorch()
- {
- }
-
- override bool IsInstant()
- {
- return true;
- }
-
- override bool HasTarget()
- {
- return true;
- }
-
- override bool UseMainItem()
- {
- return false;
- }
-
- override void CreateConditionComponents()
- {
- m_ConditionItem = new CCINone;
- m_ConditionTarget = new CCTNonRuined(UAMaxDistances.DEFAULT);
- }
-
- override typename GetInputType()
- {
- return ToggleLightsActionInput;
- }
-
- override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
- {
- Headtorch_ColorBase headtorch;
- headtorch = Headtorch_ColorBase.Cast(target.GetObject());
- if ( !headtorch )
- return false;
-
- if ( headtorch.HasEnergyManager() && headtorch.GetCompEM().CanSwitchOn() && headtorch.GetCompEM().CanWork() ) //TODO review conditions for turning off
- {
- return true;
- }
-
- return false;
- }
- override void Start( ActionData action_data )
- {
- super.Start( action_data );
-
- Headtorch_ColorBase headtorch;
- headtorch = Headtorch_ColorBase.Cast(action_data.m_Target.GetObject());
- if ( headtorch.HasEnergyManager() )
- {
- if ( headtorch.GetCompEM().CanWork() )
- {
- headtorch.GetCompEM().SwitchOn();
- }
- }
- }
- };
|