trouble with infinite-use wires

Place to get help with not working mods / modding interface.
Post Reply
Roblin
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Nov 22, 2016 12:06 pm
Contact:

trouble with infinite-use wires

Post by Roblin »

I am trying to make a mod that makes red wires, green wires and copper cables not be consumed when drawing wires (obviously the costs of red and green wires would be changed to compensate).
my first idea was to check if I can make the wire items not be consumed when they are "placed", but my assumption is that that would require me to be way more knowledgeable of the backend than I am, so I have not explored this option much.

my second idea, which seems more feasable, is to give the player another wire whenever one is used, but there I have run into another roadblock.
the only detectable event that happens when a wire is placed (I have checked all of them) is on_cursor_stack_changed, but that also triggers a lot of the time when I don't want to give the player a free wire, such as when they pick up or put things in their inventory, pick up/put them in the quickbar, pick up/drop them on the ground etc.

but placing things in the inventory and putting things in the quickbar are detectable events, and it would be possible to keep a record of what the inventory and quickbar is before and after the cursor changed, to filter out those events.
the situations that are the problems are when you put items in a chest or in your trash slots, which don't cause any events to trigger, which means there is no way to distinguish whether the player placed a wire between two connectable things or whether it simply put a singular wire in a chest or in their trash slots.

so I am asking for help: what do I need to do to get the behaviour that I am looking for? is it even possible?

p.s. so far the other mods I have seen that tries to make it less annoying that wires go away permanently all seem to make wires cheaper in some way, but I want to use a mod that can turn any item into a recyclable material and if its possible to get large quantities of product from small quantities of ingredients then that would break that system, so I don't consider that a solution.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: trouble with infinite-use wires

Post by mrvn »

Sorry to be unhelpful. I don't know the modding API. But this spiked some thoughts so I wanted to reply.

I think the way copper wires are free when you place power poles is wrong. Which, I believe, is also why removing a wire doesn't give you a wire. You would get free copper wire by destroying power poles while they cost nothing to place.

So my thinking is that power poles should no longer cost copper wire to MAKE but instead cost copper wire to place, one wire per connection. It would then make sense that destroying a pole (or removing a single wire) would give you back the wire that was placed there. But that I assume would require changes in the game itself.

Sigor
Burner Inserter
Burner Inserter
Posts: 19
Joined: Sun Nov 20, 2016 5:07 pm
Contact:

Re: trouble with infinite-use wires

Post by Sigor »

That's why I don't agree with you:
Imagine such a situation:
Image
(sry for the quality)

Lemlin
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Thu Mar 17, 2016 10:25 am
Contact:

Re: trouble with infinite-use wires

Post by Lemlin »

Increase stack size for wires to an insane amount, then change the recipe so it create a full stack. 10k would be cool.

Roblin
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Nov 22, 2016 12:06 pm
Contact:

Re: trouble with infinite-use wires

Post by Roblin »

@sigor
Not sure if you disagree with me or with the post above you, but either way I don't understand what point you are trying to make with your picture.
I get that it depicts a mess, but who suggested anything that would make a mess?

@slimey
While that would work to solve the problem with red and green wires, it wouldn't work for copper cables and also that would interact with a different mod I use in a way that would be... undesireable.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: trouble with infinite-use wires

Post by mrvn »

He's trying to say that you would require an insane amount of copper wires to place that one pole.

But hey:

A) it does use an insane amount of wire.
B) I think the number of wires a pole can have is limited far below that. At least at some point they aren't added automatically anymore.
C) If you manage to get that many poles close together then some poles and wires will be redundant. Destroy the poles or take back the wires.

Sigor
Burner Inserter
Burner Inserter
Posts: 19
Joined: Sun Nov 20, 2016 5:07 pm
Contact:

Re: trouble with infinite-use wires

Post by Sigor »

@Roblin
I disagree with the post written by mrvn who wrote the following:
Sorry to be unhelpful. I don't know the modding API. But this spiked some thoughts so I wanted to reply.

I think the way copper wires are free when you place power poles is wrong. Which, I believe, is also why removing a wire doesn't give you a wire. You would get free copper wire by destroying power poles while they cost nothing to place.

So my thinking is that power poles should no longer cost copper wire to MAKE but instead cost copper wire to place, one wire per connection. It would then make sense that destroying a pole (or removing a single wire) would give you back the wire that was placed there. But that I assume would require changes in the game itself.
My point was to show that such activity (placing copper wires) would require a lot of time. I can't imagine placing every single copper wire in a mega factory.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: trouble with infinite-use wires

Post by mrvn »

I don't want you to place every copper wire. I want the wires placed automatically to cost you copper wire. And destroying a wire gives it back.

And yes, putting in a new power post in nest of others would be much more expensive. But usually a new power pole only adds 1-4 wires. Figure out an average from a game and adjust the wire costs accordingly if it's too far off.

Post Reply

Return to “Modding help”