39 RegisterNetSyncVariableBool(
"m_IsLocked" );
40 RegisterNetSyncVariableInt(
"m_Combination", 0, combination_length - 1 );
41 RegisterNetSyncVariableInt(
"m_DialIndex", 0,
m_LockDigits - 1 );
42 RegisterNetSyncVariableInt(
"m_LockActionPerformed", 0,
LockAction.COUNT );
45 protected void SetBaseLockValues()
77 super.OnItemLocationChanged( old_owner, new_owner );
92 super.OnStoreSave( ctx );
101 if ( !super.OnStoreLoad( ctx, version ) )
122 bool is_lock_attached;
123 if ( !ctx.Read( is_lock_attached ) )
134 super.AfterStoreLoad();
139 EntityAI parent = GetHierarchyParent();
170 super.OnVariablesSynchronized();
208 int length_diff =
m_LockDigits - combination_text.Length();
209 for (
int i = 0; i < length_diff; ++i )
211 combination_text =
"0" + combination_text;
215 for (
int j = 0; j < combination_text.Length(); ++j )
219 int next_dialed_number = combination_text.Get( j ).ToInt() + 1;
220 if ( next_dialed_number > 9 )
222 next_dialed_number = 0;
225 dialed_text += next_dialed_number.ToString();
229 dialed_text += combination_text.Get( j );
277 if ( !ignore_combination )
283 GetInventory().GetCurrentInventoryLocation( inventory_location );
284 parent.GetInventory().SetSlotLock( inventory_location.GetSlot(),
true );
304 Fence fence = Fence.Cast( parent );
308 GetInventory().GetCurrentInventoryLocation( inventory_location );
309 fence.GetInventory().SetSlotLock( inventory_location.GetSlot(),
false );
317 parent.GetInventory().DropEntity(
InventoryMode.SERVER, parent,
this);
324 parent.GetInventory().DropEntity(
InventoryMode.LOCAL, parent,
this);
345 string shuffled_text;
348 int length_diff =
m_LockDigits - combination_text.Length();
349 for (
int i = 0; i < length_diff; ++i )
351 combination_text =
"0" + combination_text;
355 for (
int j = 0; j < combination_text.Length(); ++j )
357 int dial_number = combination_text.Get( j ).ToInt();
358 dial_number = ( dial_number +
Math.RandomInt( 1, 9 ) ) % 10;
359 shuffled_text = shuffled_text + dial_number.ToString();
377 Fence fence = Fence.Cast( GetHierarchyParent() );
391 Fence fence = Fence.Cast( GetHierarchyParent() );
403 GetGame().ObjectDelete(
this );
452 SetAnimationPhase(
"Combination_Lock_Item", 0 );
453 SetAnimationPhase(
"Lock_Item_1", 0 );
454 SetAnimationPhase(
"Lock_Item_2", 0 );
459 SetAnimationPhase(
"Combination_Lock_Item", 1 );
460 SetAnimationPhase(
"Lock_Item_1", 1 );
461 SetAnimationPhase(
"Lock_Item_2", 1 );
466 SetAnimationPhase(
"Combination_Lock_Attached", 0 );
467 SetAnimationPhase(
"Lock_Attached_1", 0 );
468 SetAnimationPhase(
"Lock_Attached_2", 0 );
473 SetAnimationPhase(
"Combination_Lock_Attached", 1 );
474 SetAnimationPhase(
"Lock_Attached_1", 1 );
475 SetAnimationPhase(
"Lock_Attached_2", 1 );
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ActionDialCombinationLockCB ActionContinuousBaseCB ActionDialCombinationLock()
ActionDialCombinationLockOnTargetCB ActionContinuousBaseCB ActionDialCombinationLockOnTarget()
void AddAction(typename actionName)
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
Wrapper class for managing sound through SEffectManager.
override bool ServerDropEntity(notnull EntityAI item)
override bool LocalDropEntity(notnull EntityAI item)
Serialization general interface. Serializer API works with:
override bool IsInitialized()
const string SOUND_LOCK_CHANGE_NUMBER
const string SOUND_LOCK_CHANGE_DIAL
void LockServer(EntityAI parent, bool ignore_combination=false)
void SoundLockChangeNumber()
const string SOUND_LOCK_OPEN
enum LockAction m_LockDigits
void CheckLockedStateServer()
void SetCombination(int combination)
void SetCombinationLocked(int combination)
void SoundLockChangeDial()
const string SOUND_LOCK_CLOSE
void UnlockServer(EntityAI player, EntityAI parent)
LockAction m_LockActionPerformed
ContaminatedArea_Base EffectArea EEInit()
override void OnVariablesSynchronized()
proto native CGame GetGame()
proto native void SetPosition(vector position)
Set the world position of the Effect.
override void SetTakeable(bool pState)
void OnStoreSave(ParamsWriteContext ctx)
bool OnStoreLoad(ParamsReadContext ctx, int version)