public override void OnStartClient() { playerNetworkActions = GetComponent <PlayerNetworkActions>(); playerMove = GetComponent <PlayerMove>(); PlayerScript playerScript = GetComponent <PlayerScript>(); if (playerScript.JobType == JobType.NULL) { foreach (Transform t in transform) { t.gameObject.SetActive(false); } ConsciousState = ConsciousState.DEAD; playerMove.allowInput = false; } base.OnStartClient(); }
private void Awake() { PlayerScript = GetComponent <PlayerScript>(); playerDirectional = gameObject.GetComponent <Directional>(); registerPlayer = GetComponent <RegisterPlayer>(); pna = gameObject.GetComponent <PlayerNetworkActions>(); PlayerScript.registerTile.AddStatus(this); // Aren't these set up with sync vars? Why are they set like this? // They don't appear to ever get synced either. if (PlayerScript.IsGhost) { return; } RunSpeed = 1; WalkSpeed = 1; CrawlSpeed = 0f; }
protected override void OnDeathActions() { if (CustomNetworkManager.Instance._isServer) { PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>(); PlayerMove pm = gameObject.GetComponent <PlayerMove>(); ConnectedPlayer player = PlayerList.Instance.Get(gameObject); string killerName = "Stressful work"; if (LastDamagedBy != null) { killerName = PlayerList.Instance.Get(LastDamagedBy).Name; } string playerName = player.Name ?? "dummy"; if (killerName == playerName) { Chat.AddActionMsgToChat(gameObject, "You committed suicide, what a waste.", $"{playerName} committed suicide."); } else if (killerName.EndsWith(playerName)) { // chain reactions Chat.AddActionMsgToChat(gameObject, $" You screwed yourself up with some help from {killerName}", $"{playerName} screwed himself up with some help from {killerName}"); } else { PlayerList.Instance.TrackKill(LastDamagedBy, gameObject); } pna.DropItem(EquipSlot.rightHand); pna.DropItem(EquipSlot.leftHand); if (isServer) { EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large, bloodColor); } PlayerDeathMessage.Send(gameObject); } }
private void ProcessFurther(ConnectedPlayer player, GameObject item = null) { PlayerNetworkActions pna = player.Script.playerNetworkActions; if (string.IsNullOrEmpty(SlotUUID)) { //To drop if (!pna.ValidateDropItem(InventoryManager.GetSlotFromUUID(FromSlotUUID, true) , ForceSlotUpdate)) { pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } else { if (!pna.ValidateInvInteraction(SlotUUID, FromSlotUUID, item, ForceSlotUpdate)) { pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } }
public void CmdPullObject(GameObject obj) { if (isPulling) { GameObject cObj = gameObject.GetComponent <PlayerSync>().pullingObject; cObj.GetComponent <PushPull>().pulledBy = null; gameObject.GetComponent <PlayerSync>().pullObjectID = NetworkInstanceId.Invalid; } PushPull pulled = obj.GetComponent <PushPull>(); //check if the object you want to pull is another player if (pulled.isPlayer) { PlayerSync playerS = obj.GetComponent <PlayerSync>(); //Anything that the other player is pulling should be stopped if (playerS.pullingObject != null) { PlayerNetworkActions otherPNA = obj.GetComponent <PlayerNetworkActions>(); otherPNA.CmdStopOtherPulling(playerS.pullingObject); } } //Other player is pulling object, send stop on that player if (pulled.pulledBy != null) { if (pulled.pulledBy != gameObject) { pulled.GetComponent <PlayerNetworkActions>().CmdStopPulling(obj); } } if (pulled != null) { PlayerSync pS = GetComponent <PlayerSync>(); pS.pullObjectID = pulled.netId; isPulling = true; } }
public override void Interact(GameObject originator, Vector3 position, string hand) { PlayerNetworkActions pna = PlayerManager.LocalPlayer.GetComponent <PlayerNetworkActions>(); // Close the door if it's open if (doorController.IsOpened && allowInput) { pna.CmdTryCloseDoor(gameObject); allowInput = false; StartCoroutine(DoorInputCoolDown()); } // Attempt to open if it's closed if (doorController != null && allowInput) { pna.CmdCheckDoorPermissions(gameObject, PlayerManager.LocalPlayerScript.gameObject); allowInput = false; StartCoroutine(DoorInputCoolDown()); } }
private void ProcessFurther(GameObject player, GameObject item = null) { GameObject clientPlayer = player; PlayerNetworkActions pna = clientPlayer.GetComponent <PlayerNetworkActions>(); if (string.IsNullOrEmpty(SlotUUID)) { //To drop if (!pna.ValidateDropItem(InventoryManager.GetSlotFromUUID(FromSlotUUID, true) , ForceSlotUpdate)) { pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } else { if (!pna.ValidateInvInteraction(SlotUUID, FromSlotUUID, item, ForceSlotUpdate)) { pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } }
public override void Death(bool gibbed = false) { if (CustomNetworkManager.Instance._isServer) { PlayerNetworkActions pNet = GetComponent <PlayerNetworkActions>(); pNet.RpcSpawnGhost(); PlayerMove pM = GetComponent <PlayerMove>(); pM.isGhost = true; pM.allowInput = true; if (lastDamager == gameObject.name) { pNet.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " commited suicide</b></color>", true); //killfeed } else if (lastDamager.EndsWith(gameObject.name)) // chain reactions { pNet.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " screwed himself up with some help (" + lastDamager + ")</b></color>", true); //killfeed } else { PlayerList.Instance.UpdateKillScore(lastDamager); pNet.CmdSendAlertMessage( "<color=red><b>" + lastDamager + "</b> has killed <b>" + gameObject.name + "</b></color>", true); //killfeed } countRespawn = true; respawnTime = 0f; GetComponent <PlayerNetworkActions>().CmdDropItem("leftHand"); GetComponent <PlayerNetworkActions>().CmdDropItem("rightHand"); gameObject.GetComponent <WeaponNetworkActions>().BloodSplat(transform.position, Sprites.BloodSplatSize.medium); Debug.Log("respawn initiated.."); } mobStat = MobConsciousStat.DEAD; base.Death(gibbed); }
public bool AddItemToUISlot(GameObject itemObject, EquipSlot equipSlot, PlayerNetworkActions originPNA = null, bool replaceIfOccupied = false, bool isInit = false) { if (Inventory[equipSlot].Item != null && !replaceIfOccupied) { return(false); } var cnt = itemObject.GetComponent <CustomNetTransform>(); if (cnt != null) { var objectBehaviour = itemObject.GetComponent <ObjectBehaviour>(); if (objectBehaviour != null) { objectBehaviour.parentContainer = playerScript.pushPull; } cnt.DisappearFromWorldServer(); } if (Inventory[equipSlot].Item != null && !replaceIfOccupied) { return(false); } if (originPNA != null) { var fromSlot = InventoryManager.GetSlotFromItem(itemObject, originPNA); InventoryManager.ClearInvSlot(fromSlot); } var toSlot = Inventory[equipSlot]; InventoryManager.EquipInInvSlot(toSlot, itemObject, isInit); return(true); }
public bool CheckAccess(GameObject Player, string hand) { IDCard card; PlayerNetworkActions PNA = Player.GetComponent <PlayerNetworkActions>(); // Check for an ID card if (PNA.Inventory.ContainsKey("id") && PNA.Inventory["id"]?.GetComponent <IDCard>() != null) { card = PNA.Inventory["id"].GetComponent <IDCard>(); } else if (PNA.Inventory.ContainsKey(PNA.activeHand) && PNA.Inventory[PNA.activeHand]?.GetComponent <IDCard>() != null) { card = PNA.Inventory[PNA.activeHand].GetComponent <IDCard>(); } else { // If there isn't one, see if we even need one if ((int)restriction == 0) { return(true); } // If there isn't one and we don't need one, we don't open the door return(false); } // If we have an ID, make sure we have access if ((int)restriction == 0) { return(true); } if (card.accessSyncList.Contains((int)restriction)) { return(true); } return(false); }
public void ServerPerformInteraction(HandApply interaction) { PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); if (IsClosed) { if (isFull && interaction.HandObject == null) { ServerRemoveExtinguisher(interaction.HandSlot); } IsClosed = false; } else { if (isFull) { if (interaction.HandObject == null) { ServerRemoveExtinguisher(interaction.HandSlot); } else { IsClosed = true; } } else { if (interaction.HandObject && interaction.HandObject.GetComponent <FireExtinguisher>()) { ServerAddExtinguisher(interaction); } else { IsClosed = true; } } } }
protected override void ServerPerformInteraction(HandApply interaction) { PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); if (IsClosed) { if (isFull && interaction.HandObject == null) { RemoveExtinguisher(pna, interaction.HandSlot.SlotName); } IsClosed = false; } else { if (isFull) { if (interaction.HandObject == null) { RemoveExtinguisher(pna, interaction.HandSlot.SlotName); } else { IsClosed = true; } } else { if (interaction.HandObject && interaction.HandObject.GetComponent <FireExtinguisher>()) { AddExtinguisher(pna, interaction.HandSlot.SlotName, interaction.HandObject); } else { IsClosed = true; } } } }
private void ProcessFurther(ConnectedPlayer player, GameObject item = null) { PlayerNetworkActions pna = player.Script.playerNetworkActions; if (string.IsNullOrEmpty(SlotUUID)) { //To drop if (!pna.ValidateDropItem(InventoryManager.GetSlotFromUUID(FromSlotUUID, true) , ForceSlotUpdate)) { //NOTE: There is currently no drop prediction, so nothing to roll back. //The below logic will cause desync to occur if invoked so removing it for now. //pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } else { if (!pna.ValidateInvInteraction(SlotUUID, FromSlotUUID, item, ForceSlotUpdate)) { pna.RollbackPrediction(SlotUUID, FromSlotUUID, item); } } }
} = true; //Only used on the server public override void OnStartClient() { playerNetworkActions = GetComponent <PlayerNetworkActions>(); playerMove = GetComponent <PlayerMove>(); PlayerScript playerScript = GetComponent <PlayerScript>(); if (playerScript.JobType == JobType.NULL) { foreach (Transform t in transform) { t.gameObject.SetActive(false); } ConsciousState = ConsciousState.DEAD; // Fixme: No more setting allowInputs on client: // When job selection screen is removed from round start // (and moved to preference system in lobby) then we can remove this playerMove.allowInput = false; } base.OnStartClient(); }
// Use this for initialization public override void Death(bool gibbed) { if (CustomNetworkManager.Instance._isServer) { PlayerNetworkActions pNet = GetComponent <PlayerNetworkActions>(); pNet.RpcSpawnGhost(); PlayerMove pM = GetComponent <PlayerMove>(); pM.isGhost = true; pM.allowInput = true; if (lastDamager != gameObject.name) { PlayerList.Instance.UpdateKillScore(lastDamager); pNet.CmdSendAllertMessage("<color=red><b>" + lastDamager + "</b> has killed <b>" + gameObject.name + "</b></color>", true); //killfeed } else { pNet.CmdSendAllertMessage("<color=red><b>" + gameObject.name + " commited suicide</b></color>", true); //killfeed } } mobStat = MobConsciousStat.DEAD; base.Death(gibbed); }
protected override void ServerPerformInteraction(HandApply interaction) { PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); GameObject handObj = pna.Inventory[interaction.HandSlot.SlotName].Item; var tool = handObj != null?handObj.GetComponent <Tool>() : null; //can click on the canister with a wrench to connect/disconnect it from a connector if (tool != null && tool.ToolType == ToolType.Wrench) { if (isConnected) { SoundManager.PlayNetworkedAtPos("Wrench", registerTile.WorldPositionServer, 1f); Disconnect(); return; } else { var foundConnectors = MatrixManager.GetAt <Connector>(registerTile.WorldPositionServer, true); for (int n = 0; n < foundConnectors.Count; n++) { var conn = foundConnectors[n]; if (conn.objectBehaviour.isNotPushable) { SoundManager.PlayNetworkedAtPos("Wrench", registerTile.WorldPositionServer, 1f); connector = conn; isConnected = true; connector.ConnectCanister(this); SetConnectedSprite(connectorSprite); objectBehaviour.isNotPushable = true; ServerOnConnectionStatusChange.Invoke(true); return; } } } } }
public void Cuff(GameObject cuffs, PlayerNetworkActions originPNA) { cuffed = true; pna.AddItemToUISlot(cuffs, EquipSlot.handcuffs, originPNA); }
protected override void OnDeathActions() { if (CustomNetworkManager.Instance._isServer) { PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>(); PlayerMove pm = gameObject.GetComponent <PlayerMove>(); ConnectedPlayer player = PlayerList.Instance.Get(gameObject); string killerName = "stressfull work"; if (LastDamagedBy != null) { killerName = PlayerList.Instance.Get(LastDamagedBy).Name; } if (killerName == player.Name) { PostToChatMessage.Send(player.Name + " commited suicide", ChatChannel.System); //Killfeed } else if (killerName.EndsWith(player.Name)) { // chain reactions PostToChatMessage.Send( player.Name + " screwed himself up with some help (" + killerName + ")", ChatChannel.System); //Killfeed } else { PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject); string departmentKillText = ""; if (LastDamagedBy != null) { JobDepartment killerDepartment = SpawnPoint.GetJobDepartment(LastDamagedBy.GetComponent <PlayerScript>().JobType); JobDepartment victimDepartment = SpawnPoint.GetJobDepartment(gameObject.GetComponent <PlayerScript>().JobType); if (killerDepartment == victimDepartment) { departmentKillText = ", losing " + killerDepartment.GetDescription() + " 1 point for team killing!"; } else { departmentKillText = ", 1 point to " + killerDepartment.GetDescription() + "!"; } } //TDM demo killfeed PostToChatMessage.Send(killerName + " has killed " + player.Name + departmentKillText, ChatChannel.System); //Combat demo killfeed //PostToChatMessage.Send(killerName + " has killed " + gameObject.name, ChatChannel.System); } pna.ValidateDropItem("rightHand", true, transform.position); pna.ValidateDropItem("leftHand", true, transform.position); if (isServer) { EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large); } pna.RpcSpawnGhost(); pm.isGhost = true; pm.allowInput = true; RpcPassBullets(gameObject); PlayerDeathMessage.Send(gameObject); //FIXME Remove for next demo pna.RespawnPlayer(10); } }
private void Start() { playerSprites = gameObject.GetComponent <PlayerSprites>(); registerTile = GetComponent <RegisterTile>(); pna = gameObject.GetComponent <PlayerNetworkActions>(); }
private bool DetermineTileAction(GameObject originator, Vector3 position, string hand) { metaTileMap = originator.GetComponentInParent <MetaTileMap>(); objectLayer = originator.GetComponentInParent <ObjectLayer>(); PlayerNetworkActions pna = originator.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(position).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseTileMap.WorldToCell(position); LayerTile tile = metaTileMap.GetTile(pos); GameObject handObj; //if we are client, our pna.Inventory is always empty so we should get the hand item a different way if (!isServer) { if (originator != PlayerManager.LocalPlayer) { Logger.LogError("Client is attempting to determine the tile actions of a player other than" + " themselves. This should not happen and should be fixed. Client should only determine their own" + " actions."); return(false); } else { handObj = UIManager.InventorySlots[hand].Item; } } else { handObj = pna.Inventory[hand].Item; } // Nothing in hand, do nothing if (handObj == null) { return(false); } if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = position; targetPosition.z = -0.2f; pna.CmdPlaceItem(hand, targetPosition, originator, true); return(true); } case TileType.Floor: { //Crowbar if (handObj.GetComponent <CrowbarTrigger>()) { pna.CmdCrowBarRemoveFloorTile(originator, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), position); return(true); } break; } case TileType.Base: { if (handObj.GetComponent <UniFloorTile>()) { pna.CmdPlaceFloorTile(originator, new Vector2(cellPos.x, cellPos.y), handObj); return(true); } break; } case TileType.Window: { //Check Melee: MeleeTrigger melee = windowTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Grill: { //Check Melee: MeleeTrigger melee = grillTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Wall: { Welder welder = handObj.GetComponent <Welder>(); if (welder) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(originator, gameObject, TileType.Wall, cellPos, position); return(true); } } break; } } } return(false); }
public void Awake() { playerNetworkActions = GetComponent <PlayerNetworkActions>(); registerPlayer = GetComponent <RegisterPlayer>(); }
private void Awake() { playerNetworkActions = GetComponent <PlayerNetworkActions>(); CacheDefinedSlots(); }
private void HandleInteraction(bool forItemInteract, string currentHand, PlayerNetworkActions pna) { pna.CmdToggleFireCabinet(gameObject, forItemInteract, currentHand); }
private void Awake() { networkIdentity = GetComponent <NetworkIdentity>(); playerNetworkActions = gameObject.GetComponent <PlayerNetworkActions>(); playerScript = gameObject.GetComponent <PlayerScript>(); }
public bool Interact(PositionalHandApply interaction) { if (!DefaultWillInteract.PositionalHandApply(interaction, NetworkSide.Client)) { return(false); } PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(interaction.WorldPositionTarget).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseLayer.WorldToCell(interaction.WorldPositionTarget); LayerTile tile = metaTileMap.GetTile(pos); if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = interaction.WorldPositionTarget; targetPosition.z = -0.2f; pna.CmdPlaceItem(interaction.HandSlot.equipSlot, targetPosition, interaction.Performer, true); return(true); } case TileType.Floor: { //Crowbar if (Validations.IsTool(interaction.HandObject, ToolType.Crowbar)) { pna.CmdCrowBarRemoveFloorTile(interaction.Performer, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), interaction.WorldPositionTarget); return(true); } break; } case TileType.Base: { if (Validations.HasComponent <UniFloorTile>(interaction.HandObject)) { pna.CmdPlaceFloorTile(interaction.Performer, new Vector2(cellPos.x, cellPos.y), interaction.HandObject); return(true); } break; } case TileType.Window: { //Check Melee: Meleeable melee = windowLayer.gameObject.GetComponent <Meleeable>(); if (melee != null && melee.Interact(PositionalHandApply.ByLocalPlayer(gameObject))) { return(true); } break; } case TileType.Grill: { //Check Melee: Meleeable melee = grillTileMap.gameObject.GetComponent <Meleeable>(); if (melee != null && melee.Interact(PositionalHandApply.ByLocalPlayer(gameObject))) { return(true); } break; } case TileType.Wall: { Welder welder = interaction.HandObject != null?interaction.HandObject.GetComponent <Welder>() : null; if (welder != null) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(interaction.Performer, gameObject, TileType.Wall, cellPos, interaction.WorldPositionTarget); return(true); } } break; } } } return(false); }
private bool DetermineTileAction(GameObject originator, Vector3 position, string hand) { metaTileMap = originator.GetComponentInParent <MetaTileMap>(); objectLayer = originator.GetComponentInParent <ObjectLayer>(); PlayerNetworkActions pna = originator.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(position).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseTileMap.WorldToCell(position); LayerTile tile = metaTileMap.GetTile(pos); GameObject handObj = UIManager.Hands.CurrentSlot.Item; // Nothing in hand, do nothing if (handObj == null) { return(false); } if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = position; targetPosition.z = -0.2f; pna.CmdPlaceItem(hand, targetPosition, originator, true); return(true); } case TileType.Floor: { //Crowbar if (handObj.GetComponent <CrowbarTrigger>()) { pna.CmdCrowBarRemoveFloorTile(originator, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), position); return(true); } break; } case TileType.Base: { if (handObj.GetComponent <UniFloorTile>()) { pna.CmdPlaceFloorTile(originator, new Vector2(cellPos.x, cellPos.y), handObj); return(true); } break; } case TileType.Window: { //Check Melee: MeleeTrigger melee = windowTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Grill: { //Check Melee: MeleeTrigger melee = grillTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Wall: { Welder welder = handObj.GetComponent <Welder>(); if (welder) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(originator, gameObject, TileType.Wall, cellPos, position); return(true); } } break; } } } return(false); }
public void ServerPerformInteraction(HandApply interaction) { PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); var handObj = interaction.HandObject; var playerPerformer = interaction.Performer; ConnectedPlayer currentPlayer = playerPerformer.Player(); //can click on the canister with a wrench to connect/disconnect it from a connector if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Wrench)) { if (isConnected) { SoundManager.PlayNetworkedAtPos("Wrench", registerTile.WorldPositionServer, 1f, sourceObj: gameObject); Disconnect(); return; } else { var foundConnectors = registerTile.Matrix.Get <Connector>(registerTile.LocalPositionServer, true); foreach (var conn in foundConnectors) { if (conn.ObjectBehavior.IsNotPushable) { SoundManager.PlayNetworkedAtPos("Wrench", registerTile.WorldPositionServer, 1f, sourceObj: gameObject); connector = conn; isConnected = true; connector.ConnectCanister(this); SetConnectedSprite(connectorSprite); objectBehaviour.ServerSetPushable(false); ServerOnConnectionStatusChange.Invoke(true); return; } } var foundFuelConnectors = registerTile.Matrix.Get <ShuttleFuelConnector>(registerTile.LocalPositionServer, true); foreach (var conn in foundFuelConnectors) { SoundManager.PlayNetworkedAtPos("Wrench", registerTile.WorldPositionServer, 1f, sourceObj: gameObject); isConnected = true; connectorFuel = conn; conn.ConnectCanister(this); SetConnectedSprite(connectorSprite); objectBehaviour.ServerSetPushable(false); ServerOnConnectionStatusChange.Invoke(true); } } } //can click on the canister with a refillable tank to insert the refillable tank into the canister if (Validations.HasItemTrait(handObj, CommonTraits.Instance.CanisterFillable)) { //don't insert a container if one is already present, lest we wipe out the previous container from existance if (!hasContainerInserted) { //always null check... always... if (handObj.GetComponent <GasContainer>() != null) { //copy the containers properties over, delete the container from the player's hand InsertedContainer = handObj; hasContainerInserted = true; Chat.AddActionMsgToChat(playerPerformer, $"You insert the {handObj.ExpensiveName()} into the canister.", $"{playerPerformer.ExpensiveName()} inserts a tank into the {this.ContentsName} tank."); Inventory.ServerDespawn(handObj); ServerOnExternalTankInserted.Invoke(true); } else { Logger.LogError("Player tried inserting a tank into a canister, but the tank didn't have a GasContainer " + "component associated with it. Something terrible has happened, or an item that should not " + "has the CanisterFillable ItemTrait."); } } else { Chat.AddExamineMsg(playerPerformer, "A tank is already inside this canister."); } } }
public void Awake() { playerNetworkActions = GetComponent <PlayerNetworkActions>(); registerPlayer = GetComponent <RegisterPlayer>(); Observers.Add(this.gameObject); }
void Start() { networkIdentity = GetComponent <NetworkIdentity>(); playerNetworkActions = gameObject.GetComponent <PlayerNetworkActions>(); playerScript = gameObject.GetComponent <PlayerScript>(); }