DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CheckCodeRequest()

void CheckCodeRequest ( string pin,
PlayerIdentity identity )
protected

См. определение в файле CodeLockComponent.c строка 350

351 {
352 bool success;
353
354 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
355 {
356 if (!SetInputCode(pin))
357 return;
358
359 if (m_HasPIN)
360 {
361 // Check lock state and see if pin is valid
362 if (m_IsLocked)
363 {
364 #ifdef CODELOCKCOMPONENT_LOG
365 ErrorEx("Lock pin=" + GetInputPIN(), ErrorExSeverity.INFO);
366 ErrorEx("Actual pin=" + GetLockPIN(), ErrorExSeverity.INFO);
367 #endif
368
369 if (m_InputPIN == m_LockPIN)
370 {
371 // Lock is locked and given pin is same as lock pin. Unlock lock
372 // SetLockState will handle clearing brute force protection
373 SetLockState(false, false);
374 success = true;
375 }
376 else
377 {
378 // Handle brute force protection
379 ItemBase parentIB = ItemBase.Cast(m_Parent);
380 if (parentIB)
381 parentIB.StartItemSoundServer(SoundConstants.ITEM_DIGITAL_LOCK_ERROR);
383 success = false;
384 }
385 }
386 }
387 else
388 {
389 // Lock has no pin. Set pin!
390 SetLockCode(pin, false);
391 success = true;
392 }
393 }
394
395 if (g_Game.IsDedicatedServer())
396 {
397 m_Parent.SetSynchDirty();
398 }
399
400 // Force visual update after setting code
401 DigitalCodeLock codeLock;
402 if (Class.CastTo(codeLock, m_Parent) && codeLock.GetVisualManager())
403 {
404 codeLock.GetVisualManager().UpdateVisuals();
405 }
406
407 Param1<bool> response = new Param1<bool>(success);
408 GetGame().RPCSingleParam(m_Parent, ERPCs.RPC_CODE_LOCK_RESPONSE, response, true, identity);
409 }
Entity m_Parent
Определения CachedEquipmentStorageBase.c:17
string GetLockPIN()
Определения CodeLockComponent.c:653
bool SetInputCode(string pin, bool force=true)
Определения CodeLockComponent.c:94
bool m_IsLocked
Определения CodeLockComponent.c:34
bool SetLockCode(string pin, bool sync=true)
Определения CodeLockComponent.c:121
void HandleBruteForceProtectionServer()
Определения CodeLockComponent.c:411
string m_LockPIN
Определения CodeLockComponent.c:32
string m_InputPIN
Определения CodeLockComponent.c:31
bool m_HasPIN
Определения CodeLockComponent.c:38
void SetLockState(bool state, bool sync=true)
Определения CodeLockComponent.c:157
string GetInputPIN()
Определения CodeLockComponent.c:643
DayZGame g_Game
Определения DayZGame.c:4074
ERPCs
Определения ERPCs.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
CodeLockVisualManager GetVisualManager()
Определения CodeLock.c:435
Определения CodeLock.c:2
DayZGame GetGame()
Определения gameplay.c:636
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo(), ErrorEx, g_Game, GetGame(), GetInputPIN(), GetLockPIN(), DigitalCodeLock::GetVisualManager(), HandleBruteForceProtectionServer(), m_HasPIN, m_InputPIN, m_IsLocked, m_LockPIN, m_Parent, SetInputCode(), SetLockCode() и SetLockState().

Используется в OnRPC().