1#ifdef FEATURE_NETWORK_RECONCILIATION
2class Person
extends Pawn
12#ifdef FEATURE_NETWORK_RECONCILIATION
13class Man
extends Person
130 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveDropEntity input data not sent yet, cannot allow another input action");
175 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityToHands input data not sent yet, cannot allow another input action");
197 if (!
g_Game.IsDedicatedServer() )
208 if (item.GetInventory().GetCurrentInventoryLocation(src_item))
210 if (itemInHands == null)
217 GetInventory().SwapEntities(mode, itemInHands, item);
236 Print(
"[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
248 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
251 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
254 EntityAI oldLocationParent = entityInHands.m_OldLocation.GetParent();
255 if (oldLocationParent && oldLocationParent.GetHierarchyRootPlayer())
261 if (!oldLocEntity && humanInventory.
TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
271 if (humanInventory.
TakeToDst(invMode, invLoc, newLocation))
310 bool code =
GetHumanInventory().ReplaceItemElsewhereWithNewInHands(mode, lambda);
350 bool code =
GetHumanInventory().ReplaceItemInHandsWithNewElsewhere(mode, lambda);
376 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityToInventory input data not sent yet, cannot allow another input action");
415 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityToCargo input data not sent yet, cannot allow another input action");
454 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityAsAttachment input data not sent yet, cannot allow another input action");
493 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityAsAttachmentEx input data not sent yet, cannot allow another input action");
532 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveSwapEntities input data not sent yet, cannot allow another input action");
536 EntityAI item1Parent = item1.GetHierarchyParent();
537 EntityAI item2Parent = item2.GetHierarchyParent();
540 if (need_j1 || need_j2)
561 Error(
"[inv] (Man@" +
this +
") SwapEntitiesImpl - cannot swap items!");
582 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveForceSwapEntities input data not sent yet, cannot allow another input action");
586 EntityAI item1Parent = item1.GetHierarchyParent();
587 EntityAI item2Parent = item2.GetHierarchyParent();
590 if (need_j1 || need_j2)
629 Print(
"[inv] " + GetSimulationTimeStamp() +
" ::PredictiveTakeEntityToTargetInventory input data not sent yet, cannot allow another input action");
641 if( GetInventory().CanAddAttachment( item ) )
651 int slot_id = itemInventory.
GetSlotId(i);
670 bool code = GetInventory().TakeEntityToTargetInventory(mode, target, flags, item);
686 Print(
"[inv] " +
GetDebugName(
this) +
" STS = " + GetSimulationTimeStamp() +
" ::PredictiveTakeEntityToTargetCargoEx input data not sent yet, cannot allow another input action");
709 bool code = GetInventory().TakeEntityToTargetCargoEx(mode, cargo, item, row, col);
725 Print(
"[inv] " +
GetDebugName(
this) +
" STS = " + GetSimulationTimeStamp() +
" ::PredictiveTakeEntityToTargetCargo input data not sent yet, cannot allow another input action");
768 Print(
"[inv] " +
GetDebugName(
this) +
" STS = " + GetSimulationTimeStamp() +
" ::PredictiveTakeEntityToTargetAttachmentEx input data not sent yet, cannot allow another input action");
791 bool code = GetInventory().TakeEntityAsTargetAttachmentEx(mode, target, item, slot);
807 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeEntityToTargetAttachment input data not sent yet, cannot allow another input action");
848 Print(
"[inv] " + GetSimulationTimeStamp() +
" Man@" +
this +
" ::PredictiveTakeToDst input data not sent yet, cannot allow another input action");
885 return !GetIsFrozen();
void syncDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
represents base for cargo storage for entities
override bool DisableVicinityIcon()
proto native void StatInvokeUpdate()
Invokes read stats from server to client.
override bool LocalTakeEntityToCargo(notnull EntityAI item)
CachedEquipmentStorageBase GetCachedEquipment()
override bool PredictiveTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
ScriptInvoker GetOnItemRemovedFromHands()
override bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
void LocalTakeEntityToHands(EntityAI item)
bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
proto native void SetSpeechRestricted(bool state)
Set speech restriction.
bool ReplaceItemElsewhereWithNewInHandsImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand replace -> hand
bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
bool JunctureTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
as att ex juncture
override bool ServerTakeEntityAsAttachment(notnull EntityAI item)
override bool PredictiveTakeEntityToCargo(notnull EntityAI item)
ref ScriptInvoker m_OnItemAddedToHands
bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
proto native float StatGet(string name)
Gets counter value of the specified stat type.
bool JunctureForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
ForceSwap juncture.
bool DropEntityImpl(InventoryMode mode, notnull EntityAI owner, notnull EntityAI item)
proto native UAInterface GetInputInterface()
Returns player's input interface.
override bool ServerTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
proto native EntityAI GetEntityInHands()
Returns the current entity in hands.
void ServerTakeEntityToHands(EntityAI item)
bool JunctureTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
to target att juncture
void OnGameplayDataHandlerSync()
override bool CanDropEntity(notnull EntityAI item)
override bool ServerTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
array< InventoryItem > OnDrawOptics2D()
Called when 2D optics are about to be drawn.
bool ServerReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
bool JunctureDropEntity(notnull EntityAI item)
drop juncture
override bool LocalTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
bool LocalForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
override bool PredictiveDropEntity(notnull EntityAI item)
override bool LocalTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
bool TakeEntityToTargetCargoExImpl(InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
bool ServerReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
proto native void StatUpdateByGivenPos(string name, vector pos)
Updates stat counter by given position.
proto native void SetMasterAttenuation(string masterAttenuation)
void PredictiveTakeEntityToHands(EntityAI item)
proto void StatGetAsTime(string name, out string value)
Gets counter value as formatted time string of the specified stat type.
override bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
bool JunctureTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
to inv juncture
bool JunctureSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
swap juncture
bool TakeEntityToTargetAttachmentExImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
override bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
override bool ServerTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
bool JunctureTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
to target att ex juncture
override bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
proto native void SetFaceTexture(string texture_name)
Texture that is used on the Man's face and hands.
void SetInventorySoftLock(bool status)
void OnItemInHandsChanged()
proto native void StatSyncToClient()
Invokes save stats from server to client.
override bool HasFixedActionTargetCursorPosition()
bool LocalReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
bool ReplaceItemInHandsWithNewElsewhereImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
hand replace2
override bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
ref ScriptInvoker m_OnItemRemovedFromHands
proto native owned string GetMasterAttenuation()
bool ServerForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
override bool LocalTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
override bool PredictiveTakeEntityAsAttachment(notnull EntityAI item)
override bool ServerTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only=true)
override bool LocalDropEntity(notnull EntityAI item)
proto native bool IsSoundInsideBuilding()
override bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
void LocalDestroyEntityInHands()
bool IsInTransport()
returns true if man is in transport, false otherwise
void AddItemToDelete(EntityAI item)
override bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
bool LocalSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
proto native void StatUpdateByPosition(string name)
Updates stat counter by player's actual position.
override bool IsHealthVisible()
void SetProcessUIWarning(bool state)
ref CachedEquipmentStorageBase m_CachedEquipmentStorage
ScriptInvoker GetOnItemAddedToHands()
proto native void StatUpdate(string name, float value)
Updates stat counter with given value.
bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
void EEItemIntoHands(EntityAI item)
proto native owned string GetCurrentWeaponMode()
override bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
proto void StatGetCounter(string name, out string value)
Gets counter value as string of the specified stat type.
bool LocalReplaceItemInHandsWithNew(ReplaceItemWithNewLambdaBase lambda)
bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
bool SwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
override bool ServerTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
bool ReplaceItemWithNewImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand -> !hand replace
override bool ServerTakeEntityToCargo(notnull EntityAI item)
bool JunctureTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
to dst juncture
bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
override bool ServerTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
void PredictiveMoveItemFromHandsToInventory()
ToDo: Old system method. Might should be adjusted to new system at some point.
bool CanPlaceItem(EntityAI item)
proto native bool IsSpeechRestricted()
Check if player has resctricted speech.
bool ReplaceItemInHandsWithNewImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
hand replace
override bool CanBeSkinned()
bool LocalReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
bool PredictiveTakeOrSwapAttachment(notnull EntityAI item)
bool JunctureTakeEntityAsAttachment(notnull EntityAI item)
as att juncture
bool ServerReplaceItemInHandsWithNew(ReplaceItemWithNewLambdaBase lambda)
proto native void StatUpdateByTime(string name)
Updates stat counter by time.
proto native PlayerIdentity GetIdentity()
Returns player's identity.
proto native EntityAI GetDrivingVehicle()
Returns vehicle which this Man object is driving. If this Man object isn't as driver of any vehicle i...
override bool LocalTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
void StopDeathDarkeningEffect()
proto native bool IsCameraInsideVehicle()
override bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
void JunctureDeleteItem(EntityAI item)
proto native bool StatRegister(string name)
Stats Registers new stat type for this player.
proto native void SetFaceMaterial(string material_name)
Material that is used on the Man's face and hands.
bool TakeEntityAsAttachmentExImpl(InventoryMode mode, notnull EntityAI item, int slot)
override bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
bool ServerSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
void UpdateInventoryMenu()
bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
bool LocalReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
proto native HumanInventory GetHumanInventory()
inventory Returns player's inventory
bool IsUnconsciousStateOnly()
uncon command might be still in progress but state already changed (for simple checks only - eg....
bool JunctureTakeEntityToCargo(notnull EntityAI item)
to cgo juncture
bool JunctureTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
to target inv juncture
override bool LocalTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
bool IsInventorySoftLocked()
bool ServerReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
override bool LocalTakeEntityAsAttachment(notnull EntityAI item)
override bool LocalTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
void EEItemOutOfHands(EntityAI item)
bool JunctureTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
to target cgo juncture
void JunctureTakeEntityToHands(notnull EntityAI item)
hand juncture
bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
bool JunctureTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
to target cgo ex juncture
bool ForceSwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
override bool ServerDropEntity(notnull EntityAI item)
script counterpart to engine's class Inventory
static proto native bool ClearInventoryReservation(EntityAI item, InventoryLocation dst)
proto native int GetSlotIdCount()
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto native int GetSlotId(int index)
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)...
static proto native EntityAI LocationGetEntity(notnull InventoryLocation inv_loc)
inventory for plain man/human
override bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
proto native int GetSlot()
returns slot id if current type is Attachment
proto native void SetHands(notnull EntityAI parent, EntityAI e)
static string DumpToStringNullSafe(InventoryLocation loc)
static bool IsSyncLogEnable()
The class that will be instanced (moddable).
base class for transformation operations (creating one item from another)
ScriptInvoker Class provide list of callbacks usage:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
proto native void SetFlags(ShapeFlags flags)
FindInventoryLocationType
flags for searching locations in inventory