public void BroadcastArmAction(TechType techType, IExosuitArm exosuitArm, ExosuitArmAction armAction) { NitroxId id = NitroxEntity.GetId(exosuitArm.GetGameObject()); ExosuitArmActionPacket packet = new ExosuitArmActionPacket(techType, id, armAction, Optional <Vector3> .Empty(), Optional <Quaternion> .Empty()); packetSender.Send(packet); }
public void BroadcastArmAction(TechType techType, IExosuitArm exosuitArm, ExosuitArmAction armAction, Vector3?opVector, Quaternion?opRotation) { NitroxId id = NitroxEntity.GetId(exosuitArm.GetGameObject()); ExosuitArmActionPacket packet = new ExosuitArmActionPacket(techType, id, armAction, opVector, opRotation); packetSender.Send(packet); }
public void BroadcastArmAction(TechType techType, IExosuitArm exosuitArm, ExosuitArmAction armAction) { NitroxId id = NitroxEntity.GetId(exosuitArm.GetGameObject()); ExosuitArmActionPacket packet = new ExosuitArmActionPacket(techType, id, armAction, null, null); packetSender.Send(packet); }
public void BroadcastArmAction(TechType techType, IExosuitArm exosuitArm, ExosuitArmAction armAction, Optional <Vector3> opVector = null, Optional <Quaternion> opRotation = null) { string guid = GuidHelper.GetGuid(exosuitArm.GetGameObject()); ExosuitArmActionPacket packet = new ExosuitArmActionPacket(techType, guid, armAction, opVector, opRotation); packetSender.Send(packet); }
public void BroadcastArmAction(TechType techType, IExosuitArm exosuitArm, ExosuitArmAction armAction, Optional <Vector3> opVector = null, Optional <Quaternion> opRotation = null) { NitroxId id = NitroxIdentifier.GetId(exosuitArm.GetGameObject()); ExosuitArmActionPacket packet = new ExosuitArmActionPacket(techType, id, armAction, opVector, opRotation); packetSender.Send(packet); }
public void UseTorpedo(ExosuitTorpedoArm torpedoArm, ExosuitArmAction armAction, Optional <Vector3> opVector, Optional <Quaternion> opRotation) { if (armAction == ExosuitArmAction.startUseTool || armAction == ExosuitArmAction.altHit) { if (opVector.IsEmpty() || opRotation.IsEmpty()) { Log.Error("Torpedo arm action shoot: no vector or rotation present"); return; } Vector3 forward = opVector.Get(); Quaternion rotation = opRotation.Get(); Transform silo = default(Transform); if (armAction == ExosuitArmAction.startUseTool) { silo = torpedoArm.siloFirst; } else { silo = torpedoArm.siloSecond; } ItemsContainer container = (ItemsContainer)torpedoArm.ReflectionGet("container"); Exosuit exosuit = torpedoArm.GetComponentInParent <Exosuit>(); TorpedoType[] torpedoTypes = exosuit.torpedoTypes; TorpedoType torpedoType = null; for (int i = 0; i < torpedoTypes.Length; i++) { if (container.Contains(torpedoTypes[i].techType)) { torpedoType = torpedoTypes[i]; break; } } // Copied from SeamothModuleActionProcessor. We need to synchronize both methods GameObject gameObject = UnityEngine.Object.Instantiate(torpedoType.prefab); Transform component = gameObject.GetComponent <Transform>(); SeamothTorpedo component2 = gameObject.GetComponent <SeamothTorpedo>(); Vector3 zero = Vector3.zero; Rigidbody componentInParent = silo.GetComponentInParent <Rigidbody>(); Vector3 rhs = (!(componentInParent != null)) ? Vector3.zero : componentInParent.velocity; float speed = Vector3.Dot(forward, rhs); component2.Shoot(silo.position, rotation, speed, -1f); torpedoArm.animator.SetBool("use_tool", true); if (container.count == 0) { Utils.PlayFMODAsset(torpedoArm.torpedoDisarmed, torpedoArm.transform, 1f); } } else if (armAction == ExosuitArmAction.endUseTool) { torpedoArm.animator.SetBool("use_tool", false); } else { Log.Error("Torpedo arm got an arm action he should not get: " + armAction); } }
public ExosuitArmActionPacket(TechType techType, NitroxId armId, ExosuitArmAction armAction, Vector3?opVector, Quaternion?opRotation) { TechType = techType; ArmId = armId; ArmAction = armAction; OpVector = opVector; OpRotation = opRotation; }
public void UseClaw(ExosuitClawArm clawArm, ExosuitArmAction armAction) { if (armAction == ExosuitArmAction.startUseTool) { clawArm.animator.SetTrigger("use_tool"); } else if (armAction == ExosuitArmAction.altHit) { clawArm.animator.SetTrigger("bash"); clawArm.fxControl.Play(0); } }
public void UseClaw(ExosuitClawArm clawArm, ExosuitArmAction armAction) { if (armAction == ExosuitArmAction.START_USE_TOOL) { clawArm.animator.SetTrigger("use_tool"); } else if (armAction == ExosuitArmAction.ALT_HIT) { clawArm.animator.SetTrigger("bash"); clawArm.fxControl.Play(0); } }
public ExosuitArmActionPacket(TechType techType, NitroxId armId, ExosuitArmAction armAction, Optional <Vector3> opVector = null, Optional <Quaternion> opRotation = null) { TechType = techType; ArmId = armId; ArmAction = armAction; OpVector = opVector; if (OpVector == null) { OpVector = Optional <Vector3> .Empty(); } OpRotation = opRotation; if (OpRotation == null) { OpRotation = Optional <Quaternion> .Empty(); } }
public void UseDrill(ExosuitDrillArm drillArm, ExosuitArmAction armAction) { if (armAction == ExosuitArmAction.startUseTool) { drillArm.animator.SetBool("use_tool", true); drillArm.loop.Play(); } else if (armAction == ExosuitArmAction.endUseTool) { drillArm.animator.SetBool("use_tool", false); drillArm.ReflectionCall("StopEffects"); } else { Log.Error("Drill arm got an arm action he should not get: " + armAction); } }
public void UseDrill(ExosuitDrillArm drillArm, ExosuitArmAction armAction) { if (armAction == ExosuitArmAction.START_USE_TOOL) { drillArm.animator.SetBool("use_tool", true); drillArm.loop.Play(); } else if (armAction == ExosuitArmAction.END_USE_TOOL) { drillArm.animator.SetBool("use_tool", false); drillArm.StopEffects(); } else { Log.Error("Drill arm got an arm action he should not get: " + armAction); } }
public static void Prefix(ExosuitTorpedoArm __instance, bool __result, TorpedoType torpedoType, Transform siloTransform) { if (torpedoType != null) { ExosuitArmAction action = ExosuitArmAction.START_USE_TOOL; if (siloTransform == __instance.siloSecond) { action = ExosuitArmAction.ALT_HIT; } if (siloTransform != __instance.siloFirst && siloTransform != __instance.siloSecond) { Log.Error("Exosuit torpedo arm siloTransform is not first or second silo " + NitroxEntity.GetId(__instance.gameObject)); } NitroxServiceLocator.LocateService <ExosuitModuleEvent>().BroadcastArmAction(TechType.ExosuitTorpedoArmModule, __instance, action, Player.main.camRoot.GetAimingTransform().forward, Player.main.camRoot.GetAimingTransform().rotation ); } }
public static void Prefix(ExosuitTorpedoArm __instance, bool __result, TorpedoType torpedoType, Transform siloTransform) { if (torpedoType != null) { ExosuitArmAction action = ExosuitArmAction.startUseTool; if (siloTransform == __instance.siloSecond) { action = ExosuitArmAction.altHit; } if (siloTransform != __instance.siloFirst && siloTransform != __instance.siloSecond) { Log.Error("Exosuit torpedo arm siloTransform is not first or second silo " + NitroxIdentifier.GetId(__instance.gameObject)); } NitroxServiceLocator.LocateService <ExosuitModuleEvent>().BroadcastArmAction(TechType.ExosuitTorpedoArmModule, __instance, action, Optional <Vector3> .Of(Player.main.camRoot.GetAimingTransform().forward), Optional <Quaternion> .Of(Player.main.camRoot.GetAimingTransform().rotation) ); } }
public void UseGrappling(ExosuitGrapplingArm grapplingArm, ExosuitArmAction armAction, Optional <Vector3> opHitVector) { if (armAction == ExosuitArmAction.endUseTool) { grapplingArm.animator.SetBool("use_tool", false); grapplingArm.ReflectionCall("ResetHook"); } else if (armAction == ExosuitArmAction.startUseTool) { grapplingArm.animator.SetBool("use_tool", true); if (!grapplingArm.rope.isLaunching) { grapplingArm.rope.LaunchHook(35f); } GrapplingHook hook = (GrapplingHook)grapplingArm.ReflectionGet("hook"); hook.transform.parent = null; hook.transform.position = grapplingArm.front.transform.position; hook.SetFlying(true); Exosuit componentInParent = grapplingArm.GetComponentInParent <Exosuit>(); if (opHitVector.IsEmpty()) { Log.Error("No vector given that contains the hook direction"); return; } hook.rb.velocity = opHitVector.Get(); global::Utils.PlayFMODAsset(grapplingArm.shootSound, grapplingArm.front, 15f); grapplingArm.ReflectionSet("grapplingStartPos", componentInParent.transform.position); } else { Log.Error("Grappling arm got an arm action he should not get: " + armAction); } }
public void UseGrappling(ExosuitGrapplingArm grapplingArm, ExosuitArmAction armAction, Vector3?opHitVector) { if (armAction == ExosuitArmAction.END_USE_TOOL) { grapplingArm.animator.SetBool("use_tool", false); grapplingArm.ResetHook(); } else if (armAction == ExosuitArmAction.START_USE_TOOL) { grapplingArm.animator.SetBool("use_tool", true); if (!grapplingArm.rope.isLaunching) { grapplingArm.rope.LaunchHook(35f); } GrapplingHook hook = grapplingArm.hook; hook.transform.parent = null; hook.transform.position = grapplingArm.front.transform.position; hook.SetFlying(true); Exosuit componentInParent = grapplingArm.GetComponentInParent <Exosuit>(); if (!opHitVector.HasValue) { Log.Error("No vector given that contains the hook direction"); return; } hook.rb.velocity = opHitVector.Value; Utils.PlayFMODAsset(grapplingArm.shootSound, grapplingArm.front, 15f); grapplingArm.grapplingStartPos = componentInParent.transform.position; } else { Log.Error("Grappling arm got an arm action he should not get: " + armAction); } }