// Use this for initialization void Start() { obstacleParent = new GameObject("Obstacle Pool"); obstacleParent.SetActive(false); activeChunksParent = new GameObject("Active Chunk Pool"); ventParent = new GameObject("Vent Pool"); ventParent.SetActive(false); currentSpeed = levelSpeed; //Fill the Obstacle Pool obstaclePool = new List <Obstacle>(); activeObstacles = new List <Obstacle>(); for (int i = 0; i < obstaclePrefabs.Length; i++) { for (int j = 0; j < 15; j++) { Obstacle obs = Instantiate(obstaclePrefabs[i]) as Obstacle; obs.transform.parent = obstacleParent.transform; obstaclePool.Add(obs); } } //Fill the Vent Pool ventPool = new List <Vent>(); activeVents = new List <Vent>(); for (int i = 0; i < 15; i++) { Vent vent = Instantiate(ventPrefabs[0]) as Vent; vent.transform.parent = ventParent.transform; ventPool.Add(vent); } //Spawn the Level Chunks BuildLevel(); }
public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { float num = float.MaxValue; PlayerControl localPlayer = pc.Object; switch (UnknownImpostor.WhoCanVent.GetValue()) { case 0: // Nobody couldUse = false; break; case 1: // Impostors couldUse = localPlayer.Data.IsImpostor && !localPlayer.Data.IsDead; break; case 2: // Everyone couldUse = !localPlayer.Data.IsDead; break; default: couldUse = false; break; } canUse = couldUse; num = Vector2.Distance(localPlayer.GetTruePosition(), __instance.transform.position); canUse &= num <= __instance.UsableDistance; __result = num; return(false); }
public static bool Prefix(Vent __instance, PlayerControl NMEAPOJFNKA) { PlayerControl pc = NMEAPOJFNKA; if (!__instance.ExitVentAnim) { return(false); } var truePosition = PlayerControl.LocalPlayer.GetTruePosition(); Vector2 vector = pc.GetTruePosition() - truePosition; var magnitude = vector.magnitude; if (pc.AmOwner || magnitude < PlayerControl.LocalPlayer.myLight.LightRadius && !PhysicsHelpers.AnyNonTriggersBetween(truePosition, vector.normalized, magnitude, ShipAndObjectsMask)) { __instance.GetComponent <SpriteAnim>().Play(__instance.ExitVentAnim, 1f); } if (pc.AmOwner && Constants.Method_3()) //ShouldPlaySfx { SoundManager.Instance.StopSound(ShipStatus.Instance.VentEnterSound); SoundManager.Instance.PlaySound(ShipStatus.Instance.VentEnterSound, false, 1f).pitch = UnityEngine.Random.Range(0.8f, 1.2f); } return(false); }
public static void FindObjects() { var ventsList = Object.FindObjectsOfType <Vent>().ToList(); if (ReactorVent == null) { ReactorVent = ventsList.Find(vent => vent.gameObject.name == "ReactorVent"); } if (ShieldsVent == null) { ShieldsVent = ventsList.Find(vent => vent.gameObject.name == "ShieldsVent"); } if (BigYVent == null) { BigYVent = ventsList.Find(vent => vent.gameObject.name == "BigYVent"); } if (NavVentNorth == null) { NavVentNorth = ventsList.Find(vent => vent.gameObject.name == "NavVentNorth"); } if (CafeVent == null) { CafeVent = ventsList.Find(vent => vent.gameObject.name == "CafeVent"); } IsObjectsFetched = ReactorVent != null && ShieldsVent != null && BigYVent != null && NavVentNorth != null && CafeVent != null; }
public static void Postfix(Vent __instance, [HarmonyArgument(0)] GameData.PlayerInfo playerInfo) { if (playerInfo.Object.Is(RoleEnum.Engineer)) { playerInfo.IsImpostor = false; } }
public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { float num = float.MaxValue; PlayerControl localPlayer = pc.Object; switch (Glaucus.WhoCanVent.GetValue()) { case 0: // Nobody couldUse = false; break; case 1: // Impostors couldUse = localPlayer.Data.IsImpostor && !localPlayer.Data.IsDead; break; case 2: // Everyone couldUse = !localPlayer.Data.IsDead; break; default: couldUse = false; break; } canUse = couldUse; if ((DateTime.UtcNow - PlayerVentTimeExtension.GetLastVent(pc.Object.PlayerId)).TotalMilliseconds > 1000) { num = Vector2.Distance(localPlayer.GetTruePosition(), __instance.transform.position); canUse &= num <= __instance.UsableDistance; } __result = num; return(false); }
private static void Postfix(GasVentHighPressureConfig __instance, GameObject go, Tag prefab_tag) { Debug.Log(" === VentPressureMod_GasVentConfig_ConfigureBuildingTemplate Postfix === "); Vent vent = go.GetComponent <Vent>(); VentPressureState.StateManager.State.MaximumPressure.TryGetValue("GasVentHighPressure", out vent.overpressureMass); }
private static void SpawnVent(PlayerControl sender, int id, Vector2 position, float zAxis, int leftVent, int centerVent, int rightVent) { var realPos = new Vector3(position.x, position.y, zAxis); var ventPref = Object.FindObjectOfType <Vent>(); var vent = Object.Instantiate(ventPref, ventPref.transform.parent); vent.Id = id; vent.transform.position = realPos; vent.Left = leftVent == int.MaxValue ? null : ShipStatus.Instance.AllVents.FirstOrDefault(v => v.Id == leftVent); vent.Center = centerVent == int.MaxValue ? null : ShipStatus.Instance.AllVents.FirstOrDefault(v => v.Id == centerVent); vent.Right = rightVent == int.MaxValue ? null : ShipStatus.Instance.AllVents.FirstOrDefault(v => v.Id == rightVent); var allVents = ShipStatus.Instance.AllVents.ToList(); allVents.Add(vent); ShipStatus.Instance.AllVents = allVents.ToArray(); if (vent.Left != null) { vent.Left.Right = ShipStatus.Instance.AllVents.FirstOrDefault(v => v.Id == id); } if (sender.AmOwner) { lastVent = vent; } }
public void submitTemperatureRequest(Vent vent) { this.vent = vent; Window ventWindow = new TemperatureForm(this); ventWindow.ShowDialog(); }
public static void securityGuardSetTarget() { if (SecurityGuard.securityGuard == null || SecurityGuard.securityGuard != PlayerControl.LocalPlayer || ShipStatus.Instance == null || ShipStatus.Instance.AllVents == null) { return; } Vent target = null; Vector2 truePosition = PlayerControl.LocalPlayer.GetTruePosition(); float closestDistance = float.MaxValue; for (int i = 0; i < ShipStatus.Instance.AllVents.Length; i++) { Vent vent = ShipStatus.Instance.AllVents[i]; if (vent.gameObject.name.StartsWith("JackInTheBoxVent_") || vent.gameObject.name.StartsWith("SealedVent_") || vent.gameObject.name.StartsWith("FutureSealedVent_")) { continue; } float distance = Vector2.Distance(vent.transform.position, truePosition); if (distance <= vent.UsableDistance && distance < closestDistance) { closestDistance = distance; target = vent; } } SecurityGuard.ventTarget = target; }
public TemperatureController(Vent vent) { this.vent = vent; Window ventWindow = new TemperatureForm(this); ventWindow.ShowDialog(); }
public static bool Vent_CanUse(Vent __instance, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse, ref float __result) { BaseRole?role = PlayerControl.LocalPlayer.GetRole(); if (role == null) { return(true); } couldUse = canUse = role.CanVent(__instance); __result = float.MaxValue; if (canUse) { Vector2 myPos = PlayerControl.LocalPlayer.GetTruePosition(); Vector3 ventPos = __instance.transform.position; __result = Vector2.Distance(myPos, ventPos); canUse &= __result <= __instance.UsableDistance && !PhysicsHelpers.AnythingBetween(myPos, ventPos, Constants.ShipOnlyMask, false); } return(false); }
private void TriggerPagination() { Vent.Trigger(new PaginationEvent { Key = ventKey, AdvancePages = advancePages }); }
public bool PostBuild() { foreach (var targetData in targetDb) { Vent vent = ventDb[targetData.Key]; long[] targets = targetData.Value; if (targets.Length < 3) { continue; } if (ventDb.ContainsKey(targets[0])) { vent.Right = ventDb[targets[0]]; } if (ventDb.ContainsKey(targets[1])) { vent.Left = ventDb[targets[1]]; } if (ventDb.ContainsKey(targets[2])) { vent.Center = ventDb[targets[2]]; } } return(true); }
// -------------------- // - Objects Fetching - // -------------------- public static void FindVents() { var ventsList = Object.FindObjectsOfType <Vent>().ToList(); if (ElectricBuildingVent == null) { ElectricBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ElectricBuildingVent"); } if (ElectricalVent == null) { ElectricalVent = ventsList.Find(vent => vent.gameObject.name == "ElectricalVent"); } if (ScienceBuildingVent == null) { ScienceBuildingVent = ventsList.Find(vent => vent.gameObject.name == "ScienceBuildingVent"); } if (StorageVent == null) { StorageVent = ventsList.Find(vent => vent.gameObject.name == "StorageVent"); } IsVentsFetched = ElectricBuildingVent != null && ElectricalVent != null && ScienceBuildingVent != null && StorageVent != null; }
public static bool Prefix(Vent __instance) { bool flag; bool flag2; __instance.CanUse(PlayerControl.LocalPlayer.PPMOEEPBHJO, out flag, out flag2); if (!flag) { return(true); // Continue with default method } bool isEnter = !PlayerControl.LocalPlayer.inVent; if (isEnter) { localVentEnterTimePoint = DateTime.UtcNow; } if (!__instance.name.StartsWith("JackInTheBoxVent_")) { return(true); // Continue with default method } __instance.SetButtons(isEnter); MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.UseUncheckedVent, Hazel.SendOption.Reliable); writer.WritePacked(__instance.Id); writer.Write(PlayerControl.LocalPlayer.PlayerId); writer.Write(isEnter ? byte.MaxValue : (byte)0); writer.EndMessage(); RPCProcedure.useUncheckedVent(__instance.Id, PlayerControl.LocalPlayer.PlayerId, isEnter ? byte.MaxValue : (byte)0); return(false); }
public static bool Prefix(Vent __instance) { if (!VentMap.ContainsKey(__instance.Id)) { return(true); } var Custom = VentMap[__instance.Id]; __instance.CanUse(PlayerControl.LocalPlayer.Data, out var canUse, out _); if (!canUse) { return(false); } var localPlayer = PlayerControl.LocalPlayer; if (localPlayer.inVent) { localPlayer.MyPhysics.RpcExitVent(Custom.Id); Custom.SetButtons(false); } else { localPlayer.MyPhysics.RpcEnterVent(Custom.Id); Custom.SetButtons(true); } return(false); }
public Line(Vent v) { X1 = v.X1; X2 = v.X2; Y1 = v.Y1; Y2 = v.Y2; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { GeneratedBuildings.RegisterSingleLogicInputPort(go); go.AddOrGet <LogicOperationalController>(); go.AddOrGet <RotatableExhaust>(); Vent vent = go.AddOrGet <Vent>(); vent.conduitType = ConduitType.Gas; vent.endpointType = Endpoint.Sink; vent.overpressureMass = WallPumpsConfig.GetConfig().gasWallPressureVent.maxPressure; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Gas; conduitConsumer.ignoreMinMassCheck = true; Storage storage = BuildingTemplates.CreateDefaultStorage(go, false); storage.showInUI = true; go.AddOrGet <SimpleVent>(); SimCellOccupier simCellOccupier = go.AddOrGet <SimCellOccupier>(); simCellOccupier.notifyOnMelt = true; go.AddOrGet <Insulator>(); go.AddOrGet <TileTemperature>(); BuildingHP buildingHP = go.AddOrGet <BuildingHP>(); buildingHP.destroyOnDamaged = true; }
public static bool Prefix(Vent __instance, [HarmonyArgument(0)] GameData.PlayerInfo playerInfo, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse, ref float __result) { __result = float.MaxValue; canUse = couldUse = false; var player = playerInfo.Object; if (player.inVent) { __result = Vector2.Distance(player.Collider.bounds.center, __instance.transform.position); canUse = couldUse = true; return(false); } if (player.Is(RoleEnum.Morphling) || player.Is(RoleEnum.Swooper) || (player.Is(RoleEnum.Undertaker) && Role.GetRole <Undertaker>(player).CurrentlyDragging != null)) { return(false); } if (player.Is(RoleEnum.Engineer)) { playerInfo.IsImpostor = true; } return(true); }
public void Test1(string input, int expectedCount, int expectedOverlap) { var vents = (from ventString in input.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries) select Vent.Parse(ventString, provider: default) ).ToList(); Assert.Equal(expectedCount, vents.Count); Assert.DoesNotContain(default, vents);
public static bool Prefix(Vent __instance, [HarmonyArgument(0)] PlayerControl pc) { if (!CustomOptionHolder.disableVentAnimation.getBool()) { return(true); } return(pc.AmOwner); }
public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { couldUse = !pc.IsDead && (pc.IsImpostor || RoleInfo.IsRole(pc, Roles.Mechanic)); __result = Vector2.Distance(PlayerControl.LocalPlayer.GetTruePosition(), __instance.transform.position); canUse = couldUse && __result < __instance.UsableDistance; return(false); }
/* There's a bug on Polus; the bottom of the vent in Admin (in the library) is right next to the bottom wall * of the room. This means that attempting to send the player there often ends up with them stuck in the wall, * unable to move. We need to instead use coordinates that put them in the middle of the vent instead. */ public static Vector3 GetCoordinatesToSendPlayerToVent(Vent vent) { Vector2 size = vent.GetComponent <BoxCollider2D>().size; Vector3 destination = vent.transform.position; destination.y += size.y / 2; return(destination); }
public ActionResult DeleteConfirmed(int id) { Vent vent = db.Vents.Find(id); db.Vents.Remove(vent); db.SaveChanges(); return(RedirectToAction("Index")); }
public static bool Prefix(Vent __instance) { if (!VentMap.ContainsKey(__instance.Id)) { return(true); } return(false); }
protected override void Awake() { base.Awake(); var button = GetComponent <Button>(); button.onClick.AddListener(() => { Vent.Trigger(new PartSelectedEvent { PartSelector = this }); }); }
public void ExitVent(Vent vent) { if (hasControl) { this.gameObject.GetComponent <Rigidbody2D> ().velocity = Vector3.zero; this.gameObject.transform.position = vent.gameObject.transform.position; this.gameObject.layer = LayerMask.NameToLayer("Default"); } }
public void GivenCoordinatesThenItParsesCorrectly() { const string input = "0,2 -> 1,3"; var vent = Vent.Parse(input); Assert.Equal(0, vent.Start.X); Assert.Equal(2, vent.Start.Y); Assert.Equal(1, vent.End.X); Assert.Equal(3, vent.End.Y); }
public static void clearAndReload() { securityGuard = null; ventTarget = null; placedCameras = 0; cooldown = CustomOptionHolder.securityGuardCooldown.getFloat(); totalScrews = remainingScrews = Mathf.RoundToInt(CustomOptionHolder.securityGuardTotalScrews.getFloat()); camPrice = Mathf.RoundToInt(CustomOptionHolder.securityGuardCamPrice.getFloat()); ventPrice = Mathf.RoundToInt(CustomOptionHolder.securityGuardVentPrice.getFloat()); }