Code Monkey home page Code Monkey logo

grasscore's Introduction

GrassCore

A core mod allowing downstream mods to register grass cut events & prevent cut grass from reappearing.

Most of the logic, including the grass list & cut detection, have been lifted directly from GrassyKnight.

Interface

In your Initialize, set one or more of the flags;

WeedKillerEnabled // Prevents cut grass from respawning.
DisconnectWeedKiller // Disconnects WeedKiller from the internal cut grass dict, allowing downstream mods to bind their own.
UniqueCutsEnabled // Invoke UniqueGrassWasCut when a new grass is cut.
CutsEnabled // Invoke GrassWasCut when grass is cut.
RawCutsEnabled // Invoke Raw_GrassWasCut when any grass-like object is cut.

Setting UniqueCutsEnabled -> CutsEnabled -> RawCutsEnabled will cause all upstream events to be enabled, so you only need to enable the most specific flag.

You can safely unset these flags when not required; flags other mods have also set will be maintained.

Events are invoked under static GrassEventDispatcher, except for GrassRegister_Global.OnStatsChanged. All events under GrassEventDispatcher have the following delegate;

public delegate void GrassWasCut_EventHandler(GrassKey key);

GrassKey is a struct of SceneName, ObjectName and Position (as a Vector2).

Todo

  • WeedKiller - consider leaving some GameObjects intact (GrassBehaviours' stems continue to react to grass cuts with slight waves)
  • Add unique detection for other grass-likes (think this might just be drapes, though implementing a version of GrassyKnight's LawnMower to verify wouldn't hurt)
  • Add support for Breakable? maybe dividing dynamically by NonBouncer
  • Maybe port GrassyKnight's compass or HUD? Don't want to make GrassyKnight a dependency of GrassRando if its going to have duplicate logic, after all.

grasscore's People

Contributors

manicjamie avatar

Stargazers

John Sullivan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.