Scrumch Posted August 22, 2019 Share Posted August 22, 2019 (edited) Hi, My mod for Single Player Don't Starve has already been published, so I'm now working on getting it ready for Don't Starve Together. Some of the perks I've managed to move over successfully and some haven't. Any ideas on the following?: More sanity aura from Glommer Lower maximum body temperature in Winter (so you freeze 'faster') Removing sanity drain from wetness and wet items Thanks you. Edited August 22, 2019 by Scrumch Link to comment Share on other sites More sharing options...
Ultroman Posted August 23, 2019 Share Posted August 23, 2019 First, is this a character mod or a mod that just alters all these things for everyone? More sanity aura from Glommer If this is supposed to be for everyone on the server, it's quite easy. You can simply do: AddPrefabPostInit("glommer", function(inst) inst.components.sanityaura.aura = TUNING.SANITYAURA_MED end) The normal value is TUNING.SANITYAURA_TINY, but you can set it to whatever numeric value you want. The value is amount of sanity drained per second. If you only want to change this for your character specifically, you need to do something a bit more interesting. This code creates a new aura function for calculating the rate-value, which will be used instead of the game using the static "aura" variable. If the observer has a tag that you've given your character, MY_UNIQUE_CHARACTER_TAG, it will use a different rate than everyone else, MY_NUMERIC_VALUE. Otherwise, it checks if there is an existing aurafn (perhaps added by another mod) and if not, it uses the static "aura" value. AddPrefabPostInit("glommer", function(inst) local origAura = inst.components.sanityaura.aurafn local function CalcSanityAura(inst, observer) return observer:HasTag("MY_UNIQUE_CHARACTER_TAG") and MY_NUMERIC_VALUE or origAura ~= nil and origAura(inst, observer) or inst.components.sanityaura.aura end inst.components.sanityaura.aurafn = CalcSanityAura end) Lower maximum body temperature in Winter (so you freeze 'faster') It's hard to directly affect temperatures, because it's all bundled into one big calculation in the temperature component. You can do an assortment of things to achieve this, though. One thing you can't do, is just set your character's inherentinsulation to a negative value, because when winterinsulation is recalculated, it is capped to minimum 0 whatever its value, so setting a negative inherentinsulation will only remove some of the insulation you get from wearing items with winterinsulation on, but will do nothing if you are not wearing any such items. But what you can do are these things: Watch the world season state, and when it becomes winter, you simply add a modifier which directly affects how cold the world is to your character. So, listen for the world season state changes, and then when it changes to winter, you do this: inst.component.temperature:SetModifier("MY_UNIQUE_MODIFIER_NAME", MY_NEGATIVE_VALUE) and when it changes to anything but winter, you do this: inst.component.temperature:RemoveModifier("MY_UNIQUE_MODIFIER_NAME") OR, activate a task when winter starts, which constantly decreases your player's temperature, and then deactivate that task when the season changes to something other than winter. Removing sanity drain from wetness and wet items There is no way to nicely change this without making your mod incompatible with e.g. Sanity Tuner and any other mods which make changes to the Recalc function. The best you can do, is apply the same moisture rate but flip the sign is you basically negate it. Put this in your character's master_postinit local oldRecalc = inst.components.sanity.Recalc inst.components.sanity.Recalc = function(self, dt) oldRecalc(self, dt) -- Basically, we just redo the entire sanity calculation, but only for the moisture part, and flip the sign. self:DoDelta(-easing.inSine(self.inst.components.moisture:GetMoisture(), 0, TUNING.MOISTURE_SANITY_PENALTY_MAX, self.inst.components.moisture:GetMaxMoisture()) * self.rate_modifier * dt, true) end If you using Sanity Tuner, or want to make your mod completely compatible with it, we'll need to do some more work on this, but it shouldn't be too much trouble. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now