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 (
g_Game.ObjectIsKindOf (item,
"LeatherSack_Natural") )
317 item_name =
"Bag_LeatherSack_"+color;
319 else if (
g_Game.ObjectIsKindOf (item,
"LeatherStorageVest_Natural") )
321 item_name =
"Vest_LeatherStorage_"+color;
323 else if (
g_Game.ObjectIsKindOf (item,
"LeatherJacket_Natural") )
325 item_name =
"Top_LeatherJacket_"+color;
327 else if (
g_Game.ObjectIsKindOf (item,
"LeatherPants_Natural") )
329 item_name =
"Pants_LeatherPants_"+color;
331 else if (
g_Game.ObjectIsKindOf (item,
"LeatherMoccasinsShoes_Natural") )
333 item_name =
"Shoes_LeatherMoccasins_"+color;
335 else if (
g_Game.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 ( (
g_Game.ObjectIsKindOf (item,
"TShirt_ColorBase") && !
g_Game.ObjectIsKindOf (item,
"TShirt_White") ) || (
g_Game.ObjectIsKindOf (item,
"Armband_ColorBase") && !
g_Game.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 (
g_Game.IsKindOf (item.GetDisplayName(),
"LeatherSack_ColorBase") )
379 item_name =
"LeatherSack_Natural";
381 else if (
g_Game.IsKindOf (item.GetDisplayName(),
"LeatherStorageVest_ColorBase") )
383 item_name =
"LeatherStorageVest_Natural";
385 else if (
g_Game.IsKindOf (item.GetDisplayName(),
"LeatherJacket_ColorBase") )
387 item_name =
"LeatherJacket_Natural";
389 else if (
g_Game.IsKindOf (item.GetDisplayName(),
"LeatherPants_ColorBase") )
391 item_name =
"LeatherPants_Natural";
393 else if (
g_Game.IsKindOf (item.GetDisplayName(),
"LeatherMoccasinsShoes_ColorBase") )
395 item_name =
"LeatherMoccasinsShoes_Natural";
397 else if (
g_Game.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 (
g_Game.ObjectIsKindOf (item,
"TShirt_White") ||
g_Game.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);
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)
override void OnDebugSpawn()
override void OnFreezeStateChangeServer()
override void EECargoIn(EntityAI item)
override string GetDeploySoundset()
void TanPelts(ItemBase lime, PlayerBase player)
override void OnStoreSave(ParamsWriteContext ctx)
void SoundBarrelOpenPlay()
override bool CanReceiveItemIntoCargo(EntityAI item)
void ColourLeatherClothes(ItemBase color_source, PlayerBase player, string color)
void ColourClothes(ItemBase rci, ItemBase gci, ItemBase bci, PlayerBase player)
void Lock(float actiontime)
override bool CanPutInCargo(EntityAI parent)
void SoundBarrelClosePlay()
string GetBarrelOpenSoundset()
void DetermineAction(PlayerBase player)
override bool CanReleaseCargo(EntityAI cargo)
override int GetDamageSystemVersionChange()
ref RainProcurementManager m_RainProcurement
override void OnWasDetached(EntityAI parent, int slot_id)
override bool CanPutIntoHands(EntityAI parent)
string GetBarrelCloseSoundset()
ref OpenableBehaviour m_Openable
ref RainProcurementComponentBarrel m_RainProcComponent
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasAttached(EntityAI parent, int slot_id)
override void OnVariablesSynchronized()
override bool CanDetachAttachment(EntityAI parent)
void ProduceFertilizer(ItemBase guts, ItemBase plant, PlayerBase player)
override float GetLiquidThroughputCoef()
override void InitItemVariables()
void BleachClothes(ItemBase bleach, PlayerBase player)
override void InitItemSounds()
override void SetActions()
represents base for cargo storage for entities
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
Super root of all classes in Enforce script.
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
void ColourClothesLambda(EntityAI old_item, string new_item_type, PlayerBase player, int rr, int gg, int bb, int aa)
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.
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
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)
void DeployableContainer_Base()
Container_Base m_HalfExtents
Serializer ParamsReadContext
Serializer ParamsWriteContext
const int BAREL_LIME_PER_PELT
const float BAREL_LIME_PER_PLANT
const int BAREL_BLEACH_PER_CLOTH
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 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'.
static proto float Floor(float f)
Returns floor of value.
ItemSoundHandler GetItemSoundHandler()
override float GetQuantity()
override void SetTakeable(bool pState)
override int GetLiquidType()
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
void ItemSoundHandler(ItemBase parent)