1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //!DEPRECATED
- class ActionTakeOvenIndoor: ActionInteractBase
- {
- string m_NewItemTypeName = "Fireplace";
- void ActionTakeOvenIndoor()
- {
- m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
- m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
- m_Text = "#take_fireplace";
- }
-
- override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
- {
- Object target_object = target.GetObject();
-
- //empty hands --interact action base condition
- if ( target_object && target_object.IsFireplace() )
- {
- OvenIndoor fireplace_indoor = OvenIndoor.Cast( target_object );
-
- if ( fireplace_indoor && !fireplace_indoor.HasAshes() && !fireplace_indoor.IsBurning() && fireplace_indoor.IsCargoEmpty() && !fireplace_indoor.DirectCookingSlotsInUse() )
- {
- InventoryLocation targetIL = new InventoryLocation;
- bool found = player.GetInventory().FindFirstFreeLocationForNewEntity( m_NewItemTypeName, FindInventoryLocationType.ANY, targetIL );
- return found;
- }
- }
- return false;
- }
- override void OnExecuteServer( ActionData action_data )
- {
- Object target_object = action_data.m_Target.GetObject();
- OvenIndoor fireplace_indoor = OvenIndoor.Cast( target_object );
-
- TakeOvenFromIndoorLambda lambda( fireplace_indoor, m_NewItemTypeName, action_data.m_Player );
- InventoryLocation targetIL = new InventoryLocation;
- bool found = action_data.m_Player.GetInventory().FindFirstFreeLocationForNewEntity( m_NewItemTypeName, FindInventoryLocationType.ANY, targetIL );
- if ( found )
- {
- // allow action only if there is place in inventory
- lambda.OverrideNewLocation( targetIL );
- action_data.m_Player.ServerReplaceItemWithNew( lambda );
- }
- }
- }
- class TakeOvenFromIndoorLambda : ReplaceItemWithNewLambdaBase
- {
- PlayerBase m_Player;
- void TakeOvenFromIndoorLambda ( EntityAI old_item, string new_item_type, PlayerBase player )
- {
- m_Player = player;
- }
- override void CopyOldPropertiesToNew( notnull EntityAI old_item, EntityAI new_item )
- {
- super.CopyOldPropertiesToNew( old_item, new_item );
- MiscGameplayFunctions.TransferInventory(old_item, new_item, m_Player);
- }
- }
|