public void ServerPerformInteraction(AiActivate interaction) { if (isLocked) { Chat.AddExamineMsgFromServer(interaction.Performer, "The emitter has been locked"); return; } if (isOn) { Chat.AddExamineMsgFromServer(interaction.Performer, "You turn the emitter off"); TogglePower(false); } else if (isWelded) { Chat.AddExamineMsgFromServer(interaction.Performer, "You turn the emitter on"); TogglePower(true); } else { Chat.AddExamineMsgFromServer(interaction.Performer, "The emitter has not been set up"); } }
public bool WillInteract(AiActivate interaction, NetworkSide side) { if (interaction.ClickType != AiActivate.ClickTypes.NormalClick) { return(false); } if (DefaultWillInteract.AiActivate(interaction, side) == false) { return(false); } if (isInCoolDown) { return(false); } //Trigger client cooldown only, or else it will break for local host if (CustomNetworkManager.IsServer == false) { StartCoroutine(SwitchCoolDown()); } return(true); }
public void ServerPerformInteraction(AiActivate interaction) { switch (interaction.ClickType) { //StopTimer case AiActivate.ClickTypes.CtrlClick: currentTimerSeconds = 0; break; //AddTime case AiActivate.ClickTypes.NormalClick: if (!countingDown) { StartCoroutine(TickTimer()); } currentTimerSeconds += 60; break; //RemoveTime case AiActivate.ClickTypes.ShiftClick: currentTimerSeconds -= 60; if (currentTimerSeconds < 0) { currentTimerSeconds = 0; } break; default: break; } }
public bool WillInteract(AiActivate interaction, NetworkSide side) { if (DefaultWillInteract.AiActivate(interaction, side) == false) { return(false); } return(true); }
//Ai interaction public override void AiInteraction(AiActivate interaction) { if (interaction.ClickType == AiActivate.ClickTypes.AltClick) { operatingMode = operatingMode.Next(); } else { isTurnedOn = !isTurnedOn; } UpdateState(); }
public bool WillInteract(AiActivate interaction, NetworkSide side) { if (interaction.ClickType != AiActivate.ClickTypes.NormalClick) { return(false); } if (DefaultWillInteract.AiActivate(interaction, side) == false) { return(false); } return(true); }
public override void AiInteraction(AiActivate interaction) { if (interaction.ClickType == AiActivate.ClickTypes.NormalClick) { TabUpdateMessage.Send(interaction.Performer, gameObject, NetTabType.ThermoMachine, TabAction.Open); return; } if (interaction.ClickType == AiActivate.ClickTypes.AltClick) { targetTemperature = type == HeaterFreezerType.Heater ? maxTemperature : minTemperature; UpdateGui(); } }
private void CheckForInteractions(AiActivate.ClickTypes clickType) { var handApplyTargets = MouseUtils.GetOrderedObjectsUnderMouse(); //go through the stack of objects and call AiActivate interaction components we find foreach (GameObject applyTarget in handApplyTargets) { var behaviours = applyTarget.GetComponents <IBaseInteractable <AiActivate> >() .Where(mb => mb != null && (mb as MonoBehaviour).enabled); var aiActivate = new AiActivate(gameObject, null, applyTarget, Intent.Help, clickType); InteractionUtils.ClientCheckAndTrigger(behaviours, aiActivate); } }
public void ServerPerformInteraction(AiActivate interaction) { if (interaction.ClickType == AiActivate.ClickTypes.CtrlClick) { ResetTimer(); } else if (interaction.ClickType == AiActivate.ClickTypes.NormalClick) { AddTime(60); } else if (interaction.ClickType == AiActivate.ClickTypes.ShiftClick) { RemoveTime(60); } }
//Ai interaction public bool WillInteract(AiActivate interaction, NetworkSide side) { //Only alt and normal are used so dont need to check others, change if needed in the future if (interaction.ClickType != AiActivate.ClickTypes.NormalClick && interaction.ClickType != AiActivate.ClickTypes.AltClick) { return(false); } if (DefaultWillInteract.AiActivate(interaction, side) == false) { return(false); } return(true); }
public void ServerPerformInteraction(AiActivate interaction) { foreach (var validateNetTab in GetComponents <ICanOpenNetTab>()) { if (validateNetTab.CanOpenNetTab(interaction.Performer, NetTabType)) { continue; } //If false block net tab opening return; } playerInteracted = interaction.Performer; TabUpdateMessage.Send(interaction.Performer, gameObject, NetTabType, TabAction.Open); }
public void ServerPerformInteraction(AiActivate interaction) { //Start server cooldown StartCoroutine(SwitchCoolDown()); TryInteraction(); }
public void ServerPerformInteraction(AiActivate interaction) { InternalToggleState(); }
public void ServerPerformInteraction(AiActivate interaction) { isOn = !isOn; UpdateServerState(); }
//Ai interaction public override void AiInteraction(AiActivate interaction) { TabUpdateMessage.Send(interaction.Performer, gameObject, NetTabType.Mixer, TabAction.Open); }
public void ServerPerformInteraction(AiActivate interaction) { RunDoorController(); RpcPlayButtonAnim(true); }
public override void Process(NetMessage msg) { var ComponentType = msg.ComponentType; var InteractionType = msg.InteractionType; var ProcessorObject = msg.ProcessorObject; var Intent = msg.Intent; var TargetObject = msg.TargetObject; var UsedObject = msg.UsedObject; var TargetBodyPart = msg.TargetBodyPart; var TargetVector = msg.TargetVector; var MouseButtonState = msg.MouseButtonState; var IsAltUsed = msg.IsAltUsed; var Storage = msg.Storage; var SlotIndex = msg.SlotIndex; var NamedSlot = msg.NamedSlot; var connectionPointA = msg.connectionPointA; var connectionPointB = msg.connectionPointB; var RequestedOption = msg.RequestedOption; var performer = SentByPlayer.GameObject; if (SentByPlayer == null || SentByPlayer.Script == null) { return; } if (SentByPlayer.Script.DynamicItemStorage == null) { if (InteractionType == typeof(AiActivate)) { LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject }); var targetObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; var interaction = new AiActivate(performer, null, targetObj, Intent, msg.ClickTypes); ProcessInteraction(interaction, processorObj, ComponentType); } return; } if (InteractionType == typeof(PositionalHandApply)) { //look up item in active hand slot var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot().ItemObject; LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject }); var targetObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; CheckMatrixSync(ref targetObj); CheckMatrixSync(ref processorObj); var interaction = PositionalHandApply.ByClient(performer, usedObject, targetObj, TargetVector, usedSlot, Intent, TargetBodyPart); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(HandApply)) { var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot()?.ItemObject; LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject }); var targetObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; CheckMatrixSync(ref targetObj); CheckMatrixSync(ref processorObj); var interaction = HandApply.ByClient(performer, usedObject, targetObj, TargetBodyPart, usedSlot, Intent, IsAltUsed); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(AimApply)) { var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot().ItemObject; LoadNetworkObject(ProcessorObject); var processorObj = NetworkObject; CheckMatrixSync(ref processorObj); var interaction = AimApply.ByClient(performer, TargetVector, usedObject, usedSlot, MouseButtonState, Intent); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(MouseDrop)) { LoadMultipleObjects(new uint[] { UsedObject, TargetObject, ProcessorObject }); var usedObj = NetworkObjects[0]; var targetObj = NetworkObjects[1]; var processorObj = NetworkObjects[2]; CheckMatrixSync(ref targetObj); CheckMatrixSync(ref processorObj); var interaction = MouseDrop.ByClient(performer, usedObj, targetObj, Intent); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(HandActivate)) { LoadNetworkObject(ProcessorObject); var processorObj = NetworkObject; CheckMatrixSync(ref processorObj); var performerObj = SentByPlayer.GameObject; //look up item in active hand slot var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot().ItemObject; var interaction = HandActivate.ByClient(performer, usedObject, usedSlot, Intent); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(InventoryApply)) { LoadMultipleObjects(new uint[] { ProcessorObject, UsedObject, Storage }); var processorObj = NetworkObjects[0]; var usedObj = NetworkObjects[1]; var storageObj = NetworkObjects[2]; CheckMatrixSync(ref processorObj); ItemSlot targetSlot = null; if (SlotIndex == -1) { targetSlot = ItemSlot.GetNamed(storageObj.GetComponents <ItemStorage>()[msg.StorageIndexOnGameObject], NamedSlot); } else { targetSlot = ItemSlot.GetIndexed(storageObj.GetComponents <ItemStorage>()[msg.StorageIndexOnGameObject], SlotIndex); } //if used object is null, then empty hand was used ItemSlot fromSlot = null; if (usedObj == null) { fromSlot = SentByPlayer.Script.DynamicItemStorage.GetActiveHandSlot(); } else { fromSlot = usedObj.GetComponent <Pickupable>().ItemSlot; } var interaction = InventoryApply.ByClient(performer, targetSlot, fromSlot, Intent, IsAltUsed); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(TileApply)) { var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot().ItemObject; LoadNetworkObject(ProcessorObject); var processorObj = NetworkObject; CheckMatrixSync(ref processorObj); processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject, TargetVector, processorObj, usedSlot, usedObject, Intent, TileApply.ApplyType.HandApply); } else if (InteractionType == typeof(TileMouseDrop)) { LoadMultipleObjects(new uint[] { UsedObject, ProcessorObject }); var usedObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; CheckMatrixSync(ref processorObj); processorObj.GetComponent <InteractableTiles>().ServerProcessInteraction(SentByPlayer.GameObject, TargetVector, processorObj, null, usedObj, Intent, TileApply.ApplyType.MouseDrop); } else if (InteractionType == typeof(ConnectionApply)) { //look up item in active hand slot var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedSlot = clientStorage.GetActiveHandSlot(); var usedObject = clientStorage.GetActiveHandSlot().ItemObject; LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject }); var targetObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; CheckMatrixSync(ref targetObj); CheckMatrixSync(ref processorObj); var interaction = ConnectionApply.ByClient(performer, usedObject, targetObj, connectionPointA, connectionPointB, TargetVector, usedSlot, Intent); ProcessInteraction(interaction, processorObj, ComponentType); } else if (InteractionType == typeof(ContextMenuApply)) { LoadMultipleObjects(new uint[] { TargetObject, ProcessorObject }); var clientStorage = SentByPlayer.Script.DynamicItemStorage; var usedObj = clientStorage.GetActiveHandSlot().ItemObject; var targetObj = NetworkObjects[0]; var processorObj = NetworkObjects[1]; CheckMatrixSync(ref targetObj); CheckMatrixSync(ref processorObj); var interaction = ContextMenuApply.ByClient(performer, usedObj, targetObj, RequestedOption, Intent); ProcessInteraction(interaction, processorObj, ComponentType); } }
/// <summary> /// Default WillInteract logic for AiActivate interactions /// </summary> public static bool AiActivate(AiActivate interaction, NetworkSide side, bool lineCast = true) { return(Validations.CanApply(interaction, side, lineCast)); }
public void ServerPerformInteraction(AiActivate interaction) { ToggleSwitch(); }
public void ServerPerformInteraction(AiActivate interaction) { AiInteraction(interaction); }
public virtual void AiInteraction(AiActivate interaction) { }
public void ServerPerformInteraction(AiActivate interaction) { Chat.AddExamineMsgFromServer(interaction.Performer, ReadMeter()); }
public void ServerPerformInteraction(AiActivate interaction) { ServerToggleOutputMode(); }
//Ai interaction public override void AiInteraction(AiActivate interaction) { ToggleState(); }