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 );
313 player.ServerDropEntity(
this );
315 parent.GetInventory().DropEntity(
InventoryMode.SERVER, parent,
this);
334 string shuffled_text;
337 int length_diff =
m_LockDigits - combination_text.Length();
338 for (
int i = 0; i < length_diff; ++i )
340 combination_text =
"0" + combination_text;
344 for (
int j = 0; j < combination_text.Length(); ++j )
346 int dial_number = combination_text.Get( j ).ToInt();
347 dial_number = ( dial_number +
Math.RandomInt( 1, 9 ) ) % 10;
348 shuffled_text = shuffled_text + dial_number.ToString();
366 Fence fence = Fence.Cast( GetHierarchyParent() );
380 Fence fence = Fence.Cast( GetHierarchyParent() );
392 GetGame().ObjectDelete(
this );
441 SetAnimationPhase(
"Combination_Lock_Item", 0 );
442 SetAnimationPhase(
"Lock_Item_1", 0 );
443 SetAnimationPhase(
"Lock_Item_2", 0 );
448 SetAnimationPhase(
"Combination_Lock_Item", 1 );
449 SetAnimationPhase(
"Lock_Item_1", 1 );
450 SetAnimationPhase(
"Lock_Item_2", 1 );
455 SetAnimationPhase(
"Combination_Lock_Attached", 0 );
456 SetAnimationPhase(
"Lock_Attached_1", 0 );
457 SetAnimationPhase(
"Lock_Attached_2", 0 );
462 SetAnimationPhase(
"Combination_Lock_Attached", 1 );
463 SetAnimationPhase(
"Lock_Attached_1", 1 );
464 SetAnimationPhase(
"Lock_Attached_2", 1 );