DeckerMMIV / FarmSim_Mod_SoilMod

Farming Simulator modification - SoilMod
25 stars 14 forks source link

Clarification on plugin behavior #94

Closed alfalfa6945 closed 8 years ago

alfalfa6945 commented 8 years ago

First off, thank you for creating the Soilmod, and for taking the time to then make it “plugin” capable. Having a couple of issues with regards to adding plugins to Soilmod, however. A couple of points:

1) I haven’t seen mention of plugins or how to install user generated plugins to a map in the documentation. Though it may be straight forward for most people, it’s not altogether obvious either. The way I’ve added my own plugins is by including them as sourceFiles in a maps modeDesc. For example: <sourceFile filename="scripts/anhydrousPlugin.lua"/> Not sure if this is the proper method, just pointing out that there seems to be no documentation for proper methods of dealing with plugins for soilMod.

2) As the name of this particular plugin implies, I’m trying to create a plugin for anhydrous injection. There are of course some pitfalls that I’m finding difficult to overcome… Traditionally, anhydrous is “knifed” into the ground with a cultivator or plow. And this is the major hurdle. For the sake of realism, I put the anhydrous wagon behind the cultivator. This poses a problem, as I am cultivating first, “spraying” second. To overcome this, I’ve moved the workArea for the cultivator back and the workArea of the “sprayer” forward. This gives me the proper order, foliage layer (used more or less as a ‘tracer’ for me) is destroyed by the cultivator and effect of extra nitrogen and pH reduction is updated. This is a blatant “hack” by myself, it’s not proper. But I’m also not seeing a workaround for this issue. I could just drag the cultivator and “sprayer” around a field, leave a tracer foliage layer behind that then gets updated at GrowthCycle instead of during UpdatePloughArea or UpdateCultivatorArea. But I find this method to be less realistic and overspray onto areas outside of fields become affected as well. I’m not sure that you can generate a fix for this issue, I’m mentioning it as I can’t wrap my own mind around the problem and maybe there’s another solution I’m not seeing that someone can point out.

3) I gist’d the code I am using for anhydrous, as I’m having a slight issue with pH. Allow me to qualify the code… I’ve looked at a lot of code from a lot of people. Most code ‘looks’ the same, it’s straight forward. A few people in the community code in an unique way, a ‘style’ pattern all their own. After looking through your code, I can only describe it as “elegant”. Things like line breaks and spaces added make the code have an elegant flow, but I’ll be honest, for a non-programmer as myself, also make it more difficult to read. That’s not a knock on your style, that’s a compliment to how well it looks and how different from “basic” lua it is (if that makes sense?). So if you look at the gist I’m posting, you’ll see that instead of making the code look “basic” (which, honestly, is easier for me to read at my beginner level), I pretty much copied your style verbatim.

https://gist.github.com/alfalfa6945/60f45749d71735c44de0f566c941351d

The problem I’m having with pH is that I set it to “-2”, but in-game it deducts -4. When set to “-1”, it deducts -2 in-game. The gist includes the foliage layer from the .i3d that I am using. What am I doing wrong?

Caveat, anhydrous is being registered as a fillType, not a fruitType. I haven’t yet pulled out enough hair to test registering it as a sprayType in addition to fillType, though.