public static bool Prefix(PilotingChair __instance, GUIHand hand) { if (skipPrefix) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); SubRoot subRoot = __instance.GetComponentInParent <SubRoot>(); Validate.NotNull(subRoot, "PilotingChair cannot find it's corresponding SubRoot!"); NitroxId id = NitroxEntity.GetId(subRoot.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on the piloting chair: {id}"); return(true); } HandInteraction <PilotingChair> context = new HandInteraction <PilotingChair>(__instance, hand); LockRequest <HandInteraction <PilotingChair> > lockRequest = new LockRequest <HandInteraction <PilotingChair> >(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public static bool Prefix(DockedVehicleHandTarget __instance, GUIHand hand) { vehicleDockingBay = __instance.dockingBay; Vehicle vehicle = vehicleDockingBay.GetDockedVehicle(); if (skipPrefix || vehicle == null) { return(true); } dockedVehicle = __instance; guiHand = hand; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(vehicle.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on this vehicle: {id}"); return(true); } simulationOwnership.RequestSimulationLock(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse); return(false); }
public static bool Prefix(DockedVehicleHandTarget __instance, GUIHand hand) { Vehicle vehicle = __instance.dockingBay.GetDockedVehicle(); if (skipPrefix || vehicle == null) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(vehicle.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on this vehicle: {id}"); return(true); } HandInteraction <DockedVehicleHandTarget> context = new HandInteraction <DockedVehicleHandTarget>(__instance, hand); LockRequest <HandInteraction <DockedVehicleHandTarget> > lockRequest = new LockRequest <HandInteraction <DockedVehicleHandTarget> >(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public static bool Prefix(PilotingChair __instance, GUIHand hand) { if (skipPrefix) { return(true); } pilotingChair = __instance; guiHand = hand; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); SubRoot subRoot = __instance.GetComponentInParent <SubRoot>(); Validate.NotNull(subRoot, "PilotingChair cannot find it's corresponding SubRoot!"); string guid = GuidHelper.GetGuid(subRoot.gameObject); if (simulationOwnership.HasExclusiveLock(guid)) { Log.Debug($"Already have an exclusive lock on the piloting chair: {guid}"); return(true); } simulationOwnership.RequestSimulationLock(guid, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse); return(false); }
public static void Postfix(Bench __instance) { NitroxId id = NitroxEntity.GetId(__instance.gameObject); // Request to be downgraded to a transient lock so we can still simulate the positioning. simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT); localPlayer.AnimationChange(AnimChangeType.BENCH, AnimChangeState.UNSET); }
public static void Postfix(Bench __instance) { NitroxId id = NitroxEntity.GetId(__instance.gameObject); SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); // Request to be downgraded to a transient lock so we can still simulate the positioning. simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT); }
public static void Prefix(Vehicle __instance) { NitroxServiceLocator.LocateService <Vehicles>().BroadcastOnPilotModeChanged(__instance, false); NitroxId id = NitroxIdentifier.GetId(__instance.gameObject); SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT, null); }
public static void Postfix(Bench __instance) { NitroxId id = NitroxEntity.GetId(__instance.gameObject); // Request to be downgraded to a transient lock so we can still simulate the positioning. simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT); localPlayer.AnimationChange(AnimChangeType.BENCH, AnimChangeState.OFF); __instance.StartCoroutine(ResetAnimationDelayed(__instance.standUpCinematicController.interpolationTimeOut)); }
public static void Postfix(PilotingChair __instance) { SubRoot subRoot = __instance.GetComponentInParent <SubRoot>(); Validate.NotNull(subRoot, "PilotingChair cannot find it's corresponding SubRoot!"); NitroxId id = NitroxEntity.GetId(subRoot.gameObject); SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); // Request to be downgraded to a transient lock so we can still simulate the positioning. simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT); }
public static bool Prefix(PropulsionCannon __instance) { GameObject grabbed = __instance.grabbedObject; if (!grabbed) { return(false); } NitroxId id = NitroxEntity.GetId(grabbed); SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); // Request to be downgraded to a transient lock so we can still simulate the positioning. simulationOwnership.RequestSimulationLock(id, SimulationLockType.TRANSIENT); return(true); }
public static bool Prefix(Bench __instance, GUIHand hand) { if (skipPrefix) { return(true); } NitroxId id = NitroxEntity.GetId(__instance.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on the bench/chair: {id}"); return(true); } HandInteraction <Bench> context = new(__instance, hand); LockRequest <HandInteraction <Bench> > lockRequest = new(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public static bool Prefix(Vehicle __instance, GUIHand hand) { if (skipPrefix) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(__instance.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on the vehicle: {id}"); return(true); } HandInteraction <Vehicle> context = new(__instance, hand); LockRequest <HandInteraction <Vehicle> > lockRequest = new(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public static bool Prefix(Incubator __instance, GUIHand hand) { if (skipPrefix) { return(true); } // Request a simulation lock on the incubator so that we can authoritatively spawn the resulting creatures if (__instance.powered && !__instance.hatched && Inventory.main.container.Contains(TechType.HatchingEnzymes)) { SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); // the server only knows about the the main incubator platform which is the direct parent GameObject platform = __instance.gameObject.transform.parent.gameObject; NitroxId id = NitroxEntity.GetId(platform); HandInteraction <Incubator> context = new HandInteraction <Incubator>(__instance, hand); LockRequest <HandInteraction <Incubator> > lockRequest = new LockRequest <HandInteraction <Incubator> >(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); } return(false); }
public static bool Prefix(Vehicle __instance, GUIHand hand) { if (skipPrefix) { return(true); } vehicle = __instance; guiHand = hand; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); string guid = GuidHelper.GetGuid(__instance.gameObject); if (simulationOwnership.HasExclusiveLock(guid)) { Log.Debug($"Already have an exclusive lock on the vehicle: {guid}"); return(true); } simulationOwnership.RequestSimulationLock(guid, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse); return(false); }
public static bool Prefix(PropulsionCannon __instance, GameObject target) { if (skipPrefixPatch) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(target); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on the grabbed propulsion cannon object: {id}"); return(true); } PropulsionGrab context = new(__instance, target); LockRequest <PropulsionGrab> lockRequest = new(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }