Skip to content

Commit

Permalink
V2.4.1
Browse files Browse the repository at this point in the history
-Teleport event will now only choose from connected rooms
-Event startup method is now called before name/description is displayed, allowing for changing them in startup instead of ctor
-Removed unneeded using directives
  • Loading branch information
Gamer025 committed Sep 18, 2023
1 parent 87c2cd0 commit 069cb6c
Show file tree
Hide file tree
Showing 64 changed files with 75 additions and 382 deletions.
3 changes: 0 additions & 3 deletions Attributes/InternalCEEventAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RainWorldCE.Attributes
{
Expand Down
4 changes: 0 additions & 4 deletions Attributes/MSCEventAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Attributes
{
Expand Down
4 changes: 0 additions & 4 deletions Config/BooleanConfigEntry.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Menu.Remix.MixedUI;
using RainWorldCE.Events;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using UnityEngine;

namespace RainWorldCE.Config
Expand Down
8 changes: 1 addition & 7 deletions Config/CustomChaos/CCEntry.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
namespace RainWorldCE.Config.CustomChaos
{
internal abstract class CCEntry
{
Expand Down
8 changes: 1 addition & 7 deletions Config/CustomChaos/CCError.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
namespace RainWorldCE.Config.CustomChaos
{
internal class CCError : CCEntry
{
Expand Down
6 changes: 1 addition & 5 deletions Config/CustomChaos/CCExecuteEvent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using RainWorldCE.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
{
Expand Down Expand Up @@ -31,7 +27,7 @@ public override int doAction()
CEEvent ceevent = (CEEvent)Activator.CreateInstance(eventClass);
if (time > 0 && ceevent.ActiveTime > 0)
ceevent.ActiveTime = time;
RainWorldCE.activateEvent(ceevent);
RainWorldCE.ActivateEvent(ceevent);
return 0;
}

Expand Down
8 changes: 1 addition & 7 deletions Config/CustomChaos/CCGoto.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
namespace RainWorldCE.Config.CustomChaos
{
internal class CCGoto : CCEntry
{
Expand Down
7 changes: 1 addition & 6 deletions Config/CustomChaos/CCRandomEvent.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using RainWorldCE.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace RainWorldCE.Config.CustomChaos
{
Expand All @@ -19,7 +14,7 @@ public override int doAction()
//Need to recreate the event here and not sure it in the constructor since ctor may have run while game not active
Type eventClass = RainWorldCE.PickEvent();
CEEvent ceevent = (CEEvent)Activator.CreateInstance(eventClass);
RainWorldCE.activateEvent(ceevent);
RainWorldCE.ActivateEvent(ceevent);
return 0;
}

Expand Down
8 changes: 1 addition & 7 deletions Config/CustomChaos/CCWait.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
namespace RainWorldCE.Config.CustomChaos
{
internal class CCWait : CCEntry
{
Expand Down
5 changes: 0 additions & 5 deletions Config/CustomChaos/CustomChaos.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using BepInEx.Logging;
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Config.CustomChaos
{
Expand Down
4 changes: 0 additions & 4 deletions Config/EventConfigEntry.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using RainWorldCE.Events;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using UnityEngine;
using Menu.Remix.MixedUI;

Expand Down
9 changes: 1 addition & 8 deletions Config/IntegerConfigEntry.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
using BepInEx.Logging;
using IL.RWCustom;
using Menu.Remix.MixedUI;
using Menu.Remix.MixedUI;
using RainWorldCE.Events;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;

namespace RainWorldCE.Config
Expand Down
1 change: 0 additions & 1 deletion Config/RainWorldCEOI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using UnityEngine;
using Menu.Remix.MixedUI;
using RainWorldCE.Config.CustomChaos;
using System.IO;
using System.Reflection;
using RainWorldCE.RWHUD;
Expand Down
4 changes: 0 additions & 4 deletions Events/AllEventsFiltered.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using RainWorldCE.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RainWorldCE.Events
{
Expand Down
4 changes: 1 addition & 3 deletions Events/CEEvent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Logging;
using RainWorldCE.Config;
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace RainWorldCE.Events
{
Expand Down
5 changes: 0 additions & 5 deletions Events/Challenger.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using BepInEx.Logging;
using IL.LizardCosmetics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RainWorldCE.Events
{
Expand Down
9 changes: 1 addition & 8 deletions Events/CreatureMigration.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using BepInEx.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace RainWorldCE.Events
namespace RainWorldCE.Events
{
/// <summary>
/// Causes all creatures in the region to migrate to the players current room
Expand Down
7 changes: 0 additions & 7 deletions Events/CreatureRandomizer.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
using BepInEx.Logging;
using IL;
using IL.JollyCoop.JollyManual;
using On;
using RainWorldCE.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;

namespace RainWorldCE.Events
{
Expand Down
13 changes: 2 additions & 11 deletions Events/Darkness.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using BepInEx.Logging;
using RainWorldCE.Config;
using System;
using RainWorldCE.Config;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace RainWorldCE.Events
Expand All @@ -16,12 +12,6 @@ internal class Darkness : CEEvent
public Darkness()
{
_name = "Darkness / Shaded Region";
if (EventHelpers.StoryModeActive && game.world.region is not null)
{
string regionName = Region.GetRegionFullName(game.world.region.name, (EventHelpers.MainPlayer.realizedCreature as Player).SlugCatClass);

_name = $"Shaded {regionName}";
}
_description = "Darkness has fallen";
_activeTime = (int)(60 * RainWorldCE.eventDurationMult);
}
Expand All @@ -30,6 +20,7 @@ public Darkness()

public override void StartupTrigger()
{
_name = $"Shaded {Region.GetRegionFullName(game.world.region.name, (EventHelpers.MainPlayer.realizedCreature as Player).SlugCatClass)}";
amount = TryGetConfigAsInt("amount") / 100f;
Room room = game.cameras[0].room;
PlayerChangedRoomTrigger(ref game.cameras[0], ref room, ref game.cameras[0].currentCameraPosition);
Expand Down
26 changes: 13 additions & 13 deletions Events/EventHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using BepInEx.Logging;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using static SlugcatStats;

namespace RainWorldCE.Events
{
Expand Down Expand Up @@ -114,6 +110,18 @@ internal static List<AbstractRoom> GetConnectedRooms(AbstractRoom room)
return returnList;
}

internal static List<AbstractRoom> GetAllConnectedRooms(AbstractRoom room)
{
Dictionary<string, AbstractRoom> rooms =new Dictionary<string, AbstractRoom>();
GetConnectedRooms(room).ForEach(x => rooms[x.name] = x);
for (int i = 0; i < rooms.Count; i++)
{
AbstractRoom nextRoom = rooms.ElementAt(i).Value;
GetConnectedRooms(nextRoom).ForEach(x => rooms[x.name] = x);
}
return rooms.Values.ToList();
}

internal static int GetNodeIdOfRoomConnection(AbstractRoom source, AbstractRoom destination)
{
return Array.IndexOf(destination.connections, source.index);
Expand Down Expand Up @@ -153,13 +161,5 @@ internal static bool RoomHasEffect(Room room, RoomSettings.RoomEffect.Type type)
}
return false;
}

internal static bool StoryModeActive
{
get
{
return (CEEvent.game is not null && CEEvent.game.IsStorySession);
}
}
}
}
6 changes: 0 additions & 6 deletions Events/FlipCamera.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using RainWorldCE.PostProcessing;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace RainWorldCE.Events
Expand Down
7 changes: 1 addition & 6 deletions Events/FoodLevel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using BepInEx.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System;

namespace RainWorldCE.Events
{
Expand Down
4 changes: 0 additions & 4 deletions Events/Friend.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using BepInEx.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RainWorldCE.Events
{
Expand Down
29 changes: 11 additions & 18 deletions Events/Gift.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using BepInEx.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using static SlugcatStats;

namespace RainWorldCE.Events
{
Expand All @@ -15,19 +10,8 @@ internal class Gift : CEEvent
{
public Gift()
{
size = GetRandomGiftSize;
_name = "A small/normal/great gift";
if (EventHelpers.StoryModeActive)
{
_name = $"A {size} gift";
}
_description = size switch
{
GiftSize.small => "Take this, it's dangerous to go alone",
GiftSize.normal => "You will probably need this",
GiftSize.big => "A great gift for an amazing little creature",
_ => "",
};
_description = "You will probably need this";
}

enum GiftSize
Expand All @@ -37,10 +21,19 @@ enum GiftSize
big
}

private readonly GiftSize size;
private GiftSize size;

public override void StartupTrigger()
{
size = GetRandomGiftSize;
_name = $"A {size} gift";
_description = size switch
{
GiftSize.small => "Take this, it's dangerous to go alone",
GiftSize.normal => "You will probably need this",
GiftSize.big => "A great gift for an amazing little creature",
_ => "",
};
foreach (AbstractCreature player in EventHelpers.AllPlayers)
{
AbstractPhysicalObject reward = null;
Expand Down
8 changes: 1 addition & 7 deletions Events/Grayscale.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using BepInEx.Logging;
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static SlugcatStats;
using UnityEngine;
using System.CodeDom;

namespace RainWorldCE.Events
{
Expand Down
Loading

0 comments on commit 069cb6c

Please sign in to comment.