Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Lab Assistant
Original Poster
#1 Old 13th Jan 2018 at 7:22 PM
Default Two Semi-Related Questions About Utilities
What is it that dictates whether a certain object relies on power/water to function? Example being: is there a way to switch off the water requirement from a custom sink that's just a bucket of water or a washstand?

Second (more expansive, really) question re: utilities: What is it that toggles the utilities on and off? I've looked through the xmls etc but I can't find much. Is there a way to make a toggle so you can turn it off and on at will without having to just not pay the bills? (Is there a mod for that already?)

"Whatcha doin'?"
"Probing your mind."
"Kinda roomy, innit?"
Advertisement
Deceased
#2 Old 14th Jan 2018 at 11:59 AM
Quote: Originally posted by Madam Doofie
What is it that dictates whether a certain object relies on power/water to function? Example being: is there a way to switch off the water requirement from a custom sink that's just a bucket of water or a washstand?

There's two sets of XML tuning tags affecting utility requirements. The first, in the object tuning itself (e.g. object_sink) is the "delinquency_state_changes", which allows the object's state to be changed when a utility is turned off - in the case of the sink it is forced to "unbroken" so that it shouldn't spout puddles if it was broken when the utilities are turned off. Once the utilities come back on and the sink is used, it will immediately become broken again since the object was never really fixed. This code is also used to turn off stereos and TVs and such when the power goes out.

The second section of XML tags is in the interactions used by the objects, typically the last item in the interaction, the "utility_info" tag. Specifying these tags are what prevent an action from being performed, e.g. sink_washHands, when the utility is shut off.

So to make a new sink that doesn't require water you would need to write a new object tuning, basically a copy of the existing sink tuning, that doesn't have the delinquency state change AND write all new interactions for that object (again, basically copies of the existing ones) that don't have the utility tags as well.
Quote:
Second (more expansive, really) question re: utilities: What is it that toggles the utilities on and off? I've looked through the xmls etc but I can't find much. Is there a way to make a toggle so you can turn it off and on at will without having to just not pay the bills? (Is there a mod for that already?)

The utilities are toggled off by the delinquency of bill payments, and that's triggered in the Python scripts. There are two methods in the utilities_manager, one for shut_off_utility() and one for restore_utility(). The first is called whenever the bills become delinquent, and the second is triggered if and when the bills are payed and I don't know of any reliable way to switch those on and off strictly via XML. There is an XML debug cheat (not normal testingcheats) for setting bills delinquent called "Mailbox_MakeBillsDelinquent_Debug" but this appears to only work if there is already a bill currently due (not overdue, but already in mailbox).

Just from a quick look and from what I've played around with before, I'd say the only way to switch power or water off reliably without dealing with the utility billing stuff would be to use a script mod. I suppose you could, if you're only wanting to do it for your custom object, create an object state that "fakes" a utility on/off so you can just change the state of the object and test for that state in your interactions - but be warned that would only work on that single object (so if the player had two of those objects in a household, each of those would have separate utility on/off switches so to speak). Messy.
Back to top