public void WhenDestroyed(DestructionInfo info) { //drop all our contents ItemStorage itemStorage = null; // rare cases were gameObject is destroyed for some reason and then the method is called if (gameObject == null) { return; } itemStorage = GetComponent <ItemStorage>(); if (itemStorage != null) { itemStorage.ServerDropAll(); } SpawnResult frameSpawn = Spawn.ServerPrefab(CommonPrefabs.Instance.MachineFrame, SpawnDestination.At(gameObject)); if (!frameSpawn.Successful) { Logger.LogError($"Failed to spawn frame! Is {this} missing references in the inspector?", Category.Construction); return; } GameObject frame = frameSpawn.GameObject; frame.GetComponent <MachineFrame>().ServerInitFromComputer(this); Despawn.ServerSingle(gameObject); integrity.OnWillDestroyServer.RemoveListener(WhenDestroyed); }
public void WhenDestroyed(DestructionInfo info) { //drop all our contents ItemStorage itemStorage = null; // rare cases were gameObject is destroyed for some reason and then the method is called if (gameObject == null) { return; } itemStorage = GetComponent <ItemStorage>(); if (itemStorage != null) { itemStorage.ServerDropAll(); } var frame = Spawn.ServerPrefab(framePrefab, SpawnDestination.At(gameObject)).GameObject; frame.GetComponent <MachineFrame>().ServerInitFromComputer(this); Despawn.ServerSingle(gameObject); integrity.OnWillDestroyServer.RemoveListener(WhenDestroyed); }
public void ServerPerformInteraction(HandApply interaction) { var itemObject = interaction.HandSlot.ItemObject; if (Validations.HasItemTrait(itemObject, CommonTraits.Instance.Crowbar)) { oreBoxItemStorage.ServerDropAll(); } else if (Validations.HasItemTrait(itemObject, CommonTraits.Instance.OreGeneral)) { TransferOre(interaction.HandSlot); } else { var itemStorage = itemObject.GetComponent <ItemStorage>(); var itemSlotList = itemStorage.GetItemSlots(); foreach (var itemSlot in itemSlotList) { if (itemSlot.IsEmpty) { continue; } TransferOre(itemSlot); } } }
public void ServerPerformInteraction(HandApply interaction) { //unscrew ToolUtils.ServerUseToolWithActionMessages(interaction, secondsToScrewdrive, "You start to disconnect the monitor...", $"{interaction.Performer.ExpensiveName()} starts to disconnect the monitor...", "You disconnect the monitor.", $"{interaction.Performer.ExpensiveName()} disconnects the monitor.", () => { //drop all our contents ItemStorage itemStorage = null; // rare cases were gameObject is destroyed for some reason and then the method is called if (gameObject != null) { itemStorage = GetComponent <ItemStorage>(); } if (itemStorage != null) { itemStorage.ServerDropAll(); } var frame = Spawn.ServerPrefab(framePrefab, SpawnDestination.At(gameObject)).GameObject; frame.GetComponent <ComputerFrame>().ServerInitFromComputer(this); Despawn.ServerSingle(gameObject); }); }
/// <summary> /// Removes all limbs from the container and drops all items that they are holding /// </summary> public void RemoveLimbs() { if (ItemStorage == null) { ItemStorage = this.GetComponent <ItemStorage>(); } ItemStorage.ServerDropAll(); PlayerSprites.livingHealthMasterBase.RootBodyPartContainers.Remove(this); }
public void ServerPerformInteraction(HandActivate interaction) { if (ArmTrap(interaction.Performer) == false) { if (trapContent.GetNextFreeIndexedSlot() == null) { trapContent.ServerDropAll(); } } }
public void OpenClose() { if (closed) { UpdateManager.Remove(CallbackType.UPDATE, UpdateMe); SoundManager.PlayNetworkedAtPos(openSound, WorldPosition, sourceObj: gameObject); barrelSpriteHandler.ChangeSprite(0); itemStorage.ServerDropAll(); storedFermentables.Clear(); } else { UpdateManager.Add(CallbackType.UPDATE, UpdateMe); SoundManager.PlayNetworkedAtPos(closeSound, WorldPosition, sourceObj: gameObject); barrelSpriteHandler.ChangeSprite(1); } closed = !closed; }
private void EjectContents() { storage.ServerDropAll(); }