1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- class Guts extends Edible_Base
- {
- override bool CanPutAsAttachment( EntityAI parent )
- {
- if(!super.CanPutAsAttachment(parent)) {return false;}
- const int SLOTS_ARRAY = 8;
- bool is_barrel = false;
- bool is_opened_barrel = false;
- bool slot_test = true;
- string slot_names[SLOTS_ARRAY] = { "BerryR", "BerryB", "Nails", "OakBark", "BirchBark", "Lime", "Disinfectant" };
-
- // is barrel
- if ( parent.IsKindOf("Barrel_ColorBase") )
- {
- is_barrel = true;
- }
- // is opened barrel
- if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
- {
- is_opened_barrel = true;
- }
- // all of the barrel slots are empty
- for ( int i = 0; i < SLOTS_ARRAY ; i++ )
- {
- if ( parent.FindAttachmentBySlotName(slot_names[i]) != NULL )
- {
- slot_test = false;
- break;
- }
- }
-
- if ( ( is_opened_barrel && slot_test ) || !is_barrel )
- {
- return true;
- }
- return false;
- }
- override bool CanDetachAttachment( EntityAI parent )
- {
-
- bool is_barrel = false;
- bool is_opened_barrel = false;
-
- // is barrel
- if ( parent.IsKindOf("Barrel_ColorBase") )
- {
- is_barrel = true;
- }
- // is opened barrel
- if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
- {
- is_opened_barrel = true;
- }
-
- if ( is_opened_barrel || !is_barrel )
- {
- return true;
- }
- return false;
- }
-
- override void SetActions()
- {
- super.SetActions();
-
- AddAction(ActionForceFeed);
- AddAction(ActionEatBig);
- }
- }
|