public bool WillInteract(HandApply interaction, NetworkSide side) { if (!DefaultWillInteract.Default(interaction, side)) { return(false); } if (interaction.HandObject == null) { return(false); } if (interaction.TargetObject.Item() == null) { return(false); //Only works on items } //if(interaction.HandObject.Item().HasTrait(refillTrait)) return true; //Check for refill if (interaction.HandObject != gameObject) { return(false); } if (currentLabel.Trim().Length == 0) { if (side == NetworkSide.Client) { Chat.AddExamineMsgToClient("You haven't set a text yet."); } return(false); } return(true); }
private void OnExamine() { if (!string.IsNullOrEmpty(initialDescription)) { Chat.AddExamineMsgToClient(initialDescription); } }
private static IEnumerator SpamChatCoroutine() { if (!isSpamming) { yield break; } yield return(WaitFor.Seconds(Random.Range(0.00001f, 0.01f))); switch (Random.Range(1, 4)) { case 1: Chat.AddExamineMsgToClient(DateTime.Now.ToFileTimeUtc().ToString()); break; case 2: Chat.AddChatMsgToChat(ConnectedPlayer.Invalid, DateTime.Now.ToFileTimeUtc().ToString(), ChatChannel.OOC); break; default: Chat.AddLocalMsgToChat(DateTime.Now.ToFileTimeUtc().ToString(), new Vector2(Random.value * 100, Random.value * 100), null); break; } Chat.Instance.StartCoroutine(SpamChatCoroutine()); }
private static IEnumerator SpamChatCoroutine() { if (isSpamming == false) { yield break; } var fakePlayer = ConnectedPlayer.Invalid; fakePlayer.Username = "******"; yield return(WaitFor.Seconds(Random.Range(0.00001f, 0.01f))); switch (Random.Range(1, 4)) { case 1: Chat.AddExamineMsgToClient($"Examination: {DateTime.Now.ToFileTimeUtc()}"); break; case 2: Chat.AddChatMsgToChat(fakePlayer, DateTime.Now.ToFileTimeUtc().ToString(), ChatChannel.OOC, Loudness.NORMAL); break; default: Chat.AddLocalMsgToChat($"Local Message: {DateTime.Now.ToFileTimeUtc()}", new Vector2(Random.value * 100, Random.value * 100), null); break; } Chat.Instance.StartCoroutine(SpamChatCoroutine()); }
public void OnExamine() { string message = ""; message = "This is " + registeredName + "'s ID card\nThey are the " + JobType + " of the station!"; Chat.AddExamineMsgToClient(message); }
public void ServerPerformInteraction(PositionalHandApply interaction) { if (!Validations.IsTarget(gameObject, interaction)) { APCPoweredDevice PoweredDevice = interaction.TargetObject.GetComponent <APCPoweredDevice>(); if (PoweredDevice != null) { if (APCBuffer != null) { Chat.AddExamineMsgToClient("You set the power device to use the APC in the buffer"); PoweredDevice.SetAPC(APCBuffer); } else { Chat.AddExamineMsgToClient("Your buffer is empty fill it with something"); } } APC _APC = interaction.TargetObject.GetComponent <APC>(); if (_APC != null) { Chat.AddExamineMsgToClient("You set the internal buffer of the multitool to the APC"); APCBuffer = _APC; } } }
/// <summary> /// attempt to reload the weapon with the item given /// </summary> private void TryReload(GameObject item) { string hand; if (item != null) { MagazineBehaviour magazine = item.GetComponent <MagazineBehaviour>(); if (magazine) { if (CurrentMagazine == null) { //RELOAD // If the item used on the gun is a magazine, check type and reload string ammoType = magazine.ammoType; if (AmmoType == ammoType) { hand = UIManager.Hands.CurrentSlot.eventName; RequestReload(item, hand, true); } if (AmmoType != ammoType) { Chat.AddExamineMsgToClient("You try to load the wrong ammo into your weapon"); } } else if (AmmoType == magazine.ammoType) { Chat.AddExamineMsgToClient("You weapon is already loaded, you can't fit more Magazines in it, silly!"); } } } }
public void OnExamine() { var count = PaperCount(); var message = "It doesn't contain any paper."; if (count > 0) { if (count == 1) { message = "It contains one piece of paper."; } else if (count > 1) { message = "It contains " + count + " total pieces of paper."; } if (storedPen) { message += " A pen sits on top."; } } else if (storedPen) { message += " There is a pen inside."; } Chat.AddExamineMsgToClient(message); }
/// <summary> /// attempt to reload the weapon with the item given /// </summary> private bool TryReload(GameObject ammo) { MagazineBehaviour magazine = ammo.GetComponent <MagazineBehaviour>(); if (CurrentMagazine == null || (MagInternal && magazine.magType == MagType.Clip)) { //RELOAD // If the item used on the gun is a magazine, check type and reload AmmoType ammoType = magazine.ammoType; if (this.ammoType == ammoType) { return(true); } if (this.ammoType != ammoType) { Chat.AddExamineMsgToClient("You try to load the wrong ammo into your weapon"); return(false); } } else if (ammoType == magazine.ammoType) { Chat.AddExamineMsgToClient("Your weapon is already loaded, you can't fit more Magazines in it, silly!"); return(false); } return(false); }
public virtual void ClientPredictInteraction(AimApply interaction) { //do we need to check if this is a suicide (want to avoid the check because it involves a raycast). //case 1 - we are beginning a new shot, need to see if we are shooting ourselves //case 2 - we are firing an automatic and are currently shooting ourselves, need to see if we moused off // ourselves. var isSuicide = false; if (interaction.MouseButtonState == MouseButtonState.PRESS || (WeaponType != WeaponType.SemiAutomatic && AllowSuicide)) { isSuicide = interaction.IsAimingAtSelf; AllowSuicide = isSuicide; } var dir = ApplyRecoil(interaction.TargetVector.normalized); if (FiringPin != null) { bool canFire = FiringPin.TriggerPullClient(); if (canFire) { DisplayShot(PlayerManager.LocalPlayer, dir, UIManager.DamageZone, isSuicide, CurrentMagazine.containedBullets[0].name, CurrentMagazine.containedProjectilesFired[0]); } } else { Chat.AddExamineMsgToClient("The " + gameObject.ExpensiveName() + "'s trigger is locked. It doesn't have a firing pin installed!"); } }
public void TriggerPullClient(GameObject shotBy, Vector2 target, BodyPartType damageZone, bool isSuicideShot, string proj, int quant) { JobType job = PlayerList.Instance.Get(shotBy).Job; if (PlayerList.Instance.Get(shotBy).Job == setRestriction || (setRestriction == JobType.NULL && (job != JobType.CLOWN && allowNonClumsy || job == JobType.CLOWN && allowClumsy))) { gun.DisplayShot(shotBy, target, damageZone, isSuicideShot, proj, quant); } else if (setRestriction == JobType.NULL && (job == JobType.CLOWN && !allowClumsy)) { int chance = rnd.Next(0, 2); if (chance == 0) { gun.DisplayShot(shotBy, target, damageZone, true, proj, quant); } else { gun.DisplayShot(shotBy, target, damageZone, isSuicideShot, proj, quant); } } else if (setRestriction == JobType.NULL && (job != JobType.CLOWN && !allowNonClumsy)) { gun.DisplayShot(shotBy, target, damageZone, true, proj, quant); } else { Chat.AddExamineMsgToClient($"The {gameObject.ExpensiveName()} displays \'User authentication failed\'"); } }
/// <summary> /// Sends a player message to the server. /// The message is omitted if too many messages have been sent recently. /// The message is shortened if the player has send too many characters recently. /// In either case the player will see a warning in their chat log. /// </summary> /// <param name="message">The player's message.</param> /// <param name="selectedChannels">The selected channels, which are simply passed along.</param> public void Send(string message, ChatChannel selectedChannels) { print(numMessages); DecayFiltersOverTime(); // Decrease cpm and messages since last having spoken // Limit number of messages if (numMessages + 1 > numMessageMax || cpm + 1 > cpmMax) { if (selectedChannels.HasFlag(ChatChannel.OOC) || selectedChannels.HasFlag(ChatChannel.Ghost)) { Chat.AddExamineMsgToClient(numMessagesWarningOOC); } else { Chat.AddExamineMsgToClient(numMessagesWarning); } return; } // Users message will (at least partiall) be spoken, so count it. numMessages++; cpm += message.Length; // Limit characters per minute int numCharsOverLimit = 0; if (cpm > cpmMax) { // Too many characters, calculate how many need to be removed. float cpmOver = cpm - cpmMax; cpm = cpmMax; // Characters will be removed, so cpm must be lowered again. numCharsOverLimit = (int)Math.Floor(cpmOver); message = message.Remove(message.Length - numCharsOverLimit) + "..."; } // Don't send message if it got shortened below the limit. if (0 < numCharsOverLimit && numCharsOverLimit < cpmMinCharacters) { return; } // Send message, which might have been shortened because of the character limit per minute. PostToChatMessage.Send(message, selectedChannels); // Notify player that their message got cut short. if (numCharsOverLimit > 0) { if (selectedChannels.HasFlag(ChatChannel.OOC) || selectedChannels.HasFlag(ChatChannel.Ghost)) { Chat.AddExamineMsgToClient(cpmWarningOOC); } else { Chat.AddExamineMsgToClient(cpmWarning); } } }
/// <summary> /// Adds examine message to the client (if provided), clears the /// electrical connections list, and adds it to the electrical pool. /// </summary> /// <param name="eConnList">List of electrical connections. Will not add to electrical pool if null.</param> /// <param name="addMsg">Message to show as an examine message. Will not show anything if null.</param> private void MsgAndAddToPool(ElectricalPool.IntrinsicElectronicDataList eConnList, string msg) { if (msg != null) { Chat.AddExamineMsgToClient(msg); } eConnList?.Pool(); }
/// <summary> /// Called when player clicks Rest button /// </summary> public void OnClickRest() { Logger.Log("OnClickRest", Category.UserInput); SoundManager.Play(SingletonSOSounds.Instance.Click01); clientResting = !clientResting; Chat.AddExamineMsgToClient(restMessage); RequestRest.Send(clientResting); // TODO: trigger rest intent }
/// <summary> /// Called when player clicks Rest button /// </summary> public void OnClickRest() { Logger.Log("OnClickRest", Category.UI); SoundManager.Play(SingletonSOSounds.Instance.Click01); Chat.AddExamineMsgToClient(restMessage); // TODO: trigger rest intent }
/// <summary> /// Called when player clicks Rest button /// </summary> public void OnClickRest() { Logger.Log("OnClickRest", Category.UI); SoundManager.Play("Click01"); Chat.AddExamineMsgToClient(restMessage); // TODO: trigger rest intent }
/// <summary> /// Called when player clicks Run/Walk button /// </summary> public void OnClickRunWalk() { Logger.Log("OnClickRunWalk", Category.UI); SoundManager.Play(SingletonSOSounds.Instance.Click01); Running = !Running; runWalkBorder.SetActive(Running); Chat.AddExamineMsgToClient(Running ? startRunningMessage : startWalkingMessage); }
/// <summary> /// Called when player clicks Run/Walk button /// </summary> public void OnClickRunWalk() { Logger.Log("OnClickRunWalk", Category.UI); SoundManager.Play("Click01"); running = !running; runWalkBorder.SetActive(running); Chat.AddExamineMsgToClient(running ? startRunningMessage : startWalkingMessage); }
public void OnInputReceived(string input) { if (labelAmount == 0) { return; } Chat.AddExamineMsgToClient("You set the " + this.gameObject.Item().InitialName.ToLower() + "s text to '" + input + "'."); PlayerManager.LocalPlayerScript.playerNetworkActions.CmdRequestItemLabel(gameObject, input); StartCoroutine(WaitToAllowInput()); }
public uint Recipient; //fixme: Recipient is redundant! Can be safely removed public override void Process() { LoadNetworkObject(Recipient); ElectronicData data = JsonUtility.FromJson <ElectronicData>(JsonData); string newChatText = ""; newChatText += $"Current: {data.CurrentInWire} \n"; newChatText += $"Voltage: {data.ActualVoltage} \n"; newChatText += $"Resistance: {data.EstimatedResistance}"; Chat.AddExamineMsgToClient(newChatText); }
public bool Interact(HandActivate interaction) { if (isCan && capRemoved == false) { Chat.AddExamineMsgToClient("Need to remove the cap first"); return(false); } UIManager.Instance.CrayonUI.openingObject = gameObject; UIManager.Instance.CrayonUI.SetActive(true); return(true); }
public void ReadaptStrain() { if (clickedStrainIndex == null) { Chat.AddExamineMsgToClient("Select a strain to readapt into first"); return; } blobPlayer.CmdChangeStrain(clickedStrainIndex.Value); clickedStrainIndex = null; }
/// <summary> /// Adds examine message to the client (if provided), clears the /// electrical connections list, and adds it to the electrical pool. /// </summary> /// <param name="eConnList">List of electrical connections. Will not add to electrical pool if null.</param> /// <param name="addMsg">Message to show as an examine message. Will not show anything if null.</param> private void MsgAndAddToPool(ref List <IntrinsicElectronicData> eConnList, string msg) { if (msg != null) { Chat.AddExamineMsgToClient(msg); } if (eConnList != null) { eConnList.Clear(); ElectricalPool.PooledFPCList.Add(eConnList); } }
public void ServerChangeJobTitle(string newJobTitle) { if (newJobTitle.Length <= 32) { console.TargetCard.ServerSetJobTitle(newJobTitle); ServerRefreshCardNames(); } else { Chat.AddExamineMsgToClient($"Job title cannot exceed 32 characters!"); return; } }
public uint Recipient; //fixme: Recipient is redundant! Can be safely removed public override IEnumerator Process() { yield return(WaitFor(Recipient)); ElectronicData data = JsonUtility.FromJson <ElectronicData>(JsonData); string newChatText = ""; newChatText += $"Current: {data.CurrentInWire} \n"; newChatText += $"Voltage: {data.ActualVoltage} \n"; newChatText += $"Resistance: {data.EstimatedResistance}"; Chat.AddExamineMsgToClient(newChatText); }
private IEnumerator GhostRoleNotify(GhostRoleData role) { roleBtnAnimating = true; Chat.AddExamineMsgToClient($"<size=48>Ghost role <b>{role.Name}</b> is available!</size>"); SoundManager.Play(SingletonSOSounds.Instance.Notice2); ghostRoleAnimator.TriggerAnimation(); yield return(WaitFor.Seconds(5)); ghostRoleSpriteHandler.ChangeSprite(0, Network: false); roleBtnAnimating = false; }
public void TriggerEvent() { // Pull time from game manager and put it into a private holder variable which gets cleared on timeout and allows the button to be pressed again. Current WAIT time set to 5 secs stationTimeHolder = GameManager.Instance.stationTime; if (stationTimeHolder < (stationTimeSnapshot)) { // Tells all admins to wait X seconds, this is based on round time so if the server stutters loading an event it // will take it into account effectivly stopping any sort of spam. Chat.AddExamineMsgToClient($"Please wait {Mathf.Round((float)stationTimeSnapshot.Subtract(stationTimeHolder).TotalSeconds)} seconds before trying to generate another event."); return; } stationTimeSnapshot = stationTimeHolder.AddSeconds(5); if (!InGameEventType.TryParse(eventTypeDropDown.options[eventTypeDropDown.value].text, out InGameEventType eventType)) { return; } var index = nextDropDown.value; if (eventType == InGameEventType.Random) { index = 0; } if (index != 0) // Index 0 (Random Event) will never have a parameter page { // Instead of triggering the event right away, if we have an extra parameter page, we show it List <EventScriptBase> listEvents = InGameEventsManager.Instance.GetListFromEnum(eventType); if (listEvents[index - 1].parametersPageType != ParametersPageType.None) { GameObject parameterPage = eventsParametersPages.eventParameterPages .FirstOrDefault(p => p.ParametersPageType == listEvents[index - 1].parametersPageType) .ParameterPage; if (parameterPage) { parameterPage.SetActive(true); parameterPage.GetComponent <SicknessParametersPage>().SetBasicEventParameters(index, isFakeToggle.isOn, announceToggle.isOn, InGameEventType.Fun); return; } } } AdminCommandsManager.Instance.CmdTriggerGameEvent(index, isFakeToggle.isOn, announceToggle.isOn, eventType, null); }
public void OnExamine() { string message = ""; if (MiningPoints > 0) { message = "There's " + MiningPoints + " mining equipment redemption points loaded onto this card."; } else { message = "This is " + RegisteredName + "'s ID card\nThey are the " + GetJobType + " of the station!"; } Chat.AddExamineMsgToClient(message); }
// This is all client only interaction: public bool Interact(HandActivate interaction) { var slots = itemStorage.GetItemSlots(); if (canQuickEmpty) { // Drop all items that are inside this storage if (slots == null) { if (!CustomNetworkManager.Instance._isServer) { Chat.AddExamineMsgToClient("It's already empty!"); } return(false); } if (PlayerManager.PlayerScript == null) { return(false); } PlayerManager.PlayerScript.playerNetworkActions.CmdDropAllItems(itemStorage.GetIndexedItemSlot(0) .ItemStorageNetID, TransformState.HiddenPos); if (CustomNetworkManager.Instance._isServer == false) { Chat.AddExamineMsgToClient($"You start dumping out the {gameObject.ExpensiveName()}."); } return(true); } interaction.PerformerPlayerScript.playerNetworkActions.CmdTriggerStorageTrap(gameObject); // open / close the backpack on activate if (UIManager.StorageHandler.CurrentOpenStorage != itemStorage) { UIManager.StorageHandler.OpenStorageUI(itemStorage); } else { UIManager.StorageHandler.CloseStorageUI(); } return(true); }
public void ToggleLights() { if (aiPlayer.OnCoolDown(NetworkSide.Client)) { return; } aiPlayer.StartCoolDown(NetworkSide.Client); if (aiPlayer.CoreCamera == null) { Chat.AddExamineMsgToClient("Unable to change light state when not in core"); return; } aiPlayer.CmdToggleCameraLights(!aiPlayer.CoreCamera.LightOn); }