45 string cfg_path =
"CfgVehicles " +
GetType();
52 RegisterNetSyncVariableBool(
"m_CanReceiveUpgrade");
77 if (GetHierarchyRoot())
79 return GetHierarchyRoot().GetPosition();
82 return super.GetPosition();
87 super.EEDelete(parent);
99 if (att && att.IsFullQuantity())
107 if( !super.CanPutInCargo(parent) ) {
return false;}
113 if( !super.CanReleaseAttachment( attachment ) )
115 return !GetCompEM().IsWorking();
125 return !GetCompEM().IsWorking();
131 return !GetCompEM().IsWorking();
136 return GetCompEM().IsWorking();
141 return GetCompEM().IsWorking();
152 if ( !GetCompEM().CheckWetness() )
157 if (rag && GetCompEM().
GetEnergy() < GetCompEM().GetEnergyUsage() * GetCompEM().GetUpdateInterval() )
163 if ( !GetCompEM().CanWork() )
172 if (
this != player.GetItemInHands())
183 float wetness = rag.GetWet();
184 bool is_dry_enough = wetness <= 1-GetCompEM().GetWetnessExposure();
185 return is_dry_enough;
199 if ( !GetCompEM().HasEnoughStoredEnergy() )
204 GetCompEM().SwitchOn();
209 if (!GetCompEM().HasEnoughStoredEnergy())
211 GetCompEM().SwitchOff();
239 if (rag.GetQuantity() <= 1)
257 float lard_quant = lard.GetQuantity();
259 float available_lard_quant = lard_quant;
267 float add_energy_coef = 1;
269 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
271 if (add_energy > energy_limit )
273 add_energy_coef = energy_limit / add_energy;
274 add_energy = energy_limit;
275 available_lard_quant = available_lard_quant * add_energy_coef;
278 GetCompEM().AddEnergy( add_energy );
279 lard.AddQuantity(-available_lard_quant);
295 float torchCurrentEnergy = GetCompEM().GetEnergy();
296 float sourceQuantity = 100000;
300 sourceQuantity = source.GetQuantity();
307 float freeUpgradeCapacity = maxOverallCapacity - torchCurrentEnergy;
308 float upgradeQuantity =
Math.
Min(freeUpgradeCapacity, sourceQuantity);
312 GetCompEM().AddEnergy(upgradeQuantity);
316 source.AddQuantity(-upgradeQuantity);
328 float vessel_quant = vessel.GetQuantity();
330 float available_vessel_quant = vessel_quant;
338 float add_energy_coef = 1;
340 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
342 if (add_energy > energy_limit )
344 add_energy_coef = energy_limit / add_energy;
345 add_energy = energy_limit;
346 available_vessel_quant = available_vessel_quant * add_energy_coef;
349 GetCompEM().AddEnergy( add_energy );
350 vessel.AddQuantity(-available_vessel_quant);
361 float add_energy_coef = 1;
363 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
365 if (add_energy > energy_limit )
367 add_energy_coef = energy_limit / add_energy;
368 add_energy = energy_limit;
371 GetCompEM().AddEnergy( add_energy );
389 super.OnInventoryExit(player);
402 if ( is_surface_soft && !IsRuined() )
404 vector ori_rotate =
"0 0 0";
407 SetOrientation(ori_rotate);
438 super.EEItemAttached( item, slot_name );
446 super.EEItemDetached( item, slot_name );
454 MiscGameplayFunctions.TransferItemProperties(item, rags);
487 player.ServerReplaceItemInHandsWithNew(lambda);
495 if (
GetType() ==
"WoodenStick" )
496 ori = ori +
Vector(0,90,0);
500 stick.SetPosition(pos);
501 stick.PlaceOnSurface();
503 if ( stick.GetType() ==
"LongWoodenStick" )
505 pos = stick.GetPosition() +
Vector(0,-0.3,0);
506 stick.SetPosition(pos);
509 stick.SetOrientation(ori);
533 return Rag.Cast( GetAttachmentByType(Rag) );
547 rag.UnlockFromParent();
564 if (direct_particle && direct_particle !=
m_Light.GetAttachmentParent())
570 float update_interval = GetCompEM().GetUpdateInterval();
583 m_Light.FadeBrightnessTo(
m_Light.m_TorchBrightness * brightness_coef, update_interval);
584 m_Light.FadeRadiusTo(
m_Light.m_TorchRadius * radius_coef, update_interval);
588 m_Light.FadeBrightnessTo(
m_Light.m_TorchBrightness, update_interval);
595 GetCompEM().SwitchOff();
599 override void OnWork(
float consumed_energy )
647 if ( !
GetGame().IsDedicatedServer() )
732 if ( GetCompEM().IsWorking() )
740 if ( GetCompEM().IsWorking() )
748 if ( GetCompEM().IsWorking() )
763 super.OnAttachmentQuantityChangedEx(item, delta);
766 if (delta > 0 || !GetCompEM().IsWorking())
782 GetInventory().CreateAttachment(
"Rag");
810 if (GetCompEM().IsWorking())
830 super.OnStoreSave(ctx);
837 if (!super.OnStoreLoad(ctx, version))
861 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
866 super.GetDebugActions(outputList);
871 if (super.OnAction(action_id, player, ctx))
875 if (action_id ==
EActions.ACTIVATE_ENTITY)
888 debug_output = super.GetDebugText();
890 if(
GetGame().IsDedicatedServer())
896 debug_output+=
"Burning rag \n";
900 debug_output+=
"Burning lard/fuel \n";
948 super.OnWasAttached(parent, slot_id);
956 super.OnWasDetached(parent, slot_id);
964 super.OnStoreSave(ctx);
965 ctx.
Write(m_ConsumeRagFlipFlop);
966 ctx.
Write(m_RagsUpgradedCount);
972 if (!super.OnStoreLoad(ctx, version))
979 if (!ctx.
Read( m_ConsumeRagFlipFlop ))
984 if (!ctx.
Read( m_RagsUpgradedCount ))
989 UpdateCheckForReceivingUpgrade();
998 super.CopyOldPropertiesToNew(old_item, new_item);
1003 if (stick && flammable)
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
override float GetQuantity()
override void AddWet(float value)
override void OnWasAttached(EntityAI parent, int slot_id)
void OnStoreSave(ParamsWriteContext ctx)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
override void OnWasDetached(EntityAI parent, int slot_id)
static float m_BurnTimePerFullLard
static int m_StartFadeOutOfLightAtQuantity
static float m_MaxConsumableFuelQuantity
static float m_BurnTimePerFullFuelDose
static float m_WaterEvaporationByFireIntensity
FlammableBase m_BurnTimePerRag
static float m_MaxConsumableLardQuantity
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
proto float SurfaceGetType(float x, float z, out string type)
Returns: Y position the surface was found.
proto native void ObjectDelete(Object obj)
Super root of all classes in Enforce script.
void ConsumeFuelFromGasStation()
override void OnDebugSpawn()
override bool CanPutInCargo(EntityAI parent)
void ApplyResultModifications(ItemBase result)
bool IsRagDryEnough(ItemBase rag)
override void OnInventoryExit(Man player)
override int GetMeleeMode()
float m_MaxConsumableFuelQuantityEx
void UpdateCheckForReceivingUpgrade()
float m_BurnTimePerFullLardEx
void ConsumeLard(Lard lard)
vector m_ParticleLocalPos
override bool IsIgnited()
override bool CanReleaseAttachment(EntityAI attachment)
bool CanTransformIntoStick()
ref UniversalTemperatureSource m_UTSource
override bool OnStoreLoad(ParamsReadContext ctx, int version)
SoundOnVehicle m_LoopSoundEntity
override void OnIgnitedThis(EntityAI fire_source)
override void SetActions()
void CraftingInit(float quantity)
override void OnWork(float consumed_energy)
override void OnStoreSave(ParamsWriteContext ctx)
override void OnWorkStop()
void TryTransformIntoStick()
bool m_ConsumeRagFlipFlop
override void DeferredInit()
override void EEDelete(EntityAI parent)
void Upgrade(ItemBase source)
override void EEItemDetached(EntityAI item, string slot_name)
void LockRags(bool do_lock)
override bool CanRemoveFromCargo(EntityAI parent)
override void OnSwitchOff()
string GetBurningMaterial()
float m_BurnTimePerFullFuelDoseEx
override bool CanBeIgnitedBy(EntityAI igniter=NULL)
float m_WaterEvaporationByFireIntensityEx
ref UniversalTemperatureSourceLambdaConstant m_UTSLConstant
void SetTorchDecraftResult(string type)
override void OnSwitchOn()
override void OnWorkStart()
override void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
ref UniversalTemperatureSourceSettings m_UTSSettings
override bool DisassembleOnLastDetach()
float m_MaxConsumableLardQuantityEx
override vector GetUniversalTemperatureSourcePosition()
int m_StartFadeOutOfLightAtQuantityEx
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override int GetMeleeSprintMode()
override bool CanIgniteItem(EntityAI ignite_target=NULL)
override int GetMeleeHeavyMode()
override bool CanPutAsAttachment(EntityAI parent)
override void EEItemAttached(EntityAI item, string slot_name)
void ConsumeFuelFromBottle(ItemBase vessel)
override bool HasFlammableMaterial()
override void OnItemInHandsPlayerSwimStart(PlayerBase player)
string GetBurntMaterial()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Legacy way of using particles in the game.
static const int TORCH_T2
static const int TORCH_T1
void ReplaceItemWithNewLambdaBase(EntityAI old_item, string new_item_type)
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
original Timer deletes m_params which is unwanted
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Ceil(float f)
Returns ceil of value.
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition