public BCMTileEntitySign(Vector3i pos, [NotNull] TileEntitySign te) : base(pos, te) { Owner = te.GetOwner(); Users = te.GetUsers(); HasPassword = te.HasPassword(); IsLocked = te.IsLocked(); Text = te.GetText(); }
public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing) { TileEntitySign tileEntitySign = (TileEntitySign)_world.GetTileEntity(_clrIdx, _blockPos); if (tileEntitySign == null) { return(new BlockActivationCommand[0]); } string @string = GamePrefs.GetString(EnumGamePrefs.PlayerId); PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySign.GetOwner()); bool flag = !tileEntitySign.IsOwner(@string) && (playerData != null && playerData.ACL != null) && playerData.ACL.Contains(@string); this.cmds[0].enabled = true; this.cmds[1].enabled = (!tileEntitySign.IsLocked() && (tileEntitySign.IsOwner(@string) || flag)); this.cmds[2].enabled = (tileEntitySign.IsLocked() && tileEntitySign.IsOwner(@string)); this.cmds[3].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string)); this.cmds[4].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string)); return(this.cmds); }