/// <inheritdoc/> public override int GetHashCode() { var hashCode = 2038336081; hashCode = hashCode * -1521134295 + Handle.GetHashSafe(); hashCode = hashCode * -1521134295 + SymbolicName.GetHashSafe(); hashCode = hashCode * -1521134295 + NodeId.GetHashSafe(); hashCode = hashCode * -1521134295 + NodeClass.GetHashCode(); hashCode = hashCode * -1521134295 + BrowseName.GetHashSafe(); hashCode = hashCode * -1521134295 + DisplayName.GetHashSafe(); hashCode = hashCode * -1521134295 + Description.GetHashSafe(); hashCode = hashCode * -1521134295 + WriteMask.GetHashSafe(); hashCode = hashCode * -1521134295 + UserWriteMask.GetHashSafe(); hashCode = hashCode * -1521134295 + AccessRestrictions.GetHashSafe(); hashCode = hashCode * -1521134295 + RolePermissions.GetHashSafe(); hashCode = hashCode * -1521134295 + UserRolePermissions.GetHashSafe(); return(hashCode); }
public void ServerPerformInteraction(HandApply interaction) { // Is the player trying to put something in the closet if (interaction.HandObject != null) { if (!IsClosed) { Vector3 targetPosition = interaction.TargetObject.WorldPosServer().RoundToInt(); Vector3 performerPosition = interaction.Performer.WorldPosServer(); Inventory.ServerDrop(interaction.HandSlot, targetPosition - performerPosition); } else if (IsLockable && AccessRestrictions != null) { if (AccessRestrictions.CheckAccessCard(interaction.HandObject)) { if (isLocked) { SyncLocked(isLocked, false); } else { SyncLocked(isLocked, true); } } } } else if (!isLocked) { ServerToggleClosed(); } }
public CloudPTClient(string consumerKey, string secret, AccessRestrictions accessMode) { _consumerKey = consumerKey; _consumerSecret = secret; Restrictions = accessMode; InitializeRestClients(); }
private void Awake() { //This is needed because you can no longer apply shutterSwitch prefabs (it will move all of the child sprite positions) gameObject.layer = LayerMask.NameToLayer("WallMounts"); spriteHandler = GetComponentInChildren <SpriteHandler>(); apcPoweredDevice = GetComponent <APCPoweredDevice>(); accessRestrictions = GetComponent <AccessRestrictions>(); }
private void Awake() { directional = GetComponent <Directional>(); objectBehaviour = GetComponent <ObjectBehaviour>(); registerTile = GetComponent <RegisterTile>(); accessRestrictions = GetComponent <AccessRestrictions>(); electricalNodeControl = GetComponent <ElectricalNodeControl>(); spriteHandler = GetComponentInChildren <SpriteHandler>(); }
private void Awake() { registerTile = GetComponent <RegisterTile>(); itemStorage = GetComponent <ItemStorage>(); apcPoweredDevice = GetComponent <APCPoweredDevice>(); integrity = GetComponent <Integrity>(); accessRestrictions = GetComponent <AccessRestrictions>(); lineRenderer = GetComponentInChildren <LineRenderer>(); }
private void Awake() { accessRestrictions = GetComponent <AccessRestrictions>(); spriteHandler = GetComponentInChildren <SpriteHandler>(); Thresholds = initialAcuThresholds.Clone(); GasLevelStatus = new AcuStatus[Gas.Gases.Count]; DesiredMode = initialOperatingMode; }
public CloudPTClient(string consumerKey, string secret, string authToken, string authSecret, AccessRestrictions accessMode) { _consumerKey = consumerKey; _consumerSecret = secret; Restrictions = accessMode; InitializeRestClients(); AuthenticationToken = new AuthToken(authToken, authSecret); }
public void ClaimLaborPoints(GameObject player) { var playerStorage = player.GetComponent <ItemStorage>(); var idCardObj = playerStorage.GetNamedItemSlot(NamedSlot.id).ItemObject; var idCard = AccessRestrictions.GetIDCard(idCardObj); idCard.currencies[(int)CurrencyType.LaborPoints] += laborPoints; laborPoints = 0; oreRedemptiomMachineGUI.UpdateLaborPoints(laborPoints); }
public void ServerPerformInteraction(HandApply interaction) { // Is the player trying to put something in the closet? if (interaction.HandObject != null) { if (!IsClosed) { Vector3 targetPosition = interaction.TargetObject.WorldPosServer().RoundToInt(); Vector3 performerPosition = interaction.Performer.WorldPosServer(); Inventory.ServerDrop(interaction.HandSlot, targetPosition - performerPosition); } else if (IsClosed && !isEmagged && Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Emag)) { SoundManager.PlayNetworkedAtPos(soundOnEmag, registerTile.WorldPositionServer, 1f, sourceObj: gameObject); ServerHandleContentsOnStatusChange(false); isEmagged = true; SyncLocked(isLocked, false); SyncStatus(statusSync, ClosetStatus.Open); } } else { // player want to close locker? if (!isLocked && !isEmagged) { ServerToggleClosed(); } } // player trying to unlock locker? if (IsLockable && AccessRestrictions != null) { // player trying to open lock by card? if (AccessRestrictions.CheckAccessCard(interaction.HandObject)) { if (isLocked) { SyncLocked(isLocked, false); } else { SyncLocked(isLocked, true); } } // player with access can unlock just by click else if (AccessRestrictions.CheckAccess(interaction.Performer)) { if (isLocked) { SyncLocked(isLocked, false); } } } }
private void Start() { //This is needed because you can no longer apply shutterSwitch prefabs (it will move all of the child sprite positions) gameObject.layer = LayerMask.NameToLayer("WallMounts"); spriteRenderer = GetComponentInChildren <SpriteRenderer>(); accessRestrictions = gameObject.AddComponent <AccessRestrictions>(); if (restricted) { accessRestrictions.restriction = access; } }
/// <summary> /// Spawn airlock and add access from airlock Electronics. /// </summary> /// <param name="airlockPrefab"></param> private void ServerSpawnAirlock(GameObject airlockPrefab) { var airlock = Spawn.ServerPrefab(airlockPrefab, SpawnDestination.At(gameObject)).GameObject; if (airlockElectronicsSlot.IsOccupied) { AccessRestrictions airlockAccess = airlock.GetComponentInChildren <AccessRestrictions>(); GameObject airlockElectronics = airlockElectronicsSlot.ItemObject; AirlockElectronics electronics = airlockElectronics.GetComponent <AirlockElectronics>(); airlockAccess.restriction = electronics.CurrentAccess; } }
public void ServerPerformInteraction(HandApply interaction) { // Locking/Unlocking by alt clicking if (interaction.IsAltClick) { if (IsLockable && AccessRestrictions != null && ClosetStatus.Equals(ClosetStatus.Closed)) { // Default CheckAccess will check for the ID slot first // so the default AltClick interaction will prioritize // the ID slot, only when that would fail the hand // will be checked, alternatively the user can also // just click the locker with the ID inhand. if (AccessRestrictions.CheckAccess(interaction.Performer)) { if (isLocked) { SyncLocked(isLocked, false); Chat.AddExamineMsg(interaction.Performer, $"You unlock the {closetName}."); } else { SyncLocked(isLocked, true); Chat.AddExamineMsg(interaction.Performer, $"You lock the {closetName}."); } } } // Alt clicking is the locker's only alt click behaviour. return; } // Is the player trying to put something in the closet? if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Emag) && interaction.HandObject.TryGetComponent <Emag>(out var emag) && emag.EmagHasCharges()) { if (IsClosed && !isEmagged) { AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: 1f); SoundManager.PlayNetworkedAtPos(soundOnEmag, registerTile.WorldPositionServer, audioSourceParameters, gameObject); //ServerHandleContentsOnStatusChange(false); isEmagged = true; emag.UseCharge(interaction); Chat.AddActionMsgToChat(interaction, "The access panel errors. A slight amount of smoke pours from behind the panel...", "You can smell caustic smoke from somewhere..."); //SyncStatus(statusSync, ClosetStatus.Open); BreakLock(); } }
private bool CanSell(VendorItem itemToSpawn, ConnectedPlayer player) { // check if selected item is valid var isSelectionValid = (itemToSpawn != null && itemToSpawn.Stock > 0); if (!isSelectionValid) { return(false); } // check if this player has vending cooldown right now if (VendingCooldown) { if (player != null && player.Script) { var hasCooldown = !Cooldowns.TryStartServer(player.Script, VendingCooldown); if (hasCooldown) { return(false); } } } // check player access if (player != null && accessRestrictions && !isEmagged) { var hasAccess = accessRestrictions.CheckAccess(player.GameObject); if (!hasAccess) { Chat.AddWarningMsgFromServer(player.GameObject, noAccessMessage); return(false); } } if (itemToSpawn.Price > 0) { var playerStorage = player.GameObject.GetComponent <ItemStorage>(); var idCardObj = playerStorage.GetNamedItemSlot(NamedSlot.id).ItemObject; var idCard = AccessRestrictions.GetIDCard(idCardObj); if (idCard.currencies[(int)itemToSpawn.Currency] >= itemToSpawn.Price) { idCard.currencies[(int)itemToSpawn.Currency] -= itemToSpawn.Price; } else { Chat.AddWarningMsgFromServer(player.GameObject, tooExpensiveMessage); return(false); } } return(isSelectionValid); }
private void EnsureInit() { if (registerObject != null) { return; } registerObject = GetComponent <RegisterObject>(); attributes = GetComponent <ObjectAttributes>(); container = GetComponent <ObjectContainer>(); pushPull = GetComponent <PushPull>(); accessRestrictions = GetComponent <AccessRestrictions>(); }
private void Awake() { // ensure we have a net tab set up with the correct type // HasNetworkTab will open vendor UI by click if there is no object in active hand var hasNetTab = GetComponent <HasNetworkTab>(); if (hasNetTab == null) { gameObject.AddComponent <HasNetworkTab>(); } accessRestrictions = GetComponent <AccessRestrictions>(); }
private void Awake() { registerObject = GetComponent <RegisterObject>(); attributes = GetComponent <ObjectAttributes>(); container = GetComponent <ObjectContainer>(); pushPull = GetComponent <PushPull>(); accessRestrictions = GetComponent <AccessRestrictions>(); lockState = isLockable ? Lock.Locked : Lock.NoLock; GetComponent <Integrity>().OnWillDestroyServer.AddListener(OnWillDestroyServer); //Fetch the items name to use in messages closetName = gameObject.ExpensiveName(); }
public void WhenDestroyed(DestructionInfo info) { // rare cases were gameObject is destroyed for some reason and then the method is called if (gameObject == null) { return; } AccessRestrictions airlockAccess = GetComponentInChildren <AccessRestrictions>(); var doorAssembly = Spawn.ServerPrefab(airlockAssemblyPrefab, SpawnDestination.At(gameObject)).GameObject; doorAssembly.GetComponent <AirlockAssembly>().ServerInitFromComputer(AirlockElectronicsPrefab, airlockAccess.restriction, doorMasterController.isWindowedDoor); _ = Despawn.ServerSingle(gameObject); integrity.OnWillDestroyServer.RemoveListener(WhenDestroyed); }
public void ClaimLaborPoints(GameObject player) { var playerStorage = player.GetComponent <DynamicItemStorage>(); var itemSlotList = playerStorage.GetNamedItemSlots(NamedSlot.id); foreach (var itemSlot in itemSlotList) { if (itemSlot.ItemObject) { var idCard = AccessRestrictions.GetIDCard(itemSlot.ItemObject); idCard.currencies[(int)CurrencyType.LaborPoints] += laborPoints; laborPoints = 0; oreRedemptiomMachineGUI.UpdateLaborPoints(laborPoints); return; } } }
public void ServerPerformInteraction(HandApply interaction) { // Is the player trying to put something in the closet? if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Emag)) { if (IsClosed && !isEmagged) { SoundManager.PlayNetworkedAtPos(soundOnEmag, registerTile.WorldPositionServer, 1f, gameObject); //ServerHandleContentsOnStatusChange(false); isEmagged = true; //SyncStatus(statusSync, ClosetStatus.Open); BreakLock(); } } else if (Validations.HasUsedActiveWelder(interaction)) { // Is the player trying to weld closet? if (IsWeldable && interaction.Intent == Intent.Harm) { ToolUtils.ServerUseToolWithActionMessages( interaction, weldTime, $"You start {(IsWelded ? "unwelding" : "welding")} the {closetName} door...", $"{interaction.Performer.ExpensiveName()} starts {(IsWelded ? "unwelding" : "welding")} the {closetName} door...", $"You {(IsWelded ? "unweld" : "weld")} the {closetName} door.", $"{interaction.Performer.ExpensiveName()} {(IsWelded ? "unwelds" : "welds")} the {closetName} door.", ServerTryWeld); } } else if (interaction.HandObject != null) { // If nothing in the players hand can be used on the closet, drop it in the closet if (!IsClosed) { Vector3 targetPosition = interaction.TargetObject.WorldPosServer().RoundToInt(); Vector3 performerPosition = interaction.Performer.WorldPosServer(); Inventory.ServerDrop(interaction.HandSlot, targetPosition - performerPosition); } } else if (interaction.HandObject == null) { // player want to close locker? if (!isLocked && !isWelded) { ServerToggleClosed(); } else if (isLocked || isWelded) { if (IsLockable) { //This is to stop cant open msg even though you can if (!AccessRestrictions.CheckAccess(interaction.Performer)) { Chat.AddExamineMsg( interaction.Performer, $"Can\'t open {closetName}"); } } else { Chat.AddExamineMsg( interaction.Performer, $"Can\'t open {closetName}"); } } } // player trying to unlock locker? if (IsLockable && AccessRestrictions != null) { // player trying to open lock by card? if (AccessRestrictions.CheckAccessCard(interaction.HandObject)) { if (isLocked) { SyncLocked(isLocked, false); } else { SyncLocked(isLocked, true); } } // player with access can unlock just by click else if (AccessRestrictions.CheckAccess(interaction.Performer)) { if (isLocked) { SyncLocked(isLocked, false); } } } }
protected override void Awake() { base.Awake(); accessRestrictions = GetComponent <AccessRestrictions>(); ashOverlay = TileManager.GetTile(TileType.Effects, "SmallAsh") as OverlayTile; }
private bool CanSell(VendorItem itemToSpawn, ConnectedPlayer player) { // check if selected item is valid var isSelectionValid = itemToSpawn != null && itemToSpawn.Stock > 0; if (isSelectionValid == false) { return(false); } // check if this player has vending cooldown right now if (VendingCooldown) { if (player != null && player.Script) { var hasCooldown = !Cooldowns.TryStartServer(player.Script, VendingCooldown); if (hasCooldown) { return(false); } } } /* --ACCESS REWORK-- * TODO Remove the AccessRestriction check when we finish migrating! * */ // check player access if (player != null && (accessRestrictions || clearanceCheckable) && !isEmagged) { var hasAccess = accessRestrictions ? accessRestrictions.CheckAccess(player.GameObject) : clearanceCheckable.HasClearance(player.GameObject); if (hasAccess == false && player.Script.PlayerState != PlayerScript.PlayerStates.Ai) { Chat.AddWarningMsgFromServer(player.GameObject, noAccessMessage); return(false); } } if (itemToSpawn.Price > 0) { var playerStorage = player.GameObject.GetComponent <DynamicItemStorage>(); var itemSlotList = playerStorage.GetNamedItemSlots(NamedSlot.id); foreach (var itemSlot in itemSlotList) { if (itemSlot.ItemObject) { var idCard = AccessRestrictions.GetIDCard(itemSlot.ItemObject); if (idCard.currencies[(int)itemToSpawn.Currency] >= itemToSpawn.Price) { idCard.currencies[(int)itemToSpawn.Currency] -= itemToSpawn.Price; break; } else { Chat.AddWarningMsgFromServer(player.GameObject, tooExpensiveMessage); return(false); } } } } return(isSelectionValid); }
/// <summary> /// Validate player based on settings of turret, true if player is allowed, false if player failed validation /// </summary> private bool ValidatePlayer(PlayerScript script) { //Neutralize All Unauthorised Personnel if (CheckUnauthorisedPersonnel) { var allowed = false; foreach (var access in authorisedAccess) { if (AccessRestrictions.CheckAccess(script.gameObject, access) == false) { continue; } //Only need to check for one valid access allowed = true; break; } //Check for failure if (allowed == false) { return(false); } } //Record Checking if (CheckUnidentifiedLifeSigns || CheckForArrest || CheckSecurityRecords) { var hasRecord = false; foreach (var record in CrewManifestManager.Instance.SecurityRecords) { //Check to see if we have record if (record.characterSettings.Name.Equals(script.visibleName) == false) { continue; } //Check Security Records For Criminals if (CheckSecurityRecords && record.Status == SecurityStatus.Criminal) { return(false); } //Neutralize Identified Criminals if (CheckForArrest && record.Status == SecurityStatus.Arrest) { return(false); } hasRecord = true; break; } //Neutralize All Unidentified Life Signs //Unknown name check here or else it would be possible for someone to add record with the name Unknown //and then wouldn't be targeted by turrets if (CheckUnidentifiedLifeSigns && (hasRecord == false || script.visibleName.Equals("Unknown"))) { return(false); } } //Check for Weapon Authorization if (CheckWeaponAuthorisation && script.Equipment != null) { if (CheckSlot(NamedSlot.rightHand) == false || CheckSlot(NamedSlot.leftHand) == false) { return(false); } bool CheckSlot(NamedSlot slot) { var handItem = script.Equipment.GetClothingItem(slot); if (handItem == null) { return(true); } if (Validations.HasItemTrait(handItem.GameObjectReference, CommonTraits.Instance.Gun)) { //Only allow authorised people to have guns var allowed = false; foreach (var access in weaponAuthorisation) { if (AccessRestrictions.CheckAccess(script.gameObject, access) == false) { continue; } //Only need to check for one valid access allowed = true; break; } //Check for failure if (allowed == false) { return(false); } } //Passed weapons check for this hand return(true); } } return(true); }
protected override void Awake() { base.Awake(); accessRestrictions = GetComponent <AccessRestrictions>(); clearanceCheckable = GetComponent <ClearanceCheckable>(); }
private const float BURNING_DURATION = 1.5f; // In seconds - timed to the Ding SFX. protected override void Awake() { base.Awake(); accessRestrictions = GetComponent <AccessRestrictions>(); }