Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
natekomodo committed Dec 8, 2018
2 parents d39fffe + 395eb74 commit 02c9e6f
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Once this is done you will need to make your class impement IPlugin.
As we now use Illusion plugin, you will need to implement it in your class. This will come with description functions and various level update methods for your to use.

## Using the framework
The engine has 4 main classes, ModEngineEventHandler, ModEngineVariables, ModEngineComponents and ModEngineChatMessages (WIP), you can use these to control you plugin.
The framework has several classes, you can use these to control you plugin.
Make sure your main class implements the IPlugin interface, as it will not be loaded if it does not. This interface comes with methods for you already made, such as getting information about the plugin and a run function, where you put your code in.
If you want to use other clases, make sure you instanciate them before or instead of calling methods in there

### Events
To use events, you need to subscribe to one, type ModEngineEventHandler.(Event you want to use) += (A function you want to be called when the event is triggered), when the event is triggered, your function you specified will be called as well.
To use an event, add an if statement in your update void, in the brackets put ModEngineEvents.(Event), this will be true if the event has happened

Example: ModEngineEventHandler.OnBossKilled += bosskilled(); (Where bosskilled() is a void)
Example: if(ModEngineEvents.GoldChange()) { //Do stuffs }

### Variables
To use game variables, you can use the ModEngineVariables class, by typing ModEngineVariables.(variable) you can fetch the data from the game code without much knowledge of the game code. Some functions may return custom data types, which you can use as abridge to the class.
Expand All @@ -37,15 +37,34 @@ Example 2: ModEngineVariables.Substats.boostJuice = 100; (Substats has muliple v
### Components
Components are the most powerful part, they allows you to get game objects and classes attached to them, or attach your own. the ModEngineComponent class supports getting components attached to objects, and objects themselves, as well as a list of all objects, and all components for the objects, this allows you a high degree of control over the game code.

Example 1: ModEngineComponents.GetComponent("Player", <HealthController>); returns the health controller class
Example 1: ModEngineComponents.GetComponentFromObject<HealthController>("Player"); returns the health controller class

Example 2: ModEngineComponents.GetAllComponents("Player"); returns all components attached to the player

Example 3: ModEngineComponents.GetObject("Player"); returns a game object of the player
Example 3: ModEngineComponents.GetObjectFromTag("Player"); returns a game object of the player

Example 4: ModEngineComponents.GetAllGameObjects(); returns all the game objects

Example 5: ModEngineComponents.AddComponent("Player", <MyLogicClass>); Adds a class to the player object
Example 5: ModEngineComponents.AddComponentToGameObject<MyLogicClass>("Player"); Adds a class to the player object

### Chat commands or message listening
To create a command, create a string in your update void and set it to ModEngineEvents.MessageSent(), you can then do an if statement on it to see if it matches a command. You can also just see all chat messages this way

Example:
string command = ModEngineEvents.MessageSent();
if (command == "/help") { //dostuff }

### Displaying text
To display feedback to the player, you can either create an overlay over their screen, or using a chat message. To use this you need to create a new instance of ModEngineChatMessage or ModEngineTextOverlay. You dont have to save the instance.

Example: new ModEngineChatMessage("Hello world!", PlayerNetworking.ChatMessageType.BOT);

Example: new ModEngineTextOverlay("Hellow world!");

### Functions
You can use ModEngineCommands.(command) to do some functions, such as spawning the time traveler or boss.

Example: ModEngineCommands.SpawnTimeTravller(0f, 0f, true); forces the time traveler to spawn instantly and be good

## Using and testing plugins
Simply build the plugin if its yours, or get the dll if its not, and put it in the Plugins folder in your we need to go deeper install folder

0 comments on commit 02c9e6f

Please sign in to comment.