61 RegisterNetSyncVariableBool(
"m_IsLocked");
62 RegisterNetSyncVariableInt(
"m_Combination", 0, combinationLength - 1);
63 RegisterNetSyncVariableInt(
"m_CombinationInside", 0, combinationLength - 1);
64 RegisterNetSyncVariableInt(
"m_DialIndex", 0,
m_LockDigits - 1);
65 RegisterNetSyncVariableInt(
"m_DialIndexInside", 0,
m_LockDigits - 1);
66 RegisterNetSyncVariableInt(
"m_LockActionPerformed", 0,
LockAction.COUNT);
67 RegisterNetSyncVariableInt(
"m_LockDigitsCount", 0, combinationLength - 1);
103 super.EEItemLocationChanged(oldLoc, newLoc);
107 EntityAI oldParent = oldLoc.GetParent();
108 if (oldParent && oldParent.CanUseConstruction() && oldLoc.GetType() ==
InventoryLocationType.ATTACHMENT)
115 super.OnItemLocationChanged(old_owner, new_owner);
120 if (
IsInitialized() && new_owner && new_owner.CanUseConstruction())
130 super.OnStoreSave(ctx);
140 if (!super.OnStoreLoad(ctx, version))
163 if (!ctx.
Read(isLockAttached))
184 super.AfterStoreLoad();
191 EntityAI parent = GetHierarchyParent();
192 if (parent && (parent.IsInherited(
BaseBuildingBase) || parent.CanUseConstruction()))
226 super.OnVariablesSynchronized();
238 if (!GetInventory().IsAttachment() && setOtherSide)
247 if (!GetInventory().IsAttachment() && setOtherSide)
277 string combinationText;
291 for (
int i = 0; i < lengthDiff; ++i)
293 combinationText =
"0" + combinationText;
296 for (
int j = 0; j < combinationText.
Length(); ++j)
300 int nextDialedNumber = combinationText.
Get(j).
ToInt() + 1;
301 if (nextDialedNumber > 9)
303 nextDialedNumber = 0;
306 dialedText += nextDialedNumber.
ToString();
310 dialedText += combinationText.
Get(j);
389 if (!ignore_combination)
395 GetInventory().GetCurrentInventoryLocation(inventoryLocation);
396 parent.GetInventory().SetSlotLock(inventoryLocation.
GetSlot(),
true);
416 GetInventory().GetCurrentInventoryLocation(inventoryLocation);
417 parent.GetInventory().SetSlotLock(inventoryLocation.
GetSlot(),
false);
420 if (
g_Game.IsMultiplayer())
422 parent.GetInventory().DropEntity(
InventoryMode.SERVER, parent,
this);
426 parent.GetInventory().DropEntity(
InventoryMode.LOCAL, parent,
this);
432 groundPos = player.GetPosition();
437 if (parent.MemoryPointExists(
slotName))
439 groundPos = parent.ModelToWorld(parent.GetMemoryPointPos(
slotName));
483 for (
int i = 0; i < lengthDiff; ++i)
485 combinationText =
"0" + combinationText;
489 for (
int j = 0; j < combinationText.
Length(); ++j)
491 int dialNumber = combinationText.
Get(j).
ToInt();
493 shuffledText = shuffledText + dialNumber.
ToString();
525 EntityAI parent = GetHierarchyParent();
526 if (parent && parent.CanUseConstruction() &&
IsLocked())
536 EntityAI parent = GetHierarchyParent();
537 if (parent && parent.CanUseConstruction())
548 g_Game.ObjectDelete(
this );
572 string combinationText;
577 else if (changedInside)
584 for (
int i = 0; i < lengthDiff; ++i)
586 combinationText =
"0" + combinationText;
590 for (
int j = 0; j < combinationText.
Length(); ++j)
594 int nextDialedNumber = combinationText.
Get(j).
ToInt() + 1;
595 if (nextDialedNumber > 9)
597 nextDialedNumber = 0;
604 else if (changedInside)
611 if (!changedOutside && !changedInside && !chanedOutside && !chanedInside)
651 SetAnimationPhase(
"Combination_Lock_Item", 0 );
652 SetAnimationPhase(
"Lock_Item_1", 0 );
653 SetAnimationPhase(
"Lock_Item_2", 0 );
658 SetAnimationPhase(
"Combination_Lock_Item", 1 );
659 SetAnimationPhase(
"Lock_Item_1", 1 );
660 SetAnimationPhase(
"Lock_Item_2", 1 );
665 SetAnimationPhase(
"Combination_Lock_Attached", 0 );
666 SetAnimationPhase(
"Lock_Attached_1", 0 );
667 SetAnimationPhase(
"Lock_Attached_2", 0 );
672 SetAnimationPhase(
"Combination_Lock_Attached", 1 );
673 SetAnimationPhase(
"Lock_Attached_1", 1 );
674 SetAnimationPhase(
"Lock_Attached_2", 1 );
720 SetAnimationPhase(
"Lock_Attached_2_Digit" + digitIndex, rot);
721 SetAnimationPhase(
"Lock_Item_2_Digit" + digitIndex, rot);
726 SetAnimationPhase(
"Lock_Attached_1_Digit" + digitIndex, rot);
727 SetAnimationPhase(
"Lock_Item_1_Digit" + digitIndex, rot);
732 float animPhaseOffset = 0.1;
733 float animPhase = GetAnimationPhase(
"Lock_Attached_2_Digit" + digitIndex);
735 if (animPhase >= 1.0)
738 ResetAnimationPhase(
"Lock_Attached_2_Digit" + digitIndex, animPhase);
739 ResetAnimationPhase(
"Lock_Item_2_Digit" + digitIndex, animPhase);
742 SetAnimationPhase(
"Lock_Attached_2_Digit" + digitIndex, animPhase + animPhaseOffset);
743 SetAnimationPhase(
"Lock_Item_2_Digit" + digitIndex, animPhase + animPhaseOffset);
748 float animPhaseOffset = 0.1;
749 float animPhase = GetAnimationPhase(
"Lock_Attached_1_Digit" + digitIndex);
751 if (animPhase >= 1.0)
754 ResetAnimationPhase(
"Lock_Attached_1_Digit" + digitIndex, animPhase);
755 ResetAnimationPhase(
"Lock_Item_1_Digit" + digitIndex, animPhase);
758 SetAnimationPhase(
"Lock_Attached_1_Digit" + digitIndex, animPhase + animPhaseOffset);
759 SetAnimationPhase(
"Lock_Item_1_Digit" + digitIndex, animPhase + animPhaseOffset);
766 for (
int i = 0; i < combinationText.
Length(); ++i)
773 for (
int j = 0; j < combinationText.
Length(); ++j)
787 GetActionComponentNameList(componentIndex, selections);
790 foreach (
string selectionName : selections)
810 super.InitItemSounds();
813 handler.AddSound(SoundConstants.ITEM_COMBINATION_LOCK_LOCK,
SOUND_LOCK_CLOSE);
814 handler.AddSound(SoundConstants.ITEM_COMBINATION_LOCK_UNLOCK,
SOUND_LOCK_OPEN);
822 [
Obsolete(
"1.30: Use ItemSoundHandler instead")]
828 [
Obsolete(
"1.30: Use ItemSoundHandler instead")]
834 [
Obsolete(
"1.30: Use ItemSoundHandler instead")]
840 [
Obsolete(
"1.30: Use ItemSoundHandler instead")]
846 [
Obsolete(
"1.30: Use IsLocked instead")]
849 Fence fence = Fence.Cast(GetHierarchyParent());
861 [
Obsolete(
"1.30: Use UnlockOnServer instead")]
863 [
Obsolete(
"1.30: Use SetDigitRotationAnimationPhaseOutside & SetDigitRotationAnimationPhaseInside instead")]
865 [
Obsolete(
"1.30: Use AnimateDigitsOutside & AnimateDigitsInside instead")]
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
override void InitItemSounds()
void OnItemLocationChanged(ItemBase item)
ActionDialCombinationLockCB ActionContinuousBaseCB ActionDialCombinationLock()
ActionDialCombinationLockOnTargetCB ActionContinuousBaseCB ActionDialCombinationLockOnTarget()
void AddAction(typename actionName)
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
PlayerSpawnPreset slotName
void UnlockOnServer(EntityAI parent)
Unlock AND drop.
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
void AnimateDigitsInside(string digitIndex)
void SetNextDial(int lockSide=FACING_OUTSIDE)
override bool IsInitialized()
const float DIGIT_ROTATION_POSITION_9
const float DIGIT_ROTATION_POSITION_5
const string SOUND_LOCK_CHANGE_NUMBER
const string SOUND_LOCK_CHANGE_DIAL
enum LockAction LOCK_SELECTION_OUTSIDE
void SoundLockOpen()
DEPRECTAED.
void SetCombination(int combination, bool setOtherSide=true)
void LockServer(EntityAI parent, bool ignore_combination=false)
static const int FACING_INSIDE
void SoundLockChangeNumber()
void AnimateDigits(string digitIndex)
const float DIGIT_ROTATION_POSITION_2
const float DIGIT_ROTATION_POSITION_7
const float DIGIT_ROTATION_POSITION_4
const string SOUND_LOCK_OPEN
void CheckLockedStateServer(bool insideLock=false)
void SetCombinationInside(int combination, bool setOtherSide=true)
int GetLockSideByComponentIndex(int componentIndex)
static float GetDigitRotation(int digitValue)
int GetCombinationInside()
const float DIGIT_ROTATION_POSITION_1
const float DIGIT_ROTATION_POSITION_3
static const int FACING_OUTSIDE
void SetCombinationLocked(int combination)
@ DIAL_INDEX_CHANGED_OUTSIDE
@ DIAL_NUMBER_CHANED_OUTSIDE
@ DIAL_INDEX_CHANGED_INSIDE
@ DIAL_NUMBER_CHANED_INSIDE
void SetDigitRotationAnimationPhase(string digitIndex, float rot)
void SetDigitRotationAnimationPhaseOutside(string digitIndex, float rot)
void SoundLockChangeDial()
void DialNextNumber(int lockSide=FACING_OUTSIDE)
void AnimateDigitsOutside(string digitIndex)
const float DIGIT_ROTATION_POSITION_0
const string SOUND_LOCK_CLOSE
static const string LOCK_SELECTION_INSIDE
void SetDigitRotationAnimationPhaseInside(string digitIndex, float rot)
const float DIGIT_ROTATION_POSITION_6
LockAction m_LockActionPerformed
void ShuffleCombination(string combinationText, bool isInsideLock=false)
const float DIGIT_ROTATION_POSITION_8
const string SOUND_LOCK_WRONG_PIN
ContaminatedArea_Base EffectArea EEInit()
override void OnVariablesSynchronized()
InventoryLocationType
types of Inventory Location
bool IsExternalLockType()
ItemSoundHandler GetItemSoundHandler()
override void SetTakeable(bool pState)
void StartItemSoundServer(int id, int slotId)
void ItemSoundHandler(ItemBase parent)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void SetBaseLockValues()
Wrapper class for managing sound through SEffectManager.
proto native int GetSlot()
returns slot id if current type is Attachment
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Keffiyeh_LightBlue SetActions
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto native void SetPosition(vector position)
Set the world position of the Effect.
void Obsolete(string msg="")
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
@ NONE
body is not in simulation, nor in collision world
vector GetPosition()
Get the world position of the Effect.
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto native int ToInt()
Converts string to integer.