RimWorld

RimWorld

Not enough ratings
JTZoneButtons
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
79.701 KB
5 Jun, 2017 @ 6:38am
1 Change Note ( view )

Subscribe to download
JTZoneButtons

In 1 collection by Touchable
Jamestec's Mods JT Alpha 17
10 items
Description
Adds buttons for creating/expanding and deleting/shrinking stockpiles and growing zones when selecting a stockpile or growing zone.


Version 1.0: Initial A17 release. Inheriting Verse.Mod. Compatibility code changes.

Acknowledgements:
Other languages: cainiao
Missing allow sowing button: pinguin42


https://ludeon.com/forums/index.php?topic=26210
19 Comments
Rock5 2 Dec, 2017 @ 2:15am 
I updated it for B18. You can find it here.

https://ludeon.com/forums/index.php?topic=37177.msg382039#msg382039
Fuglypump 26 Nov, 2017 @ 6:15pm 
Touchable can you please update your mods, you have a lot of great ones.
Rock5 16 Nov, 2017 @ 10:21pm 
Need Zone Buttons for A18. Please update :)
Stupid Dumb Lizard 2 Oct, 2017 @ 8:58pm 
I know it would probably be a pain in the ass, but it would be really cool if this mod synergised well or incorporated parts of these mods. They're all QoL mods for stockpiles, but they don't play well with each other. (Your mod JT Export is similar to Preset Filtered Zones. Maybe include some by default?)

ReColor Stockpile & Growing Zones

Preset Filtered Zones
SmokeDragon 19 Sep, 2017 @ 3:01pm 
this doesnt play well with save storage and outfit settings mod
Its_juice 6 Sep, 2017 @ 10:25pm 
Muito bom. Obrigado.
cammillotto 25 Aug, 2017 @ 9:20am 
any development on harmony integration? :-)
cammillotto 5 Aug, 2017 @ 12:31pm 
I confirm it conflicts with ReColor Stockpile & Growing Zones
hope you-ll implement Harony soon :-)
thanks Kiame for jumping in!
KiameV 5 Aug, 2017 @ 9:38am 
Yeah if you can use harmony your mods will be able to be used with other mods without as much conflict. https://github.com/pardeike/Harmony/wiki

If you want to see examples of how to use it most of my mods use harmony. One that's close to what you're doing is: https://github.com/KiameV/rimworld-SaveStorageSettings/blob/master/Source/Main.cs

Harmony Prefix is called before a method. Postfix is called after. A method can have both. Prefix can be either a void or boolean return. In the bool case returning false prevents any other Prefixes from running and also prevents the method being Prefixed from being called (a true override)

[HarmonyPatch(typeof(Zone_Stockpile), "GetGizmos")]
static class Patch_Zone_GetGizmos
{
static void Postfix(Zone_Stockpile __instance, ref IEnumerable<Gizmo> __result)
{
__result = GizmoUtil.AddSaveLoadGizmos(__result, "Zone_Stockpile", __instance.settings.filter);
}
}
KiameV 5 Aug, 2017 @ 9:38am 
This is saying that the class "Zone_Stockpile" method "GetGizmos" is being either Prefix or Postfix. Arguments can be "<class> __instance" which is equivalent to "this" but not within this's scope (so you wont see private methods and reflection will need to be used to invoke methods or get fields for non-public things). In Postfix "ref <method return type> __result" is the resulting object from the call. So in the case of gizmo's you'll probably do a postfix and add the new buttons to the returned list of gizmos.

In this example it's using GizmoUtil to add the new buttons to the list. GizmoUtil is here for reference too: https://github.com/KiameV/rimworld-SaveStorageSettings/blob/master/Source/GizmoUtil.cs