3 private bool m_IsLocked =
false;
4 private ref
Timer m_BarrelOpener;
11 m_BarrelOpener =
new Timer();
19 RegisterNetSyncVariableBool(
"m_Openable.m_IsOpened");
20 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
21 RegisterNetSyncVariableBool(
"m_IsPlaceSound");
24 override int GetDamageSystemVersionChange()
29 override void EECargoIn(
EntityAI item)
31 super.EECargoIn(item);
33 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(
ItemBase.Cast(item),
this);
38 super.OnStoreSave( ctx );
40 ctx.Write( m_Openable.IsOpened() );
45 if ( !super.OnStoreLoad( ctx, version ) )
49 if ( version >= 110 && !ctx.Read( opened ) )
74 m_RainProcComponent.StartRainProcurement();
84 m_RainProcComponent.StartRainProcurement();
94 m_RainProcComponent.StopRainProcurement();
104 m_RainProcComponent.StopRainProcurement();
111 override bool IsOpen()
113 return m_Openable.IsOpened();
116 override void OnWasAttached(
EntityAI parent,
int slot_id)
118 super.OnWasAttached(parent, slot_id);
123 override void OnWasDetached(
EntityAI parent,
int slot_id)
125 super.OnWasDetached(parent, slot_id);
130 protected void UpdateVisualState()
134 SetAnimationPhase(
"Lid",1);
135 SetAnimationPhase(
"Lid2",0);
139 SetAnimationPhase(
"Lid",0);
140 SetAnimationPhase(
"Lid2",1);
144 override void OnVariablesSynchronized()
146 super.OnVariablesSynchronized();
156 SoundBarrelOpenPlay();
158 else if ( !IsOpen() )
160 SoundBarrelClosePlay();
166 void SoundBarrelOpenPlay()
169 sound.SetAutodestroy(
true );
172 void SoundBarrelClosePlay()
175 sound.SetAutodestroy(
true );
178 void Lock(
float actiontime)
181 m_BarrelOpener.Run(actiontime,
this,
"Unlock", NULL,
false);
195 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
198 TanPelts(ingredient, player);
203 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
206 ColourLeatherClothes(ingredient, player,
"Black");
211 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
214 ColourLeatherClothes(ingredient, player,
"Beige");
219 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
222 ColourLeatherClothes(ingredient, player,
"Brown");
228 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
231 BleachClothes(ingredient, player);
236 ingredient =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
238 ItemBase reactant =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
239 if ( ingredient && reactant &&
GetQuantity() > 5000 )
241 ProduceFertilizer(ingredient,reactant,player);
246 ItemBase ingredientR =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
248 ItemBase ingredientG =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
250 ItemBase ingredientB =
ItemBase.Cast( GetInventory().FindAttachment(slot_id) );
251 if ( (ingredientR || ingredientG || ingredientB) &&
GetQuantity() > 10000)
253 ColourClothes(ingredientR,ingredientG,ingredientB,player);
266 float lime_quantity = plant.GetQuantity()*
GameConstants.BAREL_LIME_PER_PLANT;
271 ItemBase lime =
ItemBase.Cast( GetInventory().CreateInInventory(
"GardenLime") );
273 lime.SetQuantity(lime_quantity);
280 int item_count = GetInventory().GetCargo().GetItemCount();
282 int lime_amount =
Math.Floor(lime.GetQuantity()/
GameConstants.BAREL_LIME_PER_PELT);
285 for (
int i = 0; i < item_count; i++)
287 item = GetInventory().GetCargo().GetItem(i);
288 if ( item.IsPeltBase() )
290 pelt_count =
g_Game.ConfigGetInt(
"cfgVehicles " + item.GetType() +
" peltGain");
291 if ( pelt_count <= lime_amount )
294 lambda.SetTransferParams(
true,
true,
true);
295 player.ServerReplaceItemWithNew(lambda);
297 lime_amount -= pelt_count;
298 if ( lime_amount <= 0 )
308 lime.SetQuantity(lime_amount*
GameConstants.BAREL_LIME_PER_PELT);
310 if ( pelt_count > 0 )
319 int item_count = GetInventory().GetCargo().GetItemCount();
320 string item_name =
"";
323 for (
int i = 0; i < item_count; i++)
325 item = GetInventory().GetCargo().GetItem(i);
326 if ( item.IsClothing() )
328 if (
GetGame().ObjectIsKindOf (item,
"LeatherSack_Natural") )
330 item_name =
"Bag_LeatherSack_"+color;
332 else if (
GetGame().ObjectIsKindOf (item,
"LeatherStorageVest_Natural") )
334 item_name =
"Vest_LeatherStorage_"+color;
336 else if (
GetGame().ObjectIsKindOf (item,
"LeatherJacket_Natural") )
338 item_name =
"Top_LeatherJacket_"+color;
340 else if (
GetGame().ObjectIsKindOf (item,
"LeatherPants_Natural") )
342 item_name =
"Pants_LeatherPants_"+color;
344 else if (
GetGame().ObjectIsKindOf (item,
"LeatherMoccasinsShoes_Natural") )
346 item_name =
"Shoes_LeatherMoccasins_"+color;
348 else if (
GetGame().ObjectIsKindOf (item,
"LeatherHat_Natural") )
350 item_name =
"Hat_Leather_"+color;
352 if ( item_name !=
"" )
355 lambda.SetTransferParams(
true,
true,
true);
356 player.ServerReplaceItemWithNew(lambda);
360 if ( item_name !=
"" )
370 int bleach_amount = bleach.GetQuantity();
371 int item_count = GetInventory().GetCargo().GetItemCount();
372 string item_name =
"";
374 for (
int i = 0; i < item_count; i++)
376 item = GetInventory().GetCargo().GetItem(i);
377 if ( item.IsClothing() )
381 if ( (
GetGame().ObjectIsKindOf (item,
"TShirt_ColorBase") && !
GetGame().ObjectIsKindOf (item,
"TShirt_White") ) || (
GetGame().ObjectIsKindOf (item,
"Armband_ColorBase") && !
GetGame().ObjectIsKindOf (item,
"Armband_White") ) )
383 int index = item.GetType().IndexOf(
"_");
384 string itemtype = item.GetType().Substring( 0, index + 1 );
386 MiscGameplayFunctions.TurnItemIntoItem(itemIB,itemtype+
"White",player);
390 if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherSack_ColorBase") )
392 item_name =
"LeatherSack_Natural";
394 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherStorageVest_ColorBase") )
396 item_name =
"LeatherStorageVest_Natural";
398 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherJacket_ColorBase") )
400 item_name =
"LeatherJacket_Natural";
402 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherPants_ColorBase") )
404 item_name =
"LeatherPants_Natural";
406 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherMoccasinsShoes_ColorBase") )
408 item_name =
"LeatherMoccasinsShoes_Natural";
410 else if (
GetGame().IsKindOf (item.GetDisplayName(),
"LeatherHat_ColorBase") )
412 item_name =
"LeatherHat_Natural";
414 if ( item_name !=
"" )
417 lambda.SetTransferParams(
true,
true,
true);
418 player.ServerReplaceItemWithNew(lambda);
431 bleach.SetQuantity(bleach_amount);
433 if ( item_name !=
"" )
446 int item_count = GetInventory().GetCargo().GetItemCount();
447 bool was_colored =
false;
450 r = rci.GetQuantity()/10;
451 r =
Math.Clamp(r, 0, 0.78);
455 g = gci.GetQuantity()/10;
456 g =
Math.Clamp(g, 0, 0.78);
460 b = bci.GetQuantity()/10;
461 b =
Math.Clamp(b, 0, 0.78);
463 for (
int i = 0; i < item_count; i++)
465 item = GetInventory().GetCargo().GetItem(i);
466 if ( item.IsClothing() )
468 if (
GetGame().ObjectIsKindOf (item,
"TShirt_White") ||
GetGame().ObjectIsKindOf (item,
"Armband_White") )
471 int index = itemIB.GetType().IndexOf(
"_");
472 string itemtype = itemIB.GetType().Substring( 0, index + 1 );
475 clambda.SetTransferParams(
true,
true,
true);
476 MiscGameplayFunctions.TurnItemIntoItemEx(player, clambda);
503 override bool CanPutInCargo(
EntityAI parent )
505 if ( !super.CanPutInCargo( parent ))
514 override bool CanPutIntoHands(
EntityAI parent )
516 if ( !super.CanPutIntoHands( parent ))
519 if (
GetNumberOfItems() == 0 && (GetInventory().IsAttachment() || !IsOpen()) )
525 override bool CanReceiveItemIntoCargo(
EntityAI item )
528 return super.CanReceiveItemIntoCargo( item );
533 override bool CanReleaseCargo(
EntityAI attachment )
538 override bool CanDetachAttachment(
EntityAI parent )
548 override void OnPlacementComplete( Man player,
vector position =
"0 0 0",
vector orientation =
"0 0 0" )
550 super.OnPlacementComplete( player, position, orientation );
555 override string GetPlaceSoundset()
557 return "placeBarrel_SoundSet";
561 override float GetLiquidThroughputCoef()
566 override void SetActions()
576 override void OnDebugSpawn()
596 { r = rr; g = gg; b = bb; a = aa; }
598 override void CopyOldPropertiesToNew(notnull
EntityAI old_item,
EntityAI new_item)
600 super.CopyOldPropertiesToNew(old_item, new_item);
606 new_item.SetObjectTexture(new_item.GetHiddenSelectionsData().GetHiddenSelectionIndex(
"personality" ), MiscGameplayFunctions.GetColorString(r, g, b, a));
609 ib.SetColor(r*255, g*255, b*255, a*255);
620 override void CopyOldPropertiesToNew (notnull
EntityAI old_item,
EntityAI new_item)
622 super.CopyOldPropertiesToNew(old_item, new_item);
627 tanned_pelt.SetQuantity(m_PeltCount);
631 Debug.LogError(
"TanLeatherLambda: failed to create new item",
"static");