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

Doesn't fit in the other categories, like libraries, small fixes or modpacks.
Also new graphics, sounds, music etc. goes here.

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

Postby Narc » Sat Aug 29, 2015 11:37 am

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

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

Postby Vin » Sat Aug 29, 2015 12:20 pm

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

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

Postby Narc » Sat Aug 29, 2015 12:34 pm

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

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

Postby Vin » Sat Aug 29, 2015 12:57 pm

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

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

Postby Narc » Sat Aug 29, 2015 1:02 pm

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

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

Postby Vin » Sat Aug 29, 2015 1:07 pm

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

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

Postby ssilk » Sat Aug 29, 2015 9:49 pm

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
ssilk
Global Moderator
Global Moderator
 
Posts: 10373
Joined: Tue Apr 16, 2013 10:35 pm
Location: Würzburg, Germany

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

Postby Narc » Sun Aug 30, 2015 6:50 am

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

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

Postby Choumiko » Sun Aug 30, 2015 10:20 am

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..
Choumiko
Smart Inserter
Smart Inserter
 
Posts: 1213
Joined: Fri Mar 21, 2014 10:51 pm
Location: Germany

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

Postby Narc » Sun Aug 30, 2015 5:38 pm

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
Narc
Filter Inserter
Filter Inserter
 
Posts: 267
Joined: Mon Feb 11, 2013 7:25 am

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

Postby ssilk » Sun Aug 30, 2015 8:36 pm

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
ssilk
Global Moderator
Global Moderator
 
Posts: 10373
Joined: Tue Apr 16, 2013 10:35 pm
Location: Würzburg, Germany

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

Postby Narc » Sun Aug 30, 2015 8:40 pm

ssilk wrote:I moved it to libs.

Sounds good to me, thanks very much.
User avatar
Narc
Filter Inserter
Filter Inserter
 
Posts: 267
Joined: Mon Feb 11, 2013 7:25 am

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

Postby Afforess » Mon Jan 11, 2016 5:10 am

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
Afforess
Filter Inserter
Filter Inserter
 
Posts: 417
Joined: Tue May 05, 2015 6:07 pm

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

Postby Narc » Mon Jan 11, 2016 5:38 am

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: 267
Joined: Mon Feb 11, 2013 7:25 am

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

Postby Narc » Mon Jan 11, 2016 6:04 am

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: 267
Joined: Mon Feb 11, 2013 7:25 am

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

Postby Narc » Sat Apr 09, 2016 2:15 pm

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


Return to Mod Packs / Libs / Special Interest

Who is online

Users browsing this forum: No registered users and 1 guest