Duck Game

Duck Game

Duck Game Script Extender (DEPRECATED)
Is actually ted  [developer] 22 Nov, 2016 @ 6:25pm
The Documentation
DGSE_Events
This is the main class of the mod. The idea behind this was that vanilla duck game modding only allows you to add items by extending thing, and then using [EditorGroup...]. This class allows you to hook into duckgame on any level, and apply your logic to duckgame at any time.

The events in here use a generic handler, which makes it pretty easy to hook into. This is an example of hooking into an event:
DuckGame.DGSE.DGSE_Events.instance.onLevelUpdated+=MyFunction;
void MyFunction() { // do something }
Here are the events:
  • onLevelUpdated -> Invoked each time the level is updated (the game tick)
  • onDucksSpawned -> Invoked at the beginning of a level (first frame containing ducks)
  • onLevelInitializing -> Invoked when the level is initialized (or possibly slightly after)
  • onLevelTerminated -> Invoked when the level is terminated
The other one's I haven't used or tested much personally, but they should fire whenever those functions are fired on a normal object

HatsWithSounds
This class is used to register a custom sound to be used with a team (builtin or custom). Huge thanks to https://steamhost.cn/steamcommunity_com/id/king_potato, the creator of GCN Items. I read through their source code to figure out how to play SFX sounds.
Anyway, to use this class, call HatsWithSounds.AddSoundToHat(Team team, string soundFilePath). It should look something like this:
DuckGame.DGSE.HatsWithSounds.AddSoundToHat(Team.GetTeam("Frogs?"),Mod.GetPath<YourMod>("customsound"));