SvenKayser / JMOD

The Javascript MOD Loader
Other
8 stars 3 forks source link

JavaScript events on certain actions/stages #23

Open SvenKayser opened 7 years ago

SvenKayser commented 7 years ago

I want to implement Browser-Style event handlers for certain things that happen to Blocks and Items and the Game (or the Mod) itself.

Those event's are supposed to listen on a function passed to the .on function related to a object implementing this. So for example something like this could be a thing:

  var frisbee = addItem("itemFrisbee", "ItemFrisbee", 1 , "AnimimalTorture.general");
  frisbee.on("collideWithEntity",function(event){
    if(event.entity.type=="wolf") log("Good doggy!");
    else{
       log("It's dead, Jim");
       event.entity.kill();
    }

or:

  Mod.on("FMLLoadComplete", function(event){
    log("Load complete without burning your house. Never say there weren't any good things happening this day.")
    Game.crash("Just kidding :P");
  }
ghost commented 7 years ago

This kinda reminds me of the robin hood and friar tuck daemons.

SvenKayser commented 7 years ago

How so?

ghost commented 7 years ago

The comments. They remind me of the banter between the two daemons.

SvenKayser commented 7 years ago

The above examples would require a lot of different work to be done, also. But I think the general idea is clear. I actually want to make the step from "basically MineTweaker with loops" to actual scripting of things not being to costly in terms of performance.

But actually I like the idea of giving Tuck and Robin a cameo :smile:

ghost commented 7 years ago

In all seriousness, if such events could actually affect predesignated variables, we might have the start of our conduct tracking system. After all, such would simply need a bunch of pre-designated bool values, some way to change them at the right times, and some way to display the information. For an early implementation, I don't see why it can't just use the log to output conduct upon demand (or death).