[MOD 0.12.11+] WrenchFu (and demonstrator) v0.1.3

Doesn't fit in the other categories, like libraries, small fixes or modpacks.
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

[MOD 0.12.11+] WrenchFu (and demonstrator) v0.1.3

Post by Narc »

WrenchFu!
Image

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!
Last edited by Narc on Sat Apr 09, 2016 2:12 pm, edited 4 times in total.
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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)
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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. :D
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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..
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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?
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post by ssilk »

I moved it to libs.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post by Narc »

ssilk wrote:I moved it to libs.
Sounds good to me, thanks very much.
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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.
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.x] WrenchFu (and demonstrator)

Post 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).
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 279
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [MOD 0.12.11+] WrenchFu (and demonstrator) v0.1.3

Post 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).
Post Reply

Return to “Mod Packs / Libs / Special Interest”