11 super.InitItemVariables();
21 RegisterNetSyncVariableBool(
"m_Openable.m_IsOpened");
31 super.EECargoIn(item);
33 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(
ItemBase.Cast(item),
this);
38 super.OnFreezeStateChangeServer();
45 for (
int i = 0; i < count; ++i)
47 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(
ItemBase.Cast(cargo.
GetItem(i)),
this);
54 super.OnStoreSave( ctx );
61 if ( !super.OnStoreLoad( ctx, version ) )
65 if ( version >= 110 && !ctx.
Read( opened ) )
132 super.OnWasAttached(parent, slot_id);
139 super.OnWasDetached(parent, slot_id);
148 SetAnimationPhase(
"Lid",1);
149 SetAnimationPhase(
"Lid2",0);
153 SetAnimationPhase(
"Lid",0);
154 SetAnimationPhase(
"Lid2",1);
160 super.OnVariablesSynchronized();
182 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
190 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
198 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
206 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
215 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
223 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
225 ItemBase reactant =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
226 if ( ingredient && reactant &&
GetQuantity() > 5000 )
233 ItemBase ingredientR =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
235 ItemBase ingredientG =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
237 ItemBase ingredientB =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
238 if ( (ingredientR || ingredientG || ingredientB) &&
GetQuantity() > 10000)
258 ItemBase lime =
ItemBase.Cast( GetInventory().CreateInInventory(
"GardenLime") );
267 int item_count = GetInventory().GetCargo().GetItemCount();
272 for (
int i = 0; i < item_count; i++)
274 item = GetInventory().GetCargo().GetItem(i);
275 if ( item.IsPeltBase() )
277 pelt_count =
g_Game.ConfigGetInt(
"cfgVehicles " + item.GetType() +
" peltGain");
278 if ( pelt_count <= lime_amount )
281 lambda.SetTransferParams(
true,
true,
true);
282 player.ServerReplaceItemWithNew(lambda);
284 lime_amount -= pelt_count;
285 if ( lime_amount <= 0 )
297 if ( pelt_count > 0 )
306 int item_count = GetInventory().GetCargo().GetItemCount();
307 string item_name =
"";
310 for (
int i = 0; i < item_count; i++)
312 item = GetInventory().GetCargo().GetItem(i);
313 if ( item.IsClothing() )
315 if (
GetGame().ObjectIsKindOf (item,
"LeatherSack_Natural") )
317 item_name =
"Bag_LeatherSack_"+color;
319 else if (
GetGame().ObjectIsKindOf (item,
"LeatherStorageVest_Natural") )
321 item_name =
"Vest_LeatherStorage_"+color;
323 else if (
GetGame().ObjectIsKindOf (item,
"LeatherJacket_Natural") )
325 item_name =
"Top_LeatherJacket_"+color;
327 else if (
GetGame().ObjectIsKindOf (item,
"LeatherPants_Natural") )
329 item_name =
"Pants_LeatherPants_"+color;
331 else if (
GetGame().ObjectIsKindOf (item,
"LeatherMoccasinsShoes_Natural") )
333 item_name =
"Shoes_LeatherMoccasins_"+color;
335 else if (
GetGame().ObjectIsKindOf (item,
"LeatherHat_Natural") )
337 item_name =
"Hat_Leather_"+color;
339 if ( item_name !=
"" )
342 lambda.SetTransferParams(
true,
true,
true);
343 player.ServerReplaceItemWithNew(lambda);
347 if ( item_name !=
"" )
357 int bleach_amount = bleach.GetQuantity();
358 int item_count = GetInventory().GetCargo().GetItemCount();
359 string item_name =
"";
361 for (
int i = 0; i < item_count; i++)
363 item = GetInventory().GetCargo().GetItem(i);
364 if ( item.IsClothing() )
368 if ( (
GetGame().ObjectIsKindOf (item,
"TShirt_ColorBase") && !
GetGame().ObjectIsKindOf (item,
"TShirt_White") ) || (
GetGame().ObjectIsKindOf (item,
"Armband_ColorBase") && !
GetGame().ObjectIsKindOf (item,
"Armband_White") ) )
370 int index = item.GetType().IndexOf(
"_");
371 string itemtype = item.GetType().Substring( 0, index + 1 );
373 MiscGameplayFunctions.TurnItemIntoItem(itemIB,itemtype+
"White",player);
377 if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherSack_ColorBase") )
379 item_name =
"LeatherSack_Natural";
381 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherStorageVest_ColorBase") )
383 item_name =
"LeatherStorageVest_Natural";
385 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherJacket_ColorBase") )
387 item_name =
"LeatherJacket_Natural";
389 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherPants_ColorBase") )
391 item_name =
"LeatherPants_Natural";
393 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherMoccasinsShoes_ColorBase") )
395 item_name =
"LeatherMoccasinsShoes_Natural";
397 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherHat_ColorBase") )
399 item_name =
"LeatherHat_Natural";
401 if ( item_name !=
"" )
404 lambda.SetTransferParams(
true,
true,
true);
405 player.ServerReplaceItemWithNew(lambda);
420 if ( item_name !=
"" )
433 int item_count = GetInventory().GetCargo().GetItemCount();
434 bool was_colored =
false;
437 r = rci.GetQuantity()/10;
442 g = gci.GetQuantity()/10;
447 b = bci.GetQuantity()/10;
450 for (
int i = 0; i < item_count; i++)
452 item = GetInventory().GetCargo().GetItem(i);
453 if ( item.IsClothing() )
455 if (
GetGame().ObjectIsKindOf (item,
"TShirt_White") ||
GetGame().ObjectIsKindOf (item,
"Armband_White") )
458 int index = itemIB.GetType().IndexOf(
"_");
459 string itemtype = itemIB.GetType().Substring( 0, index + 1 );
462 clambda.SetTransferParams(
true,
true,
true);
463 MiscGameplayFunctions.TurnItemIntoItemEx(player, clambda);
492 if ( !super.CanPutInCargo( parent ))
503 if ( !super.CanPutIntoHands( parent ))
515 return super.CanReceiveItemIntoCargo( item );
534 super.InitItemSounds();
547 return "placeBarrel_SoundSet";
552 return "barrel_open_SoundSet";
557 return "barrel_close_SoundSet";
598 {
r = rr;
g = gg;
b = bb;
a = aa; }
602 super.CopyOldPropertiesToNew(old_item, new_item);
608 new_item.SetObjectTexture(new_item.GetHiddenSelectionsData().GetHiddenSelectionIndex(
"personality" ), MiscGameplayFunctions.GetColorString(
r,
g,
b,
a));
611 ib.SetColor(
r*255,
g*255,
b*255,
a*255);
624 super.CopyOldPropertiesToNew(old_item, new_item);
633 Debug.
LogError(
"TanLeatherLambda: failed to create new item",
"static");
void AddAction(typename actionName)
void DeployableContainer_Base()
Container_Base m_HalfExtents
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override float GetQuantity()
ItemSoundHandler GetItemSoundHandler()
override void SetTakeable(bool pState)
override int GetLiquidType()
void ItemSoundHandler(ItemBase parent)
override bool CanDetachAttachment(EntityAI parent)
override bool CanPutInCargo(EntityAI parent)
override void InitItemVariables()
override void OnVariablesSynchronized()
override void OnDebugSpawn()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
ref RainProcurementManager m_RainProcurement
string GetBarrelOpenSoundset()
override void InitItemSounds()
override bool CanReceiveItemIntoCargo(EntityAI item)
void ColourLeatherClothes(ItemBase color_source, PlayerBase player, string color)
override void EECargoIn(EntityAI item)
void BleachClothes(ItemBase bleach, PlayerBase player)
void ProduceFertilizer(ItemBase guts, ItemBase plant, PlayerBase player)
void DetermineAction(PlayerBase player)
override void OnWasDetached(EntityAI parent, int slot_id)
void ColourClothes(ItemBase rci, ItemBase gci, ItemBase bci, PlayerBase player)
void SoundBarrelClosePlay()
override bool CanReleaseCargo(EntityAI cargo)
override string GetDeploySoundset()
override void SetActions()
void SoundBarrelOpenPlay()
void Lock(float actiontime)
override float GetLiquidThroughputCoef()
override int GetDamageSystemVersionChange()
override void OnStoreSave(ParamsWriteContext ctx)
string GetBarrelCloseSoundset()
override bool CanPutIntoHands(EntityAI parent)
override void OnWasAttached(EntityAI parent, int slot_id)
ref OpenableBehaviour m_Openable
override void OnFreezeStateChangeServer()
ref RainProcurementComponentBarrel m_RainProcComponent
void TanPelts(ItemBase lime, PlayerBase player)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Super root of all classes in Enforce script.
void ColourClothesLambda(EntityAI old_item, string new_item_type, PlayerBase player, int rr, int gg, int bb, int aa)
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
DEPRECATED, done through the RainProcurementHandler / component instead.
proto bool Write(void value_out)
proto bool Read(void value_in)
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
void TanLeatherLambda(EntityAI old_item, string new_item_type, PlayerBase player, int pelt_count)
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
const int BAREL_BLEACH_PER_CLOTH
const int BAREL_LIME_PER_PELT
const float BAREL_LIME_PER_PLANT
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float LIQUID_THROUGHPUT_BARREL
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Floor(float f)
Returns floor of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.