Open Sculas opened 8 months ago
Everything has been implemented at this point, and all that is left is checking for bugs. So then, let's summarize what I've done in this PR:
While most of the config options have been kept, some have been renamed. This is what the default config looks like as of writing:
BCP now handles errors properly. It makes sure the config is valid at startup and shows an error screen when you enter the main menu, notifying you of what went wrong. You can try this out for yourself by, for example, setting the weather type in HeatCurve
to something invalid!
All events but Landmine
and Turret
were kept. A couple of events have minor changes to them, for better playability.
Here's an overview of the events and optionally changelogs:
Name | Description | Notes |
---|---|---|
They are EVOLVING?! |
Here I was, thinking that Pokémon was the only game with evolutions. | |
ICE SCREAM!!! |
Mommy, the ice cream truck is here! | Now includes all items, instead of just the vanilla items. |
Bring a shovel! |
They just want a hug... | |
They guard this place! |
Better not get kicked out again... | |
Hide and Seek |
She's gonna find you... | Formerly called They just wants to play!! . I felt that this was a better name. |
Hoarder Town |
Come on, those are mine! | |
The Hunger Games |
May the odds be ever in your favor. | Does nothing when you're playing solo. A guaranteed wipe just isn't fun. |
Pop goes the.. HOLY FUC- |
Lord have mercy on your soul. | Popup timer shortened to 1-5, instead of 0-10. |
Nothing happened today! |
Just another Tuesday. | |
Outside the box! |
Creepy... | |
All moon heat has been reset! |
Seems like Pluto just passed by. | |
The shadows are roaming |
Did you hear that? | The mist feature has been removed due to conflicts with moon heat. |
When did we get this installed?! |
I'm innocent, I swear! | |
Springbreak |
Don't get a concussion! | Formerly called Spring Escape! . I felt that this was a better name. |
The surface is explosive! |
EXPLOSION!!! | |
The Beasts Inside |
Ssshhhh... | Added support for custom levels. |
The Rumbling |
Fix the Barricades! | Added support for custom levels. |
Don't look... away? |
Instructions unclear. | |
Unfair Company |
Sometimes, life just ain't fair. |
BCP is now fully networked and all clients are aware of which event is currently happening.
Weather from moon heat is now also networked.
Most of the EnemyAI patches are no longer needed, because isOutside
is also properly shared across all clients.
This is what this PR is all about, adding a new events API. This allows any mod developer to extend upon BCP and add new events from their own mods, keeping things nicely separated. Rarity values are handled from BCP, but saved into the plugin's own config file.
Creating your own events is quite simple:
using BrutalCompanyPlus.Api;
using BrutalCompanyPlus.Objects;
using UnityEngine;
public class MyEvent : IEvent {
public string Name => "My event name";
public string Description => "My event description";
public EventPositivity Positivity => EventPositivity.Negative;
public EventRarity DefaultRarity => EventRarity.Rare;
public void ExecuteServer(SelectableLevel Level) {
EnemySpawnManager.DraftEnemySpawn<SpringManAI>(new EnemySpawnManager.SpawnInfo(1));
EnemySpawnManager.DraftEnemySpawn<FlowerManAI>(new EnemySpawnManager.SpawnInfo(1, Outside: true));
EnemySpawnManager.DraftEnemySpawn<CentipedeAI>(new EnemySpawnManager.SpawnInfo(1, Immediate: false));
LevelManager.ModifyLevelProperties(Level, Level => {
Level.outsideEnemySpawnChanceThroughDay = new AnimationCurve(
new Keyframe(0f, 999f),
new Keyframe(21f, 999f)
);
Level.enemySpawnChanceThroughoutDay = new AnimationCurve(
new Keyframe(0f, 500f),
new Keyframe(0.5f, 500f)
);
},
nameof(SelectableLevel.outsideEnemySpawnChanceThroughDay),
nameof(SelectableLevel.enemySpawnChanceThroughoutDay)
);
}
public void ExecuteClient(SelectableLevel Level) { }
public void UpdateServer() { }
public void OnEnd(SelectableLevel Level) { }
}
To register your events, it's as simple as:
using BepInEx;
using BrutalCompanyPlus.Api;
[BepInPlugin(...)]
public class Plugin : BaseUnityPlugin {
private void Awake() {
EventRegistry.AutoRegister(this);
}
}
Many more utilities to aid in event development can be found in BrutalCompanyPlus.Utils
and BrutalCompanyPlus.Objects
.
This PR implements a new events API and refactors most of the code base to allow this change. A lot of code has been separated and moved into their respective classes, and some things have been outright rewritten.
See https://github.com/notnips/Brutal-Company-Plus/pull/1#issuecomment-1868584741 for more information!