Removes red and green wires as craftable items and makes them available as shortcuts, similar to blueprints and planners. Let them clutter your inventory no more! Additionally, adds a shortcut to pick up a copper wire for the rare instances when it's necessary. Also includes a wire cutter selection tool to quickly remove all wires in an area.
Providing the player with new tools or adjusting the game interface, without fundamentally changing gameplay.
"Red and green wires are removed from all recipes where they appear (none in vanilla, but happens in mods, e.g. LTN). Optionally, very much NOT recommended, instead of removing them, the wires in recipes can be replaced with identical substitutes [...]"
Can you do this for the copper wire as well (as a seperate option) ?
Thanks!
I could, but why? Copper wire is a proper foundational intermediate product. Unlike colored wires that are basically logical entities already, so it makes sense to remove them as items. Except sometimes mods use them as crafting components anyway, so for people worried about balance or something, I added the surrogates. What is your reasoning to want to replace copper wire with exactly equivalent substitute?
Looking back to what I wrote, it seems like a silly request from my side, as I didn't provide much information.
I want not exactly the same for the copper wire but similar option given for the green and red wires.
My thoughts are:
I want to have 2 seperate copper wires: "vanilla copper wire" and "substitude copper wire"
The "vanilla copper wire" should only be used for wiring. I do not want them to be removed entirely. But I also want them to not be used in any recipe.
The reason is, as of right know, you can duplicate copper wires, and can also use them in recipes, where they are needed, and save up resources with that.
The "substitude copper wire" cannot be used for wiring, but is used in every recipe, which had "vanilla copper wire" before installing this mod.
Is it possible to do that ?
The thing is, you might not have noticed, you can't just duplicate copper wire, the mod is set up such that it only gives you copper wire from nothing if you don't have it in the inventory, otherwise it just places wire from the inventory into the hand. And it only gives you one wire from nothing, not a stack. You can trick it if you want: conjure one wire, place it in a chest or on the ground, conjure one wire, etc. But you have to deliberately go out of your way to cheat the system this way, and it's slow and tedious.
Colored wire is completely different. It's never used in crafting in vanilla, but it comes up in a few mods. So the substitutes were created to plug this hole where colored wire shouldn't really be crafted (like blueprint items aren't), but some mods use it that way anyway. I hope I've explained the conceptual difference why I don't think the identical substitute copper wire is worth the hassle.
If you don't want to conjure copper wire from nothing, you can just disable its shortcut and forget about it. It's a corner case anyway, copper wire specifically for wiring comes up extremely rarely, I only added a shortcut for it for completeness sake, it's extraneous, really. But you're not going to accidentally break the game with free copper wire, only if you put in some legendary level of grind.
Okay, I misused the word "duplicate". That was poorly worded from my side. I am sorry for that.
But there are many items, which only need a one digit number of copper wires. So it is not tedious for those items.
I don't understand, how that would be a hassle. Can't you use the same algorithm, that you use for red and green wires, for the copper wires as well, and then force the "Keep wires in recipes" to be on, resulting in reducing some code ? How difficult would it be, if someone is trying to do that ? Are there any restrictions towards the copper wire ?
These are genuine questions, that I have, and I am really curious to know the answers, so don't get me wrong.
I know it is an annoying request that I have, but it would be consistent to have it this way.
Also, at line 68 in "data-final-fixed.lua", in the "if"-condition:
if data.raw["recipe"]["red-wire"] and data.raw["recipe"]["red-wire"] then
is there a copy-paste-error or is this intended ?
Copper wire is one of the cheapest and the earliest ingredients in the game. It's literally an order of magnitude more effort trying to trick the system to get two free copper wires than to just craft them in half a second from a plate. Even with low wire count recipes, you're not going to craft anything at any kind of scale with this method. Again, if you don't want it, just disable the shortcut and forget about it, out of sight, out of mind. You can do that, you can remove the unwanted shortcuts, it's already included in the game.
Implementing it should be the same process as for colored wire substitutes, a dummy item, and then recipe rewrites. But it's one more thing to break. Once again, colored wire barely comes up (and even then I had trouble with different recipe formats in different mods), but copper wire is basically ever-present. It's just opening the door for potential bugs for what I see as no reason. Honestly, I didn't want to have the copper wire shortcut at all, it was really about the colored wire, but people asked for it, and it sorta kinda made sense, so here we are.
That last thing is an error, yes, but it's only a validity checks, it checks if red and green copper recipes exists in the prototypes, I'll bundle the fix with the next mod version, whatever it might be.
[...] just disable the shortcut and forget about it, out of sight, out of mind.
Hmm. I think that doesn't work for me like that, but I accept that.
One thing about the shortcuts:
You unlock the shortcuts for the wires, if you have researched the required technology, but you can always use the hotkeys regardless. Is there a reason for that ?
(and even then I had trouble with different recipe formats in different mods).
Do you mean like recipes for particular machines or recipes with a probability results ?
I assume you also didn't use the events "on_player_dropped_item" and "on_picked_up_item" to remove red and green wires (or copper wires, if they are generated from nothing) aswell, because it is not worth the effort, provided that they (basically) are only used for wiring and nothing else, and vanish as soon as you put them in your inventory, right?
What do you think about this:
Remove the concept of fake wires and instead add the needed materials for wires to all recipes, that required vanilla green/red wires. Would that be possible, what problems could arise and how much effort you need to implement that compared to the fake-wire-concept ?
Is it also easy to just replace all copper wires in recipes with the same amount of copper plates ? Or can it lead to bugs too, if you swap one item in a recipe with another ?
Hmm. I think that doesn't work for me like that
To the right of the shortcut panel there is a small button with three vertical dots, click on it and you can uncheck unwanted shortcuts there.
Do you mean like recipes for particular machines or recipes with a probability results ?
I mean that in the actual lua tables, it turned out there was another way to specify recipe ingredients in the protototype, different from the standard format, requiring a different condition to catch it. Who knows what bugs and/or incompatibilities may lurk in the vast body of Factorio mods if I start messing with such an important ingredient as copper wire?
[..] vanish as soon as you put them in your inventory, right?
Right, colored wires disappear once they're placed in the inventory. If you really wanted to, you could trick the system and store it in a chest, for example, but why. It's basically "the inventory is lava" situation.
What do you think about this
You have to understand, this whole wire surrogate thing is a super niche corner case. I'm only aware of two mods that use them as crafting ingredients. I didn't want it (Factorio is muh kween!), I think colored wires should just be gone as items. But people asked for it, so I made the opt-in surrogates. Sure, I would be possible to replace colored wires with their ingredients instead, but it would be more complicated (consider, that overhaul mods may have different recipes for colored wires), and the idea of the surrogates is that they're gameplay-equivalent, substituting the ingredients would create a different recipe.
And replacing copper wire with copper plate would have a huge impact on the game. And what's more, it would be way more problematic than the potential of one free wire from nothing. Consider why copper wire exists at all. Unlike colored wire, wiring things is by far its secondary function, its main purpose is to be an obstacle in the production chain, so that you can't just shove copper and iron plates together to make circuits, but have to make wires first. Consider, again, that overhaul mods may have even more involved recipes for copper wires.
Thanks for elaborating so far.
The shortcuts for the wires are greyed out for me as long as I don't have the required research. But why can I still use the hotkeys for them, although I don't have the required research yet ?
That's because shortcuts and hotkeys were basically separate systems and the hotkeys were bypassing the unlock requirement. Now there seems to be a new property to link shortcuts and hotkeys which I don't think was there before. I added it to the new version of the mod (0.4.1), you can update and try it out if you want. It's a difficult thing to check because, you may or may not know, shortcuts (all shortcuts, including vanilla ones) are an "unlock forever" deal. Once you unlock them once, they're unlocked in all your games forever, and I don't know a way to reset it short of a clean install of the game, so for me they're always enabled. The unlock requirements are just a formality, basically.
The updated version of your mod requires the 0.18 version of the base game, so I cannot test it unfortunately. Is it save to downgrade or is this new property a part of version 0.18 ? Why not unlock the shortcuts at the start of the game ? It's not like I could use wires for anything at the beginning, right ?
It seems like that property existed in the latest versions of 0.17 too. I don't think unlock requirement is important, but vanilla shortcuts have it, so I followed the convention. It seems even the devs agree that unlock requirements don't really matter because lately they've added an achievent-safe console command /unlock-shortcut-bar
to unlock all shortcuts. This command may not be available in 0.17, though. In any case, it works both ways, until you've reached the unlock, you don't have any use for the shortcuts either, so it's not an issue.
So I have downgraded the mod to 0.17 version and it seems to load in so far, but couldn't test it thoroughly.
Thank you for taking your time and have a nice day !
Sorry to bother you again, but I have one question regarding this:
Bugfixes:
- Fixed that hotkey would not respect shortcut unlocks.
I use the 4.1 version of your mod for Factorio 0.17 (downgraded myself) and it seems like I can still use hotkeys and shortcuts, before I researched the supposed required technology.
I started a new world and I have every wire-shortcut.
Did I do something wrong ?
Edit:
I started a world without your mod to clear the shortcuts.
With your mod enabled, I started a new world again and the shortcuts are locked, but I am still able to use the hotkeys.
Okay, well, as we already discussed, this whole business with unlocking the shortcuts is more a formality anyway. I just checked on a completely clean version of Factorio, it seems to be the same for vanilla shortcuts too. For example, when the Blueprint shortcut is locked, you can still summon a blueprint with Alt+B. I guess the locking system just doesn't take into account the associated hotkeys.
Hmm, I thought it would work with the "associated_control_input" property, but it seems it's not working as expected from me. Means, that it is impossible to lock shortcuts / hotkeys behind technology per world. Seems like I have to accept that.
Thank you for responding and have a nice day!
If someone really, really wanted to make per-world unlockable shortcuts, one could add the checks inside the lua handlers themselves, looking if the respective technology is already researched. But there's no reason to go to all this trouble in this mod's case.
Hmm. As hotkeys are bypassing the lock-behind-technology, Is it possible then to implement a condition in the "give_wire" and "give_copper" functions, that checks, if the player has the required technology unlocked ?
Yes, it should be possible, but I'm not going to do it. I don't see a reason to build additional fences here. If this behavior of hotkeys bypassing the requirements is good enough for vanilla shortcuts, it's good enough for this mod.
There is something in your code, that I noticed.
Everytime, you use this line:
player.clean_cursor()
you don't check afterwards, whether the cursor is empty or not.
Let's say the player has a full inventory, goes to a chest with items, takes an item, and while having it on the cursor, the player presses one of the shortcuts or use one of the hotkeys. The player get's a message, that the inventory is full, so the "clean_cursor()"-command isn't successful. And because the mod doesn't check, whether the cursor is empty or not, the current item stack in the player's cursor gets replaced by the wires, deleting it that way. I think you should add that additional check to prevent that.
Also I have a question: If somebody would take your code, modify it, and upload it as modified version of your mod, would you be ok with that or would you be against it ?
I'll add the check for cursor clearing in the next version, but I won't release a new version just for it, it seems like a rare corner case, at the very least nobody complained about it actually happening, it's all hypothetical.
Regarding the code, it's released under a permissive license, you can do pretty much whatever you want, except you must follow the same permissive license, you can't in turn lock down your alternative version, it would be "forever open" that way. I chose this license, so obviously I stand by it, if you want to make an alternative version, go for it.
Yeah, so choosing the same license. Got it.
I would rather make an addon for your mod, but i couldn't find a way to change the prototype name of the shortcuts / hotkeys of your mod (to register a different event afterwards) without getting an error or disabling certain "script.on_event" either. I can only disable hotkeys, but I cannot disable / hide shortcuts the same way I can disable hotkeys and I don't want to reintroduce them either. The only thing I could do was to use the "clear()" command instead of "player.clean_cursor()" after your mods code execution, but that's not a fancy way to do it.
Do you know by any chance, what I could do here ? Is it possible to modify shortcuts / hotkeys from another mod ?
I don't know how you would intercept a script handler to modify its internal behavior like that. You could try asking in Factorio Discord #mod-making channel, maybe the pros could suggest something.
I noticed, that you created the icons of the fake wires by inverting their originals.
However the inverted icon and the source icon are swapped like this:
Inverted Icon for Red wire = Icon for Fake green wire
Inverted Icon for Green wire = Icon for Fake red wire
Is this intended ? It seems like you rather chosed to use the more-red icon for the fake red wire and the more green icon for the fake green wire.
Yes, I inverted the colors, and then swapped them because inverted they were more similar to the opposite wire. Also for your information, I included the cursor clearing check you spoke about in the latest version 0.4.2.
Yes, thank you for that.
Also, the situation I described earlier, the player gets already an error message, if the "clean_cursor" wasn't successful:
Cannot insert "item". Player's inventory full.
So with your implemented error message, you get actually 2 error messages at the same time.
For the shortcuts, the "associated_control_input"-property causes the shortcuts to display the hotkeys for that shortcut, when the cursor is hovered over them, and I think in the shortcut menu as well. With the way the localized names are implemented in this mod, the hotkeys are displayed twice now. I think (because they didn't really work like how I expected them to do) you should remove the "associated_control_input"-property from the shortcut again.
I noticed the double localization when I added the property and I believe I fixed it (in 0.4.1 already), it displays correctly for me now, in 0.18.22 at least. I believe the property should stay because this is clearly how it's supposed to work, that (CONTROL) thing in localized strings was a bit of a hack.
Regarding the double notification, I think I'll leave it for now as a specific indication that something is in the way, and the mod is not broken. It should be a vanishingly rare occurrence anyway.
I noticed the double localization when I added the property and I believe I fixed it (in 0.4.1 already), it displays correctly for me now, in 0.18.22 at least. I believe the property should stay because this is clearly how it's supposed to work, that (CONTROL) thing in localized strings was a bit of a hack.
Oh, my bad. For the (CONTROL) thing, I agree. The vanilla shortcuts work like that too (and I think every other mod with shortcuts). But it seems like the german localization has still that (CONTROL) string.
The German localization is deprecated and broken, really. It was supplied by an outside contributor on GitHub (I don't speak German), and I added strings since then. I should probably remove it since it's broken now, unless you want to translate the missing strings.
Here:
[shortcut]
WireShortcuts-give-red=Rotes Signalkabel
WireShortcuts-give-green=Grünes Signalkabel
WireShortcuts-give-copper=Kupferkabel
[controls]
WireShortcuts-give-red=Erzeuge rotes Signalkabel
WireShortcuts-give-green=Erzeuge grünes Signalkabel
WireShortcuts-give-copper=Erzeuge Kupferkabel
WireShortcuts-switch-wire=Kabelfarbe wechseln
[message]
no-map-mode=Erzeugung von Kabel im Karten-Modus deaktiviert für die Kompatibilität mit anderen Mods.
cannot-clean-cursor=Konnte Mauszeiger nicht leeren.
[item-name]
fake-red-wire=Rotes Ersatzsignalkabel
fake-green-wire=Grünes Ersatzsignalkabel
[item-description]
fake-red-wire=Künstlicher, kabel-ähnlicher Ersatz, nicht zertifiziert für den Gebrauch im Schaltungsnetz.
fake-green-wire=Künstlicher, kabel-ähnlicher Ersatz, nicht zertifiziert für den Gebrauch im Schaltungsnetz.
[mod-setting-name]
wire-shortcuts-is-retain-wire-crafting=Kabel in Rezepten beibehalten (NICHT EMPFOHLEN)
[mod-setting-description]
wire-shortcuts-is-retain-wire-crafting=Wenn aktiviert, werden farbige Kabel in selten vorkommenden Rezepten nicht entfernt, sondern mit identischen Ersätzen ausgetauscht. Nicht empfohlen, kann möglicherweise Probleme verursachen, aber wenn es sein muss.
Tried my best :). I also changed a couple of things in the previous version, so that's why I posted all of them.
Thank you, I updated the German locale, versrion 0.4.3.
I also reported your cocnern about shortcut hotkey as a bug. It's one of the most inconsequential things ever, in my opinion, almost worthy of being posted as a "literally unplayable" meme. But it does look like an invalid behavior on the surface, technically. At the very least maybe we'll get a definitive statement that this is considered okay from the devs.
Thank you, I updated the German locale, versrion 0.4.3.
You are welcome ^^.
I also reported your cocnern about shortcut hotkey as a bug.
Thank you for that.
Still, too bad, that the shortcut unlock mechanism is a one-time thing and not per world. For example playing with early game revisiting mods, like "apm_power", which builds around the fact, that you cannot build everything as effective as possible in the early game, you are stuck with burner inserters for a longer time though, but instead of building a wooden-chest-burner-inserter-chains, you can apply green/red wire to one inserter and one chest and can already build a circuit network with that, which is the most effective thing you can do, when item stack conditions are needed. Also, a modern circuit network with comparatively stone-aged, non-electricity technology feels a bit odd, don't you think ?
I mean, you can do also do this in vanilla, but vanilla doesn't have a coal or steam age, so it's faster to progress, and you already have electricity buildings from the start, and with the time you need to research red / green wires, everthing in your farm will be electricity-dependant.
So, that is my only problem I have right now.
almost worthy of being posted as a "literally unplayable" meme.
lol
At the very least maybe we'll get a definitive statement that this is considered okay from the devs.
Yeah, I am also curious what the devs are thinking about this.
As the Factorio version 0.17 is the latest stable version according to steam, so my friends and me are playing on it right now, can you upload your updates for the 0.17 as well ? That would be nice (and easier for my friends too ^^).
Well, this mod is build on the premise that red and green wire should function like blueprint items. This may not jibe super well with all the mods that are out there. If there was a proper mechanism to make shortcuts per-world unlocks, I would add an option for it. But I'm not willing to implement complicated hacks to make it happen.
Unfortunately, there's no mechanism in the game to have two parallel branches of mods, for stable and experimental. By convention, mods support the latest experimental. I guess it's assumed that if you're adventurous enough to use mods, you're on the experimental branch. And really, there's no reason not to be, all the new shiny things are in the experimental, and it's still mostly solid as a rock despite its supposed experimental status.
Hmm, I did update to 0.18 once, but there were mod errors popping and some of the mods I use weren't even updated yet. So I downgraded again to 0.17. I would rather give the mod developers time to update their mods and the community time to find bugs, while I am playing the 0.17 version in the meantime. And I have a large amount of mods, so I cannot check every one of them, whether they are already updated or not. And for the 0.18 exclusive ones, I messaged mod developers, if they were able downgrade them for 0.17 and most of them did, so I guess I try it out here too. I mean, why should I update Factorio now, if everything is still working, right ?
Well, okay then, I looked, it seems some mods do maintain parallel branches. I uploaded version 0.3.175 which is exactly as 0.4.3 but specified for Factorio 0.17. It should work, but I didn't actually check it, though because I don't have Factorio 0.17 on hand.
Oh, thank you very much! That's really convenient. Now I can do the addon instead of the modified version of your mod ^^. The last updates implemented some of the QoL and bug fixes that I had in mind (and I needed to have).
Thank you again!