474 lines
21 KiB
C#
474 lines
21 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using Audio;
|
|
using Platform;
|
|
using UnityEngine;
|
|
|
|
public class BlockTakeSecureLootSignedContainer : BlockSecureLootSigned
|
|
{
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
this.CanPickup = true;
|
|
if (this.Properties.Values.ContainsKey("ReplacementBlockName"))
|
|
{
|
|
this.ReplacementBlockName = this.Properties.Values["ReplacementBlockName"];
|
|
}
|
|
|
|
bool flag1 = this.Properties.Values.ContainsKey("isReplacementItem");
|
|
if (flag1)
|
|
{
|
|
StringParsers.TryParseBool(this.Properties.Values["isReplacementItem"], out this.isReplacementItem, 0, -1, true);
|
|
}
|
|
bool flag2 = this.Properties.Values.ContainsKey("numBlocks");
|
|
if (flag2)
|
|
{
|
|
this.numBlocks = Int16.Parse(this.Properties.Values["numBlocks"]);
|
|
}
|
|
bool flag3 = this.Properties.Values.ContainsKey("isSecure");
|
|
if (flag3)
|
|
{
|
|
StringParsers.TryParseBool(this.Properties.Values["isSecure"], out this.isSecure, 0, -1, true);
|
|
}
|
|
bool flag4 = this.Properties.Values.ContainsKey("TakeDelay");
|
|
if (flag4)
|
|
{
|
|
this.TakeDelay = StringParsers.ParseFloat(this.Properties.Values["TakeDelay"], 0, -1, NumberStyles.Any);
|
|
}
|
|
bool flag5 = this.Properties.Values.ContainsKey("canPickUpBlock");
|
|
if (flag5)
|
|
{
|
|
StringParsers.TryParseBool(this.Properties.Values["canPickUpBlock"], out this.canPickUpBlock, 0, -1, true);
|
|
}
|
|
}
|
|
|
|
public override bool OnBlockActivated(string _commandName, WorldBase _world, int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityPlayerLocal _player)
|
|
{
|
|
if (_blockValue.ischild)
|
|
{
|
|
Vector3i parentPos = _blockValue.Block.multiBlockPos.GetParentPos(_blockPos, _blockValue);
|
|
BlockValue block = _world.GetBlock(parentPos);
|
|
return this.OnBlockActivated(_commandName, _world, _cIdx, parentPos, block, _player);
|
|
}
|
|
TileEntitySecureLootContainerSigned tileEntitySecureLootContainer = _world.GetTileEntity(_cIdx, _blockPos) as TileEntitySecureLootContainerSigned;
|
|
if (tileEntitySecureLootContainer == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("BlockTakeLootContainer:isSecure: " + this.isSecure);
|
|
//Log.Out("BlockTakeLootContainer:OnBlockActivated: " + _indexInBlockActivationCommands);
|
|
if (this.isSecure)
|
|
{
|
|
//Log.Out("BlockTakeLootContainer:isSecure: True");
|
|
PlatformUserIdentifierAbs getContainerOwner = tileEntitySecureLootContainer.GetOwner();
|
|
bool isUserAllowed = tileEntitySecureLootContainer.IsUserAllowed(PlatformManager.InternalLocalUserIdentifier);
|
|
//Log.Out("OnBlockActivated:_indexInBlockActivationCommands: " + _indexInBlockActivationCommands);
|
|
if (_commandName == this.cmds[0].text)
|
|
{
|
|
//Log.Out("OnBlockActivated:Secure/Search");
|
|
if (!tileEntitySecureLootContainer.IsLocked() || isUserAllowed)
|
|
{
|
|
return this.OnBlockActivated(_world, _cIdx, _blockPos, _blockValue, _player);
|
|
}
|
|
Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locked");
|
|
return false;
|
|
}
|
|
else if (_commandName == this.cmds[1].text)
|
|
{
|
|
tileEntitySecureLootContainer.SetLocked(true);
|
|
Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locking");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, "containerLocked");
|
|
return true;
|
|
}
|
|
else if (_commandName == this.cmds[2].text)
|
|
{
|
|
//Log.Out("OnBlockActivated:Unlock I am owner");
|
|
tileEntitySecureLootContainer.SetLocked(false);
|
|
Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/unlocking");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, "containerUnlocked");
|
|
return true;
|
|
}
|
|
else if (_commandName == this.cmds[3].text)
|
|
{
|
|
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(_player as EntityPlayerLocal);
|
|
if (uiforPlayer != null)
|
|
{
|
|
XUiC_KeypadWindow.Open(uiforPlayer, tileEntitySecureLootContainer);
|
|
}
|
|
return true;
|
|
}
|
|
else if (_commandName == this.cmds[4].text)
|
|
{
|
|
if (getContainerOwner == null)
|
|
{
|
|
//Log.Out("OnBlockActivated:Pick no owner");
|
|
LocalPlayerUI playerUI = (_player as EntityPlayerLocal).PlayerUI;
|
|
ItemValue item = ItemClass.GetItem(this.lockPickItem, false);
|
|
if (playerUI.xui.PlayerInventory.GetItemCount(item) == 0)
|
|
{
|
|
playerUI.xui.CollectedItemList.AddItemStack(new ItemStack(item, 0), true);
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttLockpickMissing"));
|
|
return true;
|
|
}
|
|
|
|
bool advancedLockPicking = CustomGameOptions.GetBool("CustomLockPick");
|
|
if (!advancedLockPicking)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// If they have a controller, skip the mini game
|
|
if (PlatformManager.NativePlatform.Input.CurrentInputStyle == PlayerInputManager.InputStyle.Keyboard)
|
|
{
|
|
//Log.Out("OnBlockActivated: Using a controller");
|
|
advancedLockPicking = true;
|
|
}
|
|
|
|
if (_player.Buffs.HasCustomVar("LegacyLockPick") && _player.Buffs.GetCustomVar("LegacyLockPick") > 0)
|
|
{
|
|
//Log.Out("OnBlockActivated: LegacyLockPick CVar is set");
|
|
advancedLockPicking = true;
|
|
}
|
|
|
|
//Log.Out("OnBlockActivated, advancedLockPicking: " + advancedLockPicking);
|
|
if (advancedLockPicking)
|
|
{
|
|
//Log.Out("OnBlockActivated, advancedLockPicking 1");
|
|
XUiC_PickLocking.Open(playerUI, tileEntitySecureLootContainer, _blockValue, _blockPos);
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("OnBlockActivated, advancedLockPicking 2");
|
|
playerUI.windowManager.Open("timer", true, false, true);
|
|
XUiC_Timer childByType = playerUI.xui.GetChildByType<XUiC_Timer>();
|
|
TimerEventData timerEventData = new TimerEventData();
|
|
timerEventData.CloseEvent += this.EventData_CloseEvent;
|
|
float alternateTime = -1f;
|
|
if (_player.rand.RandomRange(1f) < EffectManager.GetValue(PassiveEffects.LockPickBreakChance, _player.inventory.holdingItemItemValue, this.lockPickBreakChance, _player, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1))
|
|
{
|
|
float value = EffectManager.GetValue(PassiveEffects.LockPickTime, _player.inventory.holdingItemItemValue, this.lockPickTime, _player, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
|
|
float num = value - ((tileEntitySecureLootContainer.PickTimeLeft == -1f) ? (value - 1f) : (tileEntitySecureLootContainer.PickTimeLeft + 1f));
|
|
alternateTime = _player.rand.RandomRange(num + 1f, value - 1f);
|
|
}
|
|
timerEventData.Data = new object[]
|
|
{
|
|
_cIdx,
|
|
_blockValue,
|
|
_blockPos,
|
|
_player,
|
|
item
|
|
};
|
|
timerEventData.Event += this.EventData_Event;
|
|
timerEventData.alternateTime = alternateTime;
|
|
timerEventData.AlternateEvent += this.EventData_CloseEvent;
|
|
childByType.SetTimer(EffectManager.GetValue(PassiveEffects.LockPickTime, _player.inventory.holdingItemItemValue, this.lockPickTime, _player, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1), timerEventData, tileEntitySecureLootContainer.PickTimeLeft, "");
|
|
Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/unlocking");
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("OnBlockActivated:Pick has owner");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttNotBelongsToSomeone"), string.Empty, "ui_denied", null);
|
|
return false;
|
|
}
|
|
}
|
|
else if (_commandName == this.cmds[5].text)
|
|
{
|
|
if (GameManager.Instance.IsEditMode() || !tileEntitySecureLootContainer.IsLocked() || tileEntitySecureLootContainer.IsUserAllowed(PlatformManager.InternalLocalUserIdentifier))
|
|
{
|
|
return this.OnBlockActivated(_world, _cIdx, _blockPos, _blockValue, _player, "sign");
|
|
}
|
|
Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locked");
|
|
return false;
|
|
}
|
|
else if (_commandName == this.cmds[6].text)
|
|
{
|
|
bool result;
|
|
//Log.Out("OnBlockActivated:Take before GetOwner");
|
|
//Log.Out("OnBlockActivated:Take after GetOwner");
|
|
if (getContainerOwner == null)
|
|
{
|
|
if (((World)_world).IsWithinTraderArea(_blockPos))
|
|
{
|
|
Manager.PlayInsidePlayerHead("ui_denied");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttBelongsToTrader"), string.Empty, "ui_denied", null);
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("OnBlockActivated:Take has no owner");
|
|
RebirthUtilities.TakeItemWithTimer(_world, _cIdx, _blockPos, _blockValue, _player, this.TakeDelay, null, ReplacementBlockName, numBlocks, isReplacementItem);
|
|
result = true;
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("OnBlockActivated:Take has owner");
|
|
bool isOwner = tileEntitySecureLootContainer.IsOwner(PlatformManager.InternalLocalUserIdentifier);
|
|
bool hasLandClaim = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);
|
|
if (!isOwner && !hasLandClaim)
|
|
{
|
|
//Log.Out("OnBlockActivated:Take am not owner");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttNotBelongsToYou"), string.Empty, "ui_denied", null);
|
|
result = false;
|
|
}
|
|
else
|
|
{
|
|
if (((World)_world).IsWithinTraderArea(_blockPos))
|
|
{
|
|
Manager.PlayInsidePlayerHead("ui_denied");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttBelongsToTrader"), string.Empty, "ui_denied", null);
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("OnBlockActivated:Take am owner");
|
|
RebirthUtilities.TakeItemWithTimer(_world, _cIdx, _blockPos, _blockValue, _player, this.TakeDelay, null, ReplacementBlockName, numBlocks, isReplacementItem);
|
|
result = true;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("BlockTakeLootContainer:isSecure: False");
|
|
if (_commandName == this.cmds[0].text)
|
|
{
|
|
//Log.Out("BlockTakeLootContainer:OnBlockActivated-_commandName == this.cmds[0].text");
|
|
//Log.Out("OnBlockActivated:Insecure/Search");
|
|
if (_player.inventory.IsHoldingItemActionRunning())
|
|
{
|
|
return false;
|
|
}
|
|
_player.AimingGun = false;
|
|
Vector3i blockPos = tileEntitySecureLootContainer.ToWorldPos();
|
|
tileEntitySecureLootContainer.bWasTouched = tileEntitySecureLootContainer.bTouched;
|
|
//Log.Out("OnBlockActivated:Insecure/Search, Before Lock");
|
|
_world.GetGameManager().TELockServer(_cIdx, blockPos, tileEntitySecureLootContainer.entityId, _player.entityId, null);
|
|
//Log.Out("OnBlockActivated:Insecure/Search, After Lock");
|
|
return true;
|
|
}
|
|
else if (_commandName == this.cmds[6].text)
|
|
{
|
|
bool result;
|
|
//Log.Out("OnBlockActivated:Take before GetOwner");
|
|
PlatformUserIdentifierAbs getContainerOwner = tileEntitySecureLootContainer.GetOwner();
|
|
//Log.Out("OnBlockActivated:Take after GetOwner");
|
|
if (getContainerOwner == null)
|
|
{
|
|
if (((World)_world).IsWithinTraderArea(_blockPos))
|
|
{
|
|
Manager.PlayInsidePlayerHead("ui_denied");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttBelongsToTrader"), string.Empty, "ui_denied", null);
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("OnBlockActivated:Take has no owner");
|
|
RebirthUtilities.TakeItemWithTimer(_world, _cIdx, _blockPos, _blockValue, _player, this.TakeDelay, null, ReplacementBlockName, numBlocks, isReplacementItem);
|
|
result = true;
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("OnBlockActivated:Take has owner");
|
|
bool isOwner = tileEntitySecureLootContainer.IsOwner(PlatformManager.InternalLocalUserIdentifier);
|
|
bool hasLandClaim = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);
|
|
if (!isOwner && !hasLandClaim)
|
|
{
|
|
//Log.Out("OnBlockActivated:Take am not owner");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttNotBelongsToYou"), string.Empty, "ui_denied", null);
|
|
result = false;
|
|
}
|
|
else
|
|
{
|
|
if (((World)_world).IsWithinTraderArea(_blockPos))
|
|
{
|
|
Manager.PlayInsidePlayerHead("ui_denied");
|
|
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttBelongsToTrader"), string.Empty, "ui_denied", null);
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("OnBlockActivated:Take am owner");
|
|
RebirthUtilities.TakeItemWithTimer(_world, _cIdx, _blockPos, _blockValue, _player, this.TakeDelay, null, ReplacementBlockName, numBlocks, isReplacementItem);
|
|
result = true;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void EventData_CloseEvent(TimerEventData timerData)
|
|
{
|
|
object[] array = (object[])timerData.Data;
|
|
Vector3i blockPos = (Vector3i)array[2];
|
|
EntityPlayerLocal entityPlayerLocal = array[3] as EntityPlayerLocal;
|
|
ItemValue itemValue = array[4] as ItemValue;
|
|
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal);
|
|
Manager.BroadcastPlayByLocalPlayer(blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locked");
|
|
ItemStack itemStack = new ItemStack(itemValue, 1);
|
|
uiforPlayer.xui.PlayerInventory.RemoveItem(itemStack);
|
|
GameManager.ShowTooltip(entityPlayerLocal, Localization.Get("ttLockpickBroken"));
|
|
uiforPlayer.xui.CollectedItemList.RemoveItemStack(itemStack);
|
|
TileEntitySecureLootContainerSigned tileEntitySecureLootContainerSigned = GameManager.Instance.World.GetTileEntity((int)array[0], blockPos) as TileEntitySecureLootContainerSigned;
|
|
if (tileEntitySecureLootContainerSigned == null)
|
|
{
|
|
return;
|
|
}
|
|
tileEntitySecureLootContainerSigned.PickTimeLeft = Mathf.Max(this.lockPickTime * 0.25f, timerData.timeLeft);
|
|
this.ResetEventData(timerData);
|
|
}
|
|
|
|
private void EventData_Event(TimerEventData timerData)
|
|
{
|
|
World world = GameManager.Instance.World;
|
|
object[] array = (object[])timerData.Data;
|
|
int clrIdx = (int)array[0];
|
|
BlockValue blockValue = (BlockValue)array[1];
|
|
Vector3i vector3i = (Vector3i)array[2];
|
|
BlockValue block = world.GetBlock(vector3i);
|
|
EntityPlayerLocal player = array[3] as EntityPlayerLocal;
|
|
object obj = array[4];
|
|
TileEntitySecureLootContainerSigned tileEntitySecureLootContainerSigned = world.GetTileEntity(clrIdx, vector3i) as TileEntitySecureLootContainerSigned;
|
|
if (tileEntitySecureLootContainerSigned == null)
|
|
{
|
|
return;
|
|
}
|
|
if (tileEntitySecureLootContainerSigned.IsUserAccessing())
|
|
{
|
|
GameManager.ShowTooltip(player, Localization.Get("ttCantPickupInUse"), string.Empty, "ui_denied", null);
|
|
return;
|
|
}
|
|
if (!this.DowngradeBlock.isair)
|
|
{
|
|
BlockValue blockValue2 = this.DowngradeBlock;
|
|
blockValue2 = BlockPlaceholderMap.Instance.Replace(blockValue2, world.GetGameRandom(), vector3i.x, vector3i.z);
|
|
blockValue2.rotation = block.rotation;
|
|
blockValue2.meta = block.meta;
|
|
world.SetBlockRPC(clrIdx, vector3i, blockValue2, blockValue2.Block.Density);
|
|
}
|
|
Manager.BroadcastPlayByLocalPlayer(vector3i.ToVector3() + Vector3.one * 0.5f, "Misc/unlocking");
|
|
this.ResetEventData(timerData);
|
|
}
|
|
|
|
private void ResetEventData(TimerEventData timerData)
|
|
{
|
|
timerData.AlternateEvent -= this.EventData_CloseEvent;
|
|
timerData.CloseEvent -= this.EventData_CloseEvent;
|
|
timerData.Event -= this.EventData_Event;
|
|
}
|
|
|
|
public override int DamageBlock(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, int _damagePoints, int _entityIdThatDamaged, ItemActionAttack.AttackHitInfo _attackHitInfo = null, bool _bUseHarvestTool = false, bool _bBypassMaxDamage = false)
|
|
{
|
|
TileEntitySecureLootContainerSigned tileEntitySecureLootContainer = _world.GetTileEntity(_clrIdx, _blockPos) as TileEntitySecureLootContainerSigned;
|
|
PlatformUserIdentifierAbs getContainerOwner = tileEntitySecureLootContainer.GetOwner();
|
|
if (getContainerOwner == null)
|
|
{
|
|
return this.OnBlockDamaged(_world, _clrIdx, _blockPos, _blockValue, _damagePoints, _entityIdThatDamaged, _attackHitInfo, _bUseHarvestTool, _bBypassMaxDamage, 0);
|
|
}
|
|
else
|
|
{
|
|
bool isOwner = tileEntitySecureLootContainer.IsOwner(PlatformManager.InternalLocalUserIdentifier);
|
|
if (!isOwner)
|
|
{
|
|
EntityAlive entityAlive = _world.GetEntity(_entityIdThatDamaged) as EntityAlive;
|
|
if (entityAlive != null)
|
|
{
|
|
string entityClassName = entityAlive.EntityClass.entityClassName;
|
|
//Log.Out("DamageBlock:entityClassName: " + entityClassName);
|
|
if (entityClassName == "playerMale" || entityClassName == "playerFemale")
|
|
{
|
|
int @playerKillingMode = GameStats.GetInt(EnumGameStats.PlayerKillingMode);
|
|
//Log.Out("DamageBlock:EnumPlayerKillingMode-@playerKillingMode: " + @playerKillingMode);
|
|
if (@playerKillingMode == 0)
|
|
{
|
|
//Log.Out("DamageBlock:EnumPlayerKillingMode: No Killing");
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("DamageBlock:EnumPlayerKillingMode: Killing Allowed");
|
|
return this.OnBlockDamaged(_world, _clrIdx, _blockPos, _blockValue, _damagePoints, _entityIdThatDamaged, _attackHitInfo, _bUseHarvestTool, _bBypassMaxDamage, 0);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return this.OnBlockDamaged(_world, _clrIdx, _blockPos, _blockValue, _damagePoints, _entityIdThatDamaged, _attackHitInfo, _bUseHarvestTool, _bBypassMaxDamage, 0);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return this.OnBlockDamaged(_world, _clrIdx, _blockPos, _blockValue, _damagePoints, _entityIdThatDamaged, _attackHitInfo, _bUseHarvestTool, _bBypassMaxDamage, 0);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return this.OnBlockDamaged(_world, _clrIdx, _blockPos, _blockValue, _damagePoints, _entityIdThatDamaged, _attackHitInfo, _bUseHarvestTool, _bBypassMaxDamage, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
|
|
{
|
|
TileEntitySecureLootContainerSigned tileEntitySecureLootContainerSigned = _world.GetTileEntity(_clrIdx, _blockPos) as TileEntitySecureLootContainerSigned;
|
|
if (tileEntitySecureLootContainerSigned == null)
|
|
{
|
|
return new BlockActivationCommand[0];
|
|
}
|
|
PlatformUserIdentifierAbs internalLocalUserIdentifier = PlatformManager.InternalLocalUserIdentifier;
|
|
PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySecureLootContainerSigned.GetOwner());
|
|
bool flag = tileEntitySecureLootContainerSigned.LocalPlayerIsOwner();
|
|
bool flag2 = !flag && (playerData != null && playerData.ACL != null) && playerData.ACL.Contains(internalLocalUserIdentifier);
|
|
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands LocalPlayerIsOwner: " + flag);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands IsLocked: " + tileEntitySecureLootContainerSigned.IsLocked());
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands bTouched: " + tileEntitySecureLootContainerSigned.bTouched);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands IsUserAllowed: " + tileEntitySecureLootContainerSigned.IsUserAllowed(internalLocalUserIdentifier));
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands Can User Access: " + flag2);
|
|
|
|
this.cmds[0].enabled = true;
|
|
this.cmds[1].enabled = (this.isSecure && !tileEntitySecureLootContainerSigned.IsLocked() && (flag || flag2));
|
|
this.cmds[2].enabled = (this.isSecure && tileEntitySecureLootContainerSigned.IsLocked() && flag);
|
|
this.cmds[3].enabled = this.isSecure && ((!tileEntitySecureLootContainerSigned.IsUserAllowed(internalLocalUserIdentifier) && tileEntitySecureLootContainerSigned.HasPassword() && tileEntitySecureLootContainerSigned.IsLocked()) || flag);
|
|
this.cmds[4].enabled = (this.isSecure && this.lockPickItem != null && tileEntitySecureLootContainerSigned.IsLocked() && !flag);
|
|
this.cmds[5].enabled = this.isSecure;
|
|
this.cmds[6].enabled = this.canPickUpBlock && (tileEntitySecureLootContainerSigned.IsEmpty() && tileEntitySecureLootContainerSigned.bTouched);
|
|
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[0].enabled: " + this.cmds[0].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[1].enabled: " + this.cmds[1].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[2].enabled: " + this.cmds[2].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[3].enabled: " + this.cmds[3].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[4].enabled: " + this.cmds[4].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[5].enabled: " + this.cmds[5].enabled);
|
|
//Log.Out("BlockTakeSecureLootSignedContainer-GetBlockActivationCommands this.cmds[6].enabled: " + this.cmds[6].enabled);
|
|
|
|
return this.cmds;
|
|
}
|
|
|
|
private BlockActivationCommand[] cmds = new BlockActivationCommand[]
|
|
{
|
|
new BlockActivationCommand("Search", "search", false, false),
|
|
new BlockActivationCommand("lock", "lock", false, false),
|
|
new BlockActivationCommand("unlock", "unlock", false, false),
|
|
new BlockActivationCommand("keypad", "keypad", false, false),
|
|
new BlockActivationCommand("pick", "unlock", false, false),
|
|
new BlockActivationCommand("edit", "pen", false, false),
|
|
new BlockActivationCommand("take", "hand", false, false)
|
|
};
|
|
|
|
public float TakeDelay = 3f;
|
|
public string ReplacementBlockName = "";
|
|
public int numBlocks = 1;
|
|
public bool isReplacementItem = false;
|
|
public bool isSecure = true;
|
|
public bool canPickUpBlock = true;
|
|
}
|