Jump to content

Recommended Posts

I know DST doesn't have ROG yet, but I want to put this part in the code for both - DS and DST.


It's about to fix character freezing during winter, but not overheating during summer (more less like Wilson's beard, which won't kill him in summer :p)


Goes in char.lua:

 inst:WatchWorldState("startday", function(inst)	if TheWorld.state.issummer then      inst.components.temperature.inherentinsulation = 0	endend)  	inst:WatchWorldState("startday", function(inst)	if TheWorld.state.iswinter then      inst.components.temperature.inherentinsulation = 125	endend)

Game starts. But when character enters the world such error appears, saying that WorldWatchState is a nil value... 


in everything.. DST and DS and ROG.


I more less know what a nil value is, but just no idea how to fix that here :/



Link to comment
Share on other sites

did you look for a WorldWatchState that should be a WatchWorldState?


That's my typo indeed. I meant WatchWorldState.


Already know that WatchWorldState is DST only... 

So I could use a ListenForEvent then, ye? And then - it should work on all 3 - DS,DST and DS ROG? 

(not really a point of having this for normal NOT-ROGed DS, since you can't overheat but still)

Link to comment
Share on other sites

@Foxrai, if you are trying to code this for both DS/DS:ROG and DST then you need to determine whether or not the engine you are running it in is for DS or DST. The issue is that DST doesn't use ListenForEvent to denote season changes like DS does, so you will have to have additional code for it to work in both. My original Pond Manager mod worked very similar to this in nature, until I broke it apart and decided to test another theory. Look at my previous topics and you should be able to find a working example by simplex on how to accomplish the check for the version. 

Link to comment
Share on other sites

@Kzisor, really appreciate your patience to myself.


Also found this:

The events pushed in singleplayer by the Clock and SeasonManager components ("dusktime", "daycomplete", "rainstart", "seasonChange", etc.) no longer exist in multiplayer, having been replaced by world state watching (e.g.inst:WatchWorldState("isdaytime", callback_fn)), but for cross-compatibility the original events were wrapped using wicker, so from the mod perspective they still exist as they do in singleplayer. What wicker does is, if in multiplayer, intercepting theinst:ListenForEvent() calls for these particular events and replacing them with the corresponding inst:WatchWorldState() calls (and doing the reverse analogue forinst:RemoveEventCallback). Thus, at the mod level, usage remains exactly as in singleplayer, including the contents of the data table passed as the second parameter to some event callbacks.

Made it more clear. So the code:

local function WatchPhase(inst, phase)	if phase == "summer" then	inst.components.temperature.inherentinsulation = 0end	if phase == "winter" then	inst.components.temperature.inherentinsulation = 1233456endendinst:WatchWorldState("phase",WatchPhase,TheWorld)

Should work in DST. Then If I want to make it work in DS/ROG, the easiest way, is to change 



inst:ListenForEvent(...and ye.. what? phase? or winter/summer?). Don't really get what will be the "event" here :/

Edited by Foxrai
Link to comment
Share on other sites

@Foxrai, you want to use the following:


inst:ListenForEvent("seasonChange", OnSeasonChange, GetWorld())


Inside OnSeasonChange you want to use the following:


local season = GetSeasonManager():GetSeason()


Now you can determine the season based on SEASONS enum.

Link to comment
Share on other sites


Wait since my problem is about temperature not some other feature, instead of writing whole lines like this:


inst:WatchWorldState("startday", function(inst)
    if TheWorld.state.issummer then
      inst.components.temperature.inherentinsulation = 0



I can just add it as those simple codes right under stats of Hunger,sanity etc?


inst.components.temperature.inherentinsulation = 123456

inst.components.temperature.inherentsummerinsulation = 123456 (and it's like: 1 - is overheating faster, than for example 100?)


Literally what I want to achieve is character which:


1.acts like Wilson WITH beard during WINTER (so is not freezing SO FAST)

2.acts like Wilson WITHOUT beard during SUMMER (so is not overheating faster and can cool down same quick as other characters)


While point 1 makes cooling down hard in summer.. This I'm wondering if those simple codes will do it :o 

Edited by Foxrai
Link to comment
Share on other sites



ok so I can just use this literally:

nst.components.temperature.inherentinsulation = 120 (<<<that's around rabbit earmuffs value if im right...)

inst.components.temperature.inherentsummerinsulation = 0


And then I won't freeze SO fast in winter like Wilson, but I will be able to cool down in summer like for example Wendy or Willow? Just making sure :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...