mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
more Stop And Go events
This commit is contained in:
1 parent
ba6c51653a
commit
ab151924ae
4 files changed
+91
-33
No files matched your search
+72
-13
@@ -98,16 +98,18 @@ internal class MoveAndStopPlayerData(Counter[] counters, float positionX, float
|
||||
|
||||
public void UpdateCounters()
|
||||
{
|
||||
if (LostLifeCooldownTimer > 0f) LostLifeCooldownTimer -= Time.deltaTime;
|
||||
|
||||
if (MoveAndStop.IsEventActive && MoveAndStop.Event.Type == MoveAndStop.Events.FrozenTimers) return;
|
||||
|
||||
LeftCounter.Update();
|
||||
MiddleCounter.Update();
|
||||
RightCounter.Update();
|
||||
|
||||
if (LostLifeCooldownTimer > 0f) LostLifeCooldownTimer -= Time.deltaTime;
|
||||
}
|
||||
|
||||
public bool RemoveLife(PlayerControl pc)
|
||||
{
|
||||
if (LostLifeCooldownTimer > 0f) return false;
|
||||
if (pc.inVent || LostLifeCooldownTimer > 0f) return false;
|
||||
|
||||
Lives--;
|
||||
LostLifeCooldownTimer = 1f;
|
||||
@@ -131,7 +133,10 @@ internal static class MoveAndStop
|
||||
{
|
||||
HiddenTimers,
|
||||
DoubledTimers,
|
||||
HalvedTimers
|
||||
HalvedTimers,
|
||||
FrozenTimers,
|
||||
VentAccess,
|
||||
CommsSabotage
|
||||
}
|
||||
|
||||
private static Dictionary<byte, MoveAndStopPlayerData> AllPlayerTimers = [];
|
||||
@@ -154,9 +159,9 @@ internal static class MoveAndStop
|
||||
private static OptionItem ExtraGreenTimeOnFungle;
|
||||
private static OptionItem EnableTutorial;
|
||||
private static OptionItem EventFrequency;
|
||||
private static OptionItem EventDuration;
|
||||
|
||||
private static Dictionary<Events, OptionItem> EventChances = [];
|
||||
private static Dictionary<Events, OptionItem> EventDurations = [];
|
||||
|
||||
public static readonly HashSet<string> HasPlayed = [];
|
||||
|
||||
@@ -300,22 +305,36 @@ internal static class MoveAndStop
|
||||
.SetHeader(true)
|
||||
.SetColor(new Color32(0, 255, 255, byte.MaxValue));
|
||||
|
||||
EventFrequency = new IntegerOptionItem(68_213_017, "MoveAndStop_EventFrequency", new(0, 100, 1), 10, TabGroup.GameSettings)
|
||||
EventFrequency = new IntegerOptionItem(68_213_018, "MoveAndStop_EventFrequency", new(2, 120, 1), 30, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.MoveAndStop)
|
||||
.SetColor(new Color32(0, 255, 255, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetHeader(true);
|
||||
|
||||
EventDuration = new IntegerOptionItem(68_213_018, "MoveAndStop_EventDuration", new(0, 120, 1), 30, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.MoveAndStop)
|
||||
.SetColor(new Color32(0, 255, 255, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetHeader(true);
|
||||
Events[] events = Enum.GetValues<Events>();
|
||||
|
||||
EventChances = Enum.GetValues<Events>().ToDictionary(x => x, x => new IntegerOptionItem(68_213_019 + (int)x, $"MoveAndStop_EventChance_{x}", new(0, 100, 5), 25, TabGroup.GameSettings)
|
||||
EventChances = events.ToDictionary(x => x, x => new IntegerOptionItem(68_213_019 + (int)x, $"MoveAndStop_EventChance_{x}", new(0, 100, 5), EventDefaults(x).Chance, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.MoveAndStop)
|
||||
.SetColor(new Color32(0, 255, 255, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Percent));
|
||||
|
||||
EventDurations = events.ToDictionary(x => x, x => new IntegerOptionItem(68_213_019 + events.Length + (int)x, $"MoveAndStop_EventDuration_{x}", new(5, 120, 5), EventDefaults(x).Duration, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.MoveAndStop)
|
||||
.SetColor(new Color32(0, 255, 255, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds));
|
||||
|
||||
return;
|
||||
|
||||
(int Chance, int Duration) EventDefaults(Events e) => e switch
|
||||
{
|
||||
Events.HiddenTimers => (30, 20),
|
||||
Events.DoubledTimers => (50, 25),
|
||||
Events.HalvedTimers => (50, 25),
|
||||
Events.FrozenTimers => (40, 10),
|
||||
Events.VentAccess => (20, 10),
|
||||
Events.CommsSabotage => (60, 30),
|
||||
_ => (50, 25)
|
||||
};
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
@@ -404,7 +423,47 @@ internal static class MoveAndStop
|
||||
if (!HasJustStarted && pc.IsLocalPlayer() && !IsEventActive && (now - Event.StartTimeStamp - Event.Duration) >= EventFrequency.GetInt())
|
||||
{
|
||||
var pool = EventChances.SelectMany(x => Enumerable.Repeat(x.Key, x.Value.GetInt() / 5)).ToArray();
|
||||
if (pool.Length > 0) Event = (pool.RandomElement(), EventDuration.GetInt(), now);
|
||||
|
||||
if (pool.Length > 0)
|
||||
{
|
||||
Events newEvent = pool.RandomElement();
|
||||
int duration = EventDurations[newEvent].GetInt();
|
||||
|
||||
Event = (newEvent, duration, now);
|
||||
|
||||
switch (newEvent)
|
||||
{
|
||||
case Events.VentAccess:
|
||||
Main.AllAlivePlayerControls.Do(x => x.RpcChangeRoleBasis(CustomRoles.EngineerEHR));
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
Main.AllAlivePlayerControls.Do(x =>
|
||||
{
|
||||
x.RpcChangeRoleBasis(CustomRoles.Tasker);
|
||||
|
||||
if (x.inVent || x.MyPhysics.Animations.IsPlayingEnterVentAnimation())
|
||||
LateTask.New(() => x.MyPhysics.RpcExitVent(x.GetClosestVent().Id), 1f, log: false);
|
||||
});
|
||||
}, duration, log: false);
|
||||
|
||||
break;
|
||||
case Events.CommsSabotage:
|
||||
Main.AllAlivePlayerControls.Do(x => x.RpcDesyncRepairSystem(SystemTypes.Comms, 128));
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
Main.AllAlivePlayerControls.Do(x =>
|
||||
{
|
||||
x.RpcChangeRoleBasis(CustomRoles.Tasker);
|
||||
x.RpcDesyncRepairSystem(SystemTypes.Comms, 16);
|
||||
if (Main.NormalOptions.MapId is 1 or 5) x.RpcDesyncRepairSystem(SystemTypes.Comms, 17);
|
||||
});
|
||||
}, duration, log: false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AllPlayerTimers.TryGetValue(pc.PlayerId, out MoveAndStopPlayerData data))
|
||||
|
||||
@@ -78,15 +78,11 @@ internal static class DisableDevice
|
||||
{
|
||||
case 0:
|
||||
if (Options.DisableSkeldAdmin.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldAdmin"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableSkeldCamera.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldCamera"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (Options.DisableMiraHQAdmin.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQAdmin"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableMiraHQDoorLog.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQDoorLog"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (Options.DisablePolusAdmin.GetBool() || rogueForce)
|
||||
@@ -96,31 +92,21 @@ internal static class DisableDevice
|
||||
}
|
||||
|
||||
if (Options.DisablePolusCamera.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusCamera"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisablePolusVital.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusVital"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (Options.DisableSkeldAdmin.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksAdmin"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableSkeldCamera.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksCamera"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
case 4:
|
||||
if (Options.DisableAirshipCockpitAdmin.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCockpitAdmin"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableAirshipRecordsAdmin.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipRecordsAdmin"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableAirshipCamera.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCamera"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableAirshipVital.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipVital"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
case 5:
|
||||
if (Options.DisableFungleCamera.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleCamera"]) <= UsableDistance;
|
||||
|
||||
if (Options.DisableFungleVital.GetBool() || rogueForce) doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleVital"]) <= UsableDistance;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -142,10 +128,7 @@ internal static class DisableDevice
|
||||
pc.RpcDesyncRepairSystem(SystemTypes.Comms, 17);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Exception(ex, "DisableDevice");
|
||||
}
|
||||
catch (Exception ex) { Logger.Exception(ex, "DisableDevice"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1778,7 +1778,11 @@ internal static class FixedUpdatePatch
|
||||
|
||||
if (isProgressTextLong) offset += 0.3f;
|
||||
|
||||
if (CustomGameMode.MoveAndStop.IsActiveOrIntegrated()) offset += 0.2f;
|
||||
if (CustomGameMode.MoveAndStop.IsActiveOrIntegrated())
|
||||
{
|
||||
offset += 0.2f;
|
||||
if (MoveAndStop.IsEventActive) offset += 0.2f;
|
||||
}
|
||||
|
||||
RoleText.transform.SetLocalY(offset);
|
||||
}
|
||||
|
||||
@@ -4467,7 +4467,7 @@
|
||||
"KillerInfoLong": "KILL EVERYONE TO WIN",
|
||||
"MoveAndStop": "STOP AND GO",
|
||||
"ModeMoveAndStop": "Gamemode: Stop And Go",
|
||||
"ModeDescribe.MoveAndStop": "In the Stop And Go game mode, everyone has 3 timers, each with a symbol that represents a direction you can move in. For example:\\n← (left) 17s\\n→ (right) 5s\\n● (up and down) 9s\\n\\nEach symbol is either red or green. When the timer next to the symbol reaches 0, the color swaps for that symbol.\\n\\nConcept:\\nYou cannot move in directions which you have a red symbol of, or you die.\\nEveryone is a crewmate, first to finish all their tasks wins!",
|
||||
"ModeDescribe.MoveAndStop": "In the Stop And Go game mode, everyone has 3 timers, each with a symbol that represents a direction you can move in. For example:\\n← (left) 17s\\n→ (right) 5s\\n⇅ (up and down) 9s\\n\\nEach symbol is either red or green. When the timer next to the symbol reaches 0, the color swaps for that symbol.\\n\\nConcept:\\nYou cannot move in directions which you have a red symbol of, or you die.\\nEveryone is a crewmate, first to finish all their tasks wins!",
|
||||
"MoveAndStop_RightCounterGreenMin": "Right Counter Minimum Green Time",
|
||||
"MoveAndStop_RightCounterGreenMax": "Right Counter Maximum Green Time",
|
||||
"MoveAndStop_RightCounterRedMin": "Right Counter Minimum Red Time",
|
||||
@@ -4489,12 +4489,24 @@
|
||||
"MoveAndStop_EventChance_HiddenTimers": "Chance of Hidden Timers",
|
||||
"MoveAndStop_EventChance_DoubledTimers": "Chance of Doubled Timers",
|
||||
"MoveAndStop_EventChance_HalvedTimers": "Chance of Halved Timers",
|
||||
"MoveAndStop_EventChance_FrozenTimers": "Chance of Frozen Timers",
|
||||
"MoveAndStop_EventChance_VentAccess": "Chance of Vent Access",
|
||||
"MoveAndStop_EventChance_CommsSabotage": "Chance of Comms Sabotage",
|
||||
"MoveAndStop_EventDuration_HiddenTimers": "Duration of Hidden Timers",
|
||||
"MoveAndStop_EventDuration_DoubledTimers": "Duration of Doubled Timers",
|
||||
"MoveAndStop_EventDuration_HalvedTimers": "Duration of Halved Timers",
|
||||
"MoveAndStop_EventDuration_FrozenTimers": "Duration of Frozen Timers",
|
||||
"MoveAndStop_EventDuration_VentAccess": "Duration of Vent Access",
|
||||
"MoveAndStop_EventDuration_CommsSabotage": "Duration of Comms Sabotage",
|
||||
"MoveAndStop_Tutorial": "<size=80%><#ffffff><size=100%>Stop on red lights</size>\\nOnly move in directions where you see a green arrow\\nThe timers indicate when the color changes\\nYellow means the light will turn red, so stop moving\\nOrange means the light will turn green, but do not move yet\\nFinish your tasks to win</color></size>",
|
||||
"MoveAndStop_LivesRemainingNotify": "<size=2><#ffff00>⚠ YOU LOST A LIFE / <#ffff44>{0}</color> REMAINING ⚠</color></size>",
|
||||
"MoveAndStop_EventActive": "<#00ffff>[Event]</color> {0} - {1}",
|
||||
"MoveAndStop_Event_HiddenTimers": "Hidden Timers",
|
||||
"MoveAndStop_Event_DoubledTimers": "Doubled Timers",
|
||||
"MoveAndStop_Event_HalvedTimers": "Halved Timers",
|
||||
"MoveAndStop_Event_FrozenTimers": "Frozen Timers",
|
||||
"MoveAndStop_Event_VentAccess": "Vent Access",
|
||||
"MoveAndStop_Event_CommsSabotage": "Comms Sabotage",
|
||||
"Tasker": "Tasker",
|
||||
"TaskerInfo": "FINISH TASKS FIRST TO WIN",
|
||||
"TaskerInfoLong": "FINISH TASKS FIRST TO WIN",
|
||||
|
||||
Reference in new issue
Block a user