trouble with infinite-use wires
Posted: Mon May 22, 2017 12:17 pm
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.
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.