pyrovoice Posted May 28, 2015 Share Posted May 28, 2015 Hi guys, I'm new to modding and i'd like to use an OnEndGrowth event. For example, your farm frow a fruit. When the fruit is full grown, the function drop is called and the fruit is dropped on the ground. Does an event like this already exists ? If not, do you know how events are managed ? I couldn't find a list in the LUAsĀ Thanks for your help ! Link to comment Share on other sites More sharing options...
Seiai Posted May 28, 2015 Share Posted May 28, 2015 @pyrovoice, well, i dont think theres an event, since there's no real need to push the event to something. the growing is done by the plant and only affects the plant. u will probably have to directly mod the plants/farms. and events are not centrally managed, events are used all over the code, whenever theres a need to tell another entity something, that should also affect this other entity. (ofc theres a part of the code that takes care of how the events are passed(in entityscript.lua) but i dont think thats what u mean?) Link to comment Share on other sites More sharing options...
pyrovoice Posted May 28, 2015 Author Share Posted May 28, 2015 ok thanks, so my job to find how events are created. Link to comment Share on other sites More sharing options...
Blueberrys Posted May 28, 2015 Share Posted May 28, 2015 @pyrovoice The crop component has a onmature function.-- For chaining and compatibilitylocal old_onmatured = inst.components.crop.onmaturedinst.components.crop:SetOnMatureFn(function(inst)) -- ... if old_onmatured then return old_onmatured(inst) endend) Link to comment Share on other sites More sharing options...
Seiai Posted May 28, 2015 Share Posted May 28, 2015 @pyrovoice,btw, events are just created for example like this:inst:PushEvent("onpickup", {item = act.target}) Link to comment Share on other sites More sharing options...
pyrovoice Posted May 28, 2015 Author Share Posted May 28, 2015 ok thanks I don't kniw if I will use it tho, I had in mind a farm-like that spawn ressources periodicaly. But still very nice to know how to do it Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.