Page 1 of 1
[MOD 0.12.11+] WrenchFu (and demonstrator) v0.1.3
Posted: Sat Aug 29, 2015 11:37 am
by Narc
WrenchFu!
Info:
- WrenchFu is a helper for other mods -- it provides a single entry point through which they can cause custom GUIs to be opened, and manages automatically closing the custom GUIs when players get out of range.
- Name: WrenchFu
- Latest Release: v0.1.3, April 9th, 2016
- Factorio Version: 0.12.11+
- Download: Current Version, Demonstrator Mod
- License: MIT license
Wut?
WrenchFu doesn't really do anything by itself, it's more of a framework mod. If you want it to do anything, you should grab a mod that integrates with WrenchFu and add it -- conveniently, I made
a demonstrator mod (which you can download directly above) that lets you rename assembling machines.
This Imgur album explains how WrenchFu works for players.
The WrenchFu readme explains how modders can integrate with it.
Older versions
The
GitHub releases page for WrenchFu has all the past releases, and also serves as a change log of sorts, so you can use it to tell what's different between all the releases.
Source
This mod is open source and
lives on GitHub, as does
the demonstrator mod. Contributions and forks are appreciated.
Problems?
While I check back here from time to time, issues are more likely to get my attention if they're
posted on GitHub. Having a problem?
Post an issue right now!
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 12:20 pm
by Vin
This is a really cool meta-mod and thank you for taking the time to do it. It's not nearly as "fun" as putting new stuff into the game, but it can make the end gaming experience so much cleaner. I'm curious to see which mods will pickup support for it.
Hopefully this will go a long way to solving the mass of buttons in the top left corner that happens with a decent number of helper mods.
EDIT: I just downloaded the mod and the helper mod into a vanilla game and I'm getting an ontick error on line 77 of gui.lua with a reference to a nil value.
http://i.imgur.com/ututTDM.png
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 12:34 pm
by Narc
Vin wrote:EDIT: I just downloaded the mod and the helper mod into a vanilla game and I'm getting an ontick error on line 77 of gui.lua with a reference to a nil value.
http://i.imgur.com/ututTDM.png
Got it, thank you, fixed now by
v0.1.1 (direct download). Will update the OP in a moment.
(apparently, it's not normal for me to release a thing without having a bug found in it 5 minutes later; last time,
I found it first)
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 12:57 pm
by Vin
Would it be possible to add a keybind to close the GUI, in addition to walking away? Other GUIs (inventory, machines) close when you press the "e" button and I found it a bit disorienting for it not to behave similarly. Very minor issue, but would be appreciated.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 1:02 pm
by Narc
Vin wrote:Would it be possible to add a keybind to close the GUI, in addition to walking away? Other GUIs (inventory, machines) close when you press the "e" button and I found it a bit disorienting for it not to behave similarly. Very minor issue, but would be appreciated.
To the best of my knowledge, this is not currently possible. It is also not possible to just make a machine open a custom GUI when clicked, which prompted WrenchFu to be created in the first place. Closing when you walk away is the best compromise I could find.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 1:07 pm
by Vin
Narc wrote:To the best of my knowledge, this is not currently possible. It is also not possible to just make a machine open a custom GUI when clicked, which prompted WrenchFu to be created in the first place. Closing when you walk away is the best compromise I could find.
Huh. Lack of ability to use keybinds in mods is unexpected. I guess I've never really thought about it. At least you could find a decent compromise.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sat Aug 29, 2015 9:49 pm
by ssilk
I really won't have libraries here.
So I would do it like so:
Move Wrench Fu to libraries and add a new topic for the example mod, which can stay here then.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sun Aug 30, 2015 6:50 am
by Narc
ssilk wrote:I really won't have libraries here.
So I would do it like so:
Move Wrench Fu to libraries and add a new topic for the example mod, which can stay here then.
Nah, keep the example mod with the library, move the one thread. I don't think the example mod is something people would really want to play with -- WrenchFu itself is by far the more interesting of the two.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sun Aug 30, 2015 10:20 am
by Choumiko
Narc wrote:Vin wrote:Would it be possible to add a keybind to close the GUI, in addition to walking away? Other GUIs (inventory, machines) close when you press the "e" button and I found it a bit disorienting for it not to behave similarly. Very minor issue, but would be appreciated.
To the best of my knowledge, this is not currently possible. It is also not possible to just make a machine open a custom GUI when clicked, which prompted WrenchFu to be created in the first place. Closing when you walk away is the best compromise I could find.
At least for the opening/closing a mod gui when the vanilla GUI is opened/closed i'm using custom events:
Code: Select all
events = {}
events["on_player_opened"] = game.generate_event_name()
events["on_player_closed"] = game.generate_event_name()
function on_tick(event)
if event.tick%10==9 then
for pi, player in pairs(game.players) do
if player.opened ~= nil and not global.player_opened[player.name] then
game.raise_event(events["on_player_opened"], {entity=player.opened, player_index=pi})
global.player_opened[player.name] = player.opened
end
if global.player_opened[player.name] and player.opened == nil then
game.raise_event(events["on_player_closed"], {entity=global.player_opened[player.name], player_index=pi})
global.player_opened[player.name] = nil
end
end
end
end
function on_player_opened(event)
end
function on_player_closed(event)
end
game.on_event(events.on_player_opened, on_player_opened)
game.on_event(events.on_player_closed, on_player_closed)
Works quite well so far. Probably should have filed a request for such an event a long time ago..
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sun Aug 30, 2015 5:38 pm
by Narc
Choumiko wrote:At least for the opening/closing a mod gui when the vanilla GUI is opened/closed i'm using custom events:[...]
Makes sense to me, but what if I want my mod gui to open
instead of the vanilla one?
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sun Aug 30, 2015 8:36 pm
by ssilk
I moved it to libs.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Sun Aug 30, 2015 8:40 pm
by Narc
ssilk wrote:I moved it to libs.
Sounds good to me, thanks very much.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Mon Jan 11, 2016 5:10 am
by Afforess
I opened up a 2nd pull request to WrenchFu, to give mods access to the surface the entity was on. This is important for multi-surface mods (like the newly released NESTT mod).
I've tested it a fair amount locally and the changes seem straightforward. I'm hoping after approving the PR, you can make a new release? I'd like to release Concrete Logistics in a few days, and I need WrenchFu as a dependency. I'd hate to have to fork it and release my own copy.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Mon Jan 11, 2016 5:38 am
by Narc
Afforess wrote:I opened up a 2nd pull request to WrenchFu, to give mods access to the surface the entity was on. This is important for multi-surface mods (like the newly released NESTT mod).
Oh, that's a neat thing.
Afforess wrote:I've tested it a fair amount locally and the changes seem straightforward. I'm hoping after approving the PR, you can make a new release? I'd like to release Concrete Logistics in a few days, and I need WrenchFu as a dependency. I'd hate to have to fork it and release my own copy.
Sure thing; it'll be nice to have WrenchFu used by a real mod.
Re: [MOD 0.12.x] WrenchFu (and demonstrator)
Posted: Mon Jan 11, 2016 6:04 am
by Narc
Afforess wrote:I'm hoping [...] you can make a new release?
Done --
WrenchFu version 0.1.2 (direct download) is now the official release. If you end up poking at the other multi-surface thing I mentioned in #3, I'll cut a new release with that, but this should get you going.
And thank you for bringing the demonstrator mod along, I've cut a release of it, as well:
WrenchFu-Demo version 0.1.1 (direct download).
Re: [MOD 0.12.11+] WrenchFu (and demonstrator) v0.1.3
Posted: Sat Apr 09, 2016 2:15 pm
by Narc
Thanks to
@Adilf over on Github, who both spotted an issue and fixed it, we can now have an even better WrenchFu --
version 0.1.3 (direct download) fixes the fact that GUIs opened by players other than the first player on the map would not auto-close from the players getting out of range.
The demo mod remains at
version 0.1.1 (direct download).