-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins for SoilMod? Or add other mods' features to SoilMod? #15
Comments
Hi! Regards |
To make plugins it would be really helpfull if you could make the other main tables besides fmcSoilMod global. The way it is set up at the moment its really hard to get access to tables like fmcGrowthControl from outside mods. That would be all the "plug in"-support I would need to make mods like "green-fertilizing, multi-moving, green-direct-cut" compatible. Plus it would make a number of custom map things much easier. I already have a pile of scripting requests from my mapper (MIG-Celle map) I cant solve. At least not without some ugly setfenv()-hacks that are likely to cause more trouble than good. |
If you look at SoilMod's scripts, then at what points - functions / internal-statements - would you need to access (i.e. inject extra code), to accomplish your chosen feature(s)? For
For the For the "fertilization by cutted/existing crops" effects, I guess it will be the cultivator/plough tools that "creates" such effects, so it would be The "green direct cut" I am a bit confused about - and am reluctant to use as-is, due to it modifies For "multi moving", as it also replaces the |
In urfSeeder at the moment i use a slightly modified sprayer script. So when it comes to if (table.getn(sprayingAreasSend) > 0) then i need to create a fertilization state like cultivated/ploughed liquid_manure. Thats what you call Increase growth in your tableOfFunctions i think. This should be the right way. Regarding choppedStraw i have no idea how to plug in the middle. Somewhere and somehow i have to give SoilMod information that layerXY exists and that cultiviating/ploughing this layer creates a fertitlization effect. Maybe enhance the addFruitToFmcDynamicFoliageLayer with information about fertilizing? |
Regarding urfSeeder. If you look closely at SoilMod's changes to
So if you make the same change in your urfSeeder script, and set the For "choppedStraw fertilization", "green-direct-cut" etc., I am currently adding plugin-injection-points to the But what you need to know and explain is; "how is the effect supposed to happen." - So if "choppedStraw to fertilization" can only happen when using a cultivator, then the "plugin-point" I need to add to the SoilMod scripts, would be somewhere inside Then your mod should implement a specific function (following the requirements that SoilMod's plugin support dictates) that changes the foliage-layer(s) the way you want, and "plug it into SoilMod" using the (yet to be made) API-functions. - I am trying to have SoilMod's own effects use the same plugin method, so I get some understanding of if it works or not. And if players use "cheat plugins", then let them. - It is their game play, so if they want to play differently/unrealistic, I won't stop them. |
I already tried to send the filltype but i only get a fertilization effect with liquidManure. And of course i don´t want to have the liquidManure texture behind the seeder ;-) |
Hmm. That sounds odd, if Fillable.FILLTYPE_FERTILIZER produces slurry. - Oh well, I guess I need to find an URF-seeder somewhere and see how it works. |
No no. If i use fertilizer as fillype it only darkens the ground as expected BUT it don´t fertilize the ground. |
Ah, yes. That is correct - so much for my own memory :-/ Okay, so an URF-seeder, adding to the synthetic fertilizer "at the same time as the crop is seeded". It can not use the 'Katze5' from FS-UK has asked me if there was a way to spray synthetic fertilizer even before any crop was seeded, and I told him to change I need to think about how to add this "URF-seeder with synthetic fertilizer" to SoilMod. - I am thinking about changing from 3 to only 2 types of fertilizer/herbicide, as written in this post; http://fs-uk.com/forum/index.php?topic=161700.msg1087861#msg1087861 (the last paragraph.) For the "plugin" support in SoilMod, my initial experiment @2c0d429 seems to go well. |
I love the plugin-functions already What kind of feedback-mechanism do you have in mind? Lets say a plugin-function for cutFruitArea wants to change the amount of output. Multipliers as return variables? |
What I have attempted, is to have the following "3 phases" in each of the
So for example in the latest @eac67342b6859c62391ee37734d8fb00720077f7, if you want to have cutFruitArea return a different Then take a look at It is important that the same type and count of values are returned from the cutFruitArea function, so the base scripts still thinks they are calling the "normal" cutFruitArea. - So you need to figure out a way to "return a modified value", by studying how the base scripts acts on the returned values. I have not yet attempted to add these "3 phases" to all of the other |
I finally got around to trying things systematically. The multiMowing has a component checking for manure/slurry on gras. Atm this part of the mod is only working with the GMK-mod of marhu. I am not that deep into the soilMod mechanics, so I simply ask: Is there already a component in the cutFruitArea increasing the grass yield if manure/slurry is applied to grass? If yes I can leave things exactly as they are :) The greenFertilizer needed a small tweak (changing the order in which the Utils functions are tackled). Now the GF is using soilmods Utils-functions and everything is essentially fine. An updated version or GF is sent to modhoster and will be released today. I will however make a new version once your plugin system is finalized and released to the public. It is a much cleaner way to do things. |
The following 'after' plugins in
However, slurry will be the only option to increase the fertilizer-level on a field of grass, as (solid)manure has the requirement of being cultivated/ploughed into the ground. And cultivating/ploughing will remove any grass that is already growing there. |
Thats good to know. So there is no immediate need for me to do something about the mowing mod. soilMod compatible greenFertilizer is updated here: http://www.modhoster.de/mods/grundunger-mod |
I read and studied your sample plugins for several hours but i´m not able to get it together with choppedStraw. As i stated before i´m not the best scripter... The regards |
@webalizer-gt - The sample plugins are not easy to understand, I know. Trying to grasp what kind of changes SoilMod have done to the First of, you have to figure out how you want your own mod to work with and/or without SoilMod being present. Either you could make two mods; one that works without SoilMod, and one that requires SoilMod. - But that may confuse players, that there are "two mods for the same thing", and they will most likely just put both of the .ZIP file into their MODS folder, thereby causing a mod-conflict. Or you could put code into your
global.lua:
With the above completed, your mod should be able to work both with and without SoilMod being present. Next issue... How to 'plug-in' ChoppedStraw's feature into SoilMod. - Let us ignore the "fertilization by chopped straw" for now. From what I see in your But your additions to ... I was here going to try illustrating the not-so-optimal addition of plugins, but found that it was going to fill too much. So I will instead show the way I would add plugin for "destroy any 'chopped straw'". Since your additions to
The above won't affect when sowing, so there is a need to add plugin(s) for
By early on determining if a "fruit" and its corresponding foliage-layer is not available, then there is no need to add a "plugin" for that. This should be better than having an if-then-(else)-if-then-(else)-... which need to constantly be checked for every call to There are more to it, but I suggest you take a look through For the "fertilization by chopped straw" you want to add, I will explain that at a later time how to add that as a plugin to SoilMod. |
Hi! First of all: Thank you for helping so much! I really appreciate that. I modified ChoppedStraw with the code you provided.
Of course i commented out your support for choppedstraw in |
Oops. My bad. - I forgot that the call-back function I have just now updated the sample-plugins with it. @19cb6d5208deaebc68bc9a30e1816d8e3aa17e2f |
So, finally i got everything to work as expected. Thanks to your help i was able to change it step by step to what i want. It´s not final because i have to decide if sowing machines should work the same way as cultivator and plough - at the moment i think not. Regarding the sowing machine i got a question: is it somehow possible to differentiate if a sowing machine uses direct planting for use with soilmod? |
Sowing machine direct planting, it is a boolean variable; |
Players are finding that other mods, which also tries to control/overwrite the
Utils.
functions for foliage-layer manipulation, are conflicting or not working together with SoilMod.This problem of "conflicting mods" was anticipated, but could there be a future solution for it?
Should (can?) there be some kind of "plugin" ability for SoilMod, so features like green-fertilizing, multi-moving, green-direct-cut and similar, can be added when the players so chooses?
Or should such extra features just be build into SoilMod's scripts, to keep it within "one package"?
The text was updated successfully, but these errors were encountered: