I’m trying to add a mod to tools that allows them to run off of a UPS. There appears to be a generic call for all tools that checks if they have enough charges to perform their function, one being called outside of iuse. I, however cannot find it. I have searched with both the github repository and data files for multiple terms and yet it still eludes me. T_T (This has happened on multiple occasions)
If someone could point me towards the correct function/file, I would greatly appreciate it.
Do a search for “use.call(”. That should highlight all of the times where an item use function is called, some of which should be where you need to make your changes at.
Still no luck. I found an iuse_transform method that seemed promising but it still appears to be called after the game checks for charges.
So what exactly are the side effects that you are having that are leading you to believe said check exists somewhere in the code?
When I go to use an electrical object that I have my mod equipped too, I still get a " your item has 0 charges but needs 1". Even though I have added or checks to all the respective if’s. I’ve even changed the message posted at all the suspect places, but still get this same message.
Most immediate idea is to search for “charges but needs”. That should give you the message, and from there the check that triggers it?
I would assume so, but github search function apparently can’t find those three words side-by-side in all of the code.
src/player.cpp:8718: "Your %s has %d charges but needs %d.",
helpfully useless,
eai
p.s. player::use function…
Ah yeah, the github search is horrible. My general method is to just open up all the files in Notepad++ and then do a “find in all open files”, since the github online editor isn’t that great either compared to editing it locally and then pushing your changes through one of the various github-compatible apps.
[quote=“elauminx, post:8, topic:5937”]
src/player.cpp:8718: "Your %s has %d charges but needs %d.",
helpfully useless,
eai
p.s. player::use function…[/quote]
That… Is exactly what I was looking for. Bless your face, sir.