Project Zomboid

Project Zomboid

Working Air Conditioners
AC Remote suggestion.
Would be nice to maybe be able to link a remote to an AC unit so then you don't have to go outside to turn it off/on or change settings.
< >
Showing 1-15 of 16 comments
Slayer  [developer] 11 Nov, 2023 @ 7:49am 
Thank, I was thinking about this too. Question arises: which conditioner should the remote control if you have more than one unit? The closest one? Or should they be paired?
noob get rekt 11 Nov, 2023 @ 8:57am 
I think maybe it should work via a "linking" system. Where you hold the remote and pair it to the air conditioning unit you want.
MoonShi 11 Nov, 2023 @ 9:13am 
Well connecting multiple AC to one remote controller would be nice, i mean player can decide how many AC he want to connect to one Remote, also some kind of Temperature regulator that can be attached to a wall would be nice. Temperature regulator can be also attached to Remote, that allow player to manipulate AC without remote by using Temperature regulator instead, TR can have a slot to store Remote inside, or it can be 3D object that allow player place Remote on it, it would helps player to not lost their Remote.

Or some kind of vent system, where player can connect vent input to AC, and connect multiply vent outputs to rooms player wants. This should helps player house to not become AC mess on every wall, also thats makes using Remote very simple cause of one AC for whole house.
Last edited by MoonShi; 11 Nov, 2023 @ 2:36pm
noob get rekt 11 Nov, 2023 @ 11:22am 
Yeah, like a thermostat.
Engine Of Darkness 11 Nov, 2023 @ 11:57am 
I second this (Remote and / or thermostat) because it simplifies handling for multi story buildings after installation of the AC
Redacted 24 Nov, 2023 @ 8:38am 
@Slayer If what you say is correct and there is no house.id, then I bet my left nut the 'indoor mode' and 'outdoor mode' you mention also compliment an 'indoor+generator mode' (or simply said a 'third' temperature template). You should find the if-statement that activates the 'indoor+generator mode' and then add a call-function to a new method inside that method for programmable temperature. Then check for I/O when-loop the generator is on.
Add a custom method to call the programmable temperature method, and simply copy-paste the heater GUI method from the cars for the AC and add some simple math like;

- Heat 3, base indoor temp + 15 degree (fuel consumption up 2/h)
- Heat 2, base indoor temp + 10 degree (fuel consumption up 1/h)
- Heat 1, base indoor temp + 5 degree (fuel consumption up .5/h)
- Neutral
- Cold 1, base indoor temp + 5 degree (fuel consumption up .5/h)
- Cold 2, base indoor temp + 10 degree (fuel consumption up 1/h)
- Cold 3, base indoor temp + 15 degree (fuel consumption up 2/h)

You could also add a version with no additional fuel consumption (easy mode), and a version where higher heating/cooling gives a risk of the AC breaking down or even catching fire (which risks you house/base burning down if you leave it unattended at low conditions)

I think this is what it should possibly look like from what you told me.
Oh! And you shouldn't throw your code away, just use it alongside the general house temperature. The source being a little hotter/colder is offcourse even better for the sake of immersion :)

Would love to see it happen. Very usefull mod idea. Especially for someone like me who plays with dynamic weather (extreme summers and winters). Also, a tidbit of interesting feedback, at extreme temperatures nights don't really cool down that much in extremely hot summers (I'm at 70 degree on average now in peak summer). It would be cool if nights got a lot cooler depending on how hot days are. Might be a nice side-rproject in case you figure out how all the temperature stuff works.
Redacted 24 Nov, 2023 @ 8:45am 
Remote controller could be cool to. I suggested a lightswitch or a clutter-style right-mouse option indoors on the floor. Remote + Lightswitch style both would be supreme.
Redacted 24 Nov, 2023 @ 8:48am 
I just realized something...
If you can make the whole house temperature work... then you could basically turn buildings into giant refrigerators. Which is another insane idea for a mod in and of itself.
That would be another level of convenience alltogether.
Slayer  [developer] 25 Nov, 2023 @ 3:41pm 
Quick responses to your ideas.

I dont know what you mean by "indoor+generator mode". Are you referring to the actual code or making guesses?

Fuel consumption cannot be adjusted. Here is how it works. Every time interval game looks for generators within the cell the player is in, and for each generator scans surroundings. If it finds objects of type fridge, clothing dryer, washing machine etc fuel consumption is adjusted. Each object has its own consumption level hardcoded. No other objects can consume fuel unless.. you hack it a little big like I did. What i did is that i convert air conditioner to a clothing dryer and make it look like air conditioner. The game "thinks" its a clothing dryer during generator scan.

Remote control - I may think about it, it should be doable but may get complicated with multiple units and remotes and confusion what controls what.

Light switch - I need to check how they work.

Giant refrigerators idea - won't work. Freezing works only for containers. This is why food never freezes during winter when left outdoors.
Redacted 26 Nov, 2023 @ 3:31am 
On the first question: What I mean with 'indoor+generator' is basically that there is an indoor, and an outdoor temperature like you said. Well, there should also be a boolean/variable somewhere that tracks if the house you entered is connected to a working generator (or solar cells).
That would be third temperature template, as in, that would be the new mode mathematically to determine the indoor temperature. If you can find that piece of code you can inject/merge a new line of code into it to only specifically work when the generator is connected. So yes, I'm just making guesses but the odds are close to certain the code should be written in only three modes if what you said was correct (since house.ID does not exist, which only leaves a seperate general mode for power-connected indoor temperatures).

On the second part: Well... then maybe you can find a lamp or something to make another powerconsumption setting and repeat the same trick :) (Not sure how to go about it since I didn't deep-dive the code, but I think it's not impossible to manually inject a 'division' function between the hardcoded consumption, and the actual consumption, even if that means creating an intermediary step like "connecting" the AC to a switch, and then the switch to the house/generator. Which would allow you to "transform" the switch with the method you stated before)

On the Remote: I'm not sure if it breaks lore. Besides smartdevices managing temperature I think it's allways been wallcontrols.

On the Light-switch: You could simply copy the light-switch code, and duplicate it with additional code. Then make it a 'craftable' item and slap it on to some wall somewhere. Or you can simply start from scratch and treat it like any other poster or wall-mounted item and add a call function.
Should be fairly straightforward if you can figure out how to make new items (you don't even need custom meshes/textures).

On the freezer: Ah... that's right I suppose. I can't remember meat freezing outside so that's probably a miss. Would be cool of the PZ-team fixed that. Meat not freezing but a player getting hypothermia is kind of immersion breaking :P

Good Luck!
Slayer  [developer] 27 Nov, 2023 @ 1:02am 
There is no connection between generators and rooms. Also generator presence nor state has no impact on any temperature. Generators only impact whether electricity is available for electrical devices within the radius.

There is no way to inject anything. Global in-game function launches periodically and overwrites everything. That function cannot be changed. I can add a new electrical device and set the power to what I want, but in a few seconds that function launches and recalculates everything from the start. It scans surroundings and build a list of connected devices. The list of devices and their power usage is hardcoded. So in the end, you can only imitate one of these devices.

Light switches - well I will give it a try.
Slayer  [developer] 27 Nov, 2023 @ 1:06am 
Remote controls - the feature will be released soon - I am now testing the solution. The way it will work is this: you right click the TV remote and click "Settings", the game looks for the AC unit that is the closest to the player. If such is found the UI panel opens and you can change the settings. I need to add on/off switch to the panel though, because currently it is missing.
Redacted 2 Dec, 2023 @ 11:49pm 
Hmm. Seems i don't get notifications without subscribing. Figures. Anyways...

I've rewritten this, since I found the previous iteration too confusing and messy.

Considering what you've told me, here's my suggested roadmap (if you're inclined to try).

This is what you have to work with;
- a) A global periodical check that corrects calculations on both fuel consumption and temperature.
- b) A limitation (hardcoded) to adjust the indoor global temperature.
- c) A limitation (hardcoded) with fuel consumption regarding hardcoded items

This is what I would be looking at/for next;
- 1) The 'weather mods' (https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2906288518) that already solved the issue of adjusting global temperatures. They bypass vanilla temperature system/functions and have customizable mod settings. Taking parts from this mod will allow you to start with a framework for both solving the hardcoded limitation, as well as allowing you the room to create custom mod settings as well (most likely).
What you're looking for is; a) the function that adds/removes degrees from the standard weather patterns using those mod settings. That should be a function, nested within the general function boundairies of the mod itself. This nesting script is what you should copy-paste and use as a starting point to adjust temperature. b) a way to inject a function call to adjust the temperature mid-game (instead of during mod settings) with a "remote" or "switch" etc.
- 2) The vanilla code trigger that changes temperature when transitioning from outdoor to indoor cells, and vice versa. Probably something related to the periodical check that re-checks if you're still indoors. Either way, it would be best if you had a literal trigger that happens with each step transitioning indoor-outdoor as you move around in the world (not sure how the game checks this ofc), besides having the global periodical check itself. Considering it seems to exist in-game (as temperature adjusts, even when moving from 1F to 2F it changes, which might be an alternative option to look for), there must be something you could use.

When you have those, you can;
- 3) Create a new scripted button/option on the right-click menu for any lamp of your choosing for testing purposes. The option should be your 'test-case'-trigger, while the lamp functions as a diode to see if your mod is either on/off. (This step is simply to avoid having to first figure out how to build that switch/remote/whatever). The lamp already has a static fuel consumption rate, is already recognized by the generator etc. And serves as a diode to both check if fuel consumption, lamp light (diode) as well as the debugged output boolean of your function matches. If either shows strange behaviour you know it's broken).
- 4) Create a script attached to that button/option in the right-click menu. This is where your function call will be written. Add a little test boolean inside it. 1=on 0=off. It doesn't have to do anything other than register for testing purposes.
- 5) Create boolean checks for the periodical check; a) lamp on/off b) generator on/off. Nested respectively and you can guarantee yourself that you're on the right track if the periodical check recognizes your test-boolean from step (4)
- 6) You are now safe to assume your 'trigger' for whatever switch/remote you may decide on is functional and you can start writing the method to alter temperature.

Figuring out the scripted function;
- 7) You take what's learned from (1), the nested functions, and duplicate and adapt it. You put any needed function-calls under your 'trigger' (the lamp button). As long as you change temperature when turning the lamp on at this point, you're gonna be fine. (Doesn't have to be, and likely won't be, indoors only. For now that is fine.)
- 8) You write a sub-routine function, which could be that 'car-GUI' function if you found it, for adjusting temperatures in the car and now the room (you just use the on/off button now as an intermediary step for turning the "lamp" on/off). It could be a little test noise if you don't want much trouble, anything really. Just to create a new third aspect to both the global periodical checks, and the manual trigger, to see if things function as you expected them too. Considering what you learned. Another boolean for debugging is fine too, but something visual/auditory is always best because it actually does something, and shows you that putting some script between turning the lamp on, and it actually turning on doesn't break down the function.
- 9) Then change that subroutine to compensate for being at indoor-outdoor cells. You want to exclude the subroutine for outdoor cells now. Which is probably the hard part. Offcourse, there is allways the chance you figured this out already before reaching this point, but everything up until point (8) should be possible within the vanilla boundairies (considering the weather mod already proves you can mess with global weather variables). My best bet is that you're gonna use both some function that happens when you move from cell to cell, as well as some inherent check performed by the periodical check (since if they both exist as triggers for change, they might conflict when you only use one of them. Probably giving priority to the global periodical check. You should test for this and make sure that moving inside and outside a house doesn't break your mod up until this point). If you got the indoor excluded from the outdoor, without making either of them static temperatures, you probably did it right and the rest will be a matter of personal preference.

Considering your last response reading;
"That function cannot be changed. I can add a new electrical device and set the power to what I want, but in a few seconds that function launches and recalculates everything from the start. It scans surroundings and build a list of connected devices. The list of devices and their power usage is hardcoded. So in the end, you can only imitate one of these devices."

This is similar to what I mentioned a few lines above, where both the actual real-time trigger as well as the global periodical check, exist and conflict and the global periodical check takes priority. It's probable you missed the means to also effect the global periodical check, but this isn't mandatory to make the mentioned part of the mod work, since I suggested a workaround basically by switching actual hardcoded items. So the periodical check will simply register a different item.

My point was that you simply use multiple items by transforming one into another as-is. So you don't have to adjust any fuel consumption of any item for the generator to recognize the right values. You make another function, which you bind to the right-click button menu for the test-button lamp, which changes the lamp into a fridge, then into a toaster, into a jukebox, etc. (for different fuel consumption rates/values).
This is offcourse a very redundant and inefficient way of coding, but considering the possible limitations you adressed, this might be a work-around. And since the check only checks if it's 'any particular item' at the time of the check, this shouldn't be too much of a pain performance wise either. It's just one item like in a vanilla situation. Your additional function simply transforms on item into the next (same as wearing a sheathed katana, and unsheathing it for example as an analogy. The sheath remains worn, like how the "item" remains connected to the right fuel consumption, but not neccesarily to the generator which you might have to bypass by forcing a 'reconnect' script within the 'change item script'). Like say, when you have a female mannequin, and turn it into a male mannequin, and it still has to have the same container, so it wears the same clothes. Or how you give them a different poses likewise. They're all different items that serve similar functionality. You can thus make them interchangable without too much hassle. And in this use-case you offcourse only care about the specific hardcoded amounts of fuel consumptions, and the fact it stays connected to the generator (which can be enforced, by scripting a line for disconnect.generator() and connect.generator(), to make sure it allways stays connected).
With that logic in mind;
1) Find a mod that connects anything to the generator, and look at their functions. If they make use of the hardcoded values for fuel consumption you can simply copy-paste their 'new items' as a template and change anything about the item you need/like functionally/aesthetically (you found yourself a way to create duplicate items that don't clash with vanilla items for fuel calcs and can connect to a generator). If it adds(!) a completely new item with it's own non-hardcoded fuel consumption rates, well... you found yourself a way to avoid any merging issues with other mods that effect existing hardcoded vanilla items completely, and can do whatever you want with those items and their fuel consumption, making things a lot easier. Which offcourse is most preferable.
2) Sticking with the first scenario (you're tied to using existing/hardcoded items as a means to regulate fuel consumption), you simply create abovementioned 'item-transformer'-script. I think there was a mannequin mod which allowed you to change poses/gender. That would hold a basic script for transforming items from one into the next probably, most likely, almost sure. (Not really though) :)
You simply strip it down, and instead of poses/gender, you take appropriate fuel consumption levels and connection to the generator as core considerations. (All you really need are 2 settings, normal consumption, and high consumption, but all this is ultimately unneccesary if you don't want different fuel consumption levels, but it could be immersive and challengewise very reasonable if you have different temperature settings, and anyone plays in extreme temperatures... which is really where temperature indoor only really matters, so I suggest it for finese sake. And for my sake ngl :P)
3) When you have the items switching you'll most likely run into some issue with the fuel consumption not registering well when you change it when it's on/off. Forcing players to first turn off the device, then change the item for higher consumption, then off, yadayada, very tedious stuff. You'll have to write a little automated script to do that for them whenever they change temperature just to make sure the generator registers the right fuel usage (just like previously mentioned issue with the connection), so players don't abuse it to cheese the cryogenic winter/scorching summers with lower fuel consumptions. They're supposed to be bound indoor and need to think about their fuel supplies to last through those extreme temperatures (I already play like this, so it's the general MO, and yes I'm helping because I care :P).

Anyways, when you figured that out you got your alternate fuel consumption/temperature settings ready, alongside offcourse the previous mentioned framework to get your global temperature setting properly adjusted (including the baseline to add additional script so it can be entered into mod settings for personal preferences). All that's left is fine-tuning and adding several settings (and deciding on the default). I'd love to see the round GUI from cars directly on the AC itself offcourse, but you could do a remote, a switch in the room somewhere. It's all up to you.

Just make sure the two booleans for both the device being on/off, and the generator on/off being functional at every step, and if that somehow changes temperature after everything you chose to do you didn't break it :) (Obviously, but keep testing it anyways so you won't waste your valuable time and have to backtrack where it broke if it does). The global periodical check you mentioned only needs to track these two booleans as far as I can tell now, and it already has that functionality (since items have fuel consumption already, can connect to generator already, and the essence of every mod is a list of booleans basically). So that shouldn't be a limitation.
Also, compensating for temperature shouldn't be a 'seperate global temperature', but a function within the existing function framework you took from the weather mod. It should add/remove degrees, not replace it. If you do that right, probably you can simply stack your current mod functions on top of it as-is as well, to add an additional layer of cooling/heating near the source. Ultimate immersion achieved.

I think something like this roadmap should help you along, be you so inclined to do so. :)
Just trying to be helpfull.

Also, maybe your current IDE (especially if you work with stuff like notepad++) might not have great merging-tools. Try finding a tool that allows for clear merging changes. If need be use cloud-repositories to cover that process of checking mergers for you (since stuff like GIT etc are basically giant merging tools). Those tools can really help when analyzing those weather or other mods to draw inspiration from on how to solve mentioned problems/situations. They basically ignore all the non-relevant code that is not changed and will show you exactly what is altered in the script by those mods compared to the files they're supposed to replace, which will immensely lower the time needed to sift through code and understand/backtrack what is happening. Basic programmer stuff, but level-entry modders probably don't know much about testing/debugging etc. So it's an useful sidenote for learning purposes (just in case you're yolo'ing it on pure willpower and determination). Offcourse there is much better advice, tips, tools... but didn't want to sound condescending or act like I know better. Just trying to help you proceed with fleshing out a great idea for a mod wherever I can. :)

Either ways. GG, great mod that needed to be done, and I tip my hat to you sir.

P.S. after adding the link to the highly unpopular (for some unknown reason) perfect weather mod. I just realized you could use it as well for testing those extreme weather conditions whenever you do make it to the finish line and want to fine-tune the effects of cooling/heating. Imo running the heater/cooler on highest settings should consume more fuel :P
Also, another test you must keep in mind to see if the mod doesn't break down, is moving from 1F to 2F. It affects temperature for some reason and I used it as an example before, but just realized it's pretty important to take it into account everywhere during tests.
Last edited by Redacted; 3 Dec, 2023 @ 2:46am
Krilton 25 Dec, 2023 @ 9:28pm 
@slayer why don't you look at this mod: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2866223444

and see if it gives some useful ideas for remote controlling multiple units.
Ancell 15 Jan, 2024 @ 1:55pm 
I would like to be able to link several air conditioners to one remote control in order to turn them on/adjust them at once
< >
Showing 1-15 of 16 comments
Per page: 1530 50