Jump to content

No sanity loss from monster/raw meat.


Recommended Posts

I'm looking for a way to make it so that my character doesn't lose sanity from both monster meat, and raw meat.


I'm not that experienced with modding don't starve together, so it would be appreciated if I was told where to put the code, and what parts of the code I need to re-name to match my character prefabs.

Link to comment
Share on other sites

Do what zUsername said to make your character eat monster meat, but raw meat is still an issue. This is what I did:

 

--in modmain.lua

 

function RawMeat(inst)inst:AddTag("rawmeat")endAddPrefabPostInit("meat", RawMeat)AddPrefabPostInit("smallmeat", RawMeat)AddPrefabPostInit("drumstick", RawMeat)AddPrefabPostInit("froglegs", RawMeat)AddPrefabPostInit("batwing", RawMeat)AddPrefabPostInit("trunk_summer", RawMeat)AddPrefabPostInit("trunk_winter", RawMeat)AddPrefabPostInit("humanmeat", RawMeat)AddPrefabPostInit("plantmeat", RawMeat)

This adds a tag to all raw meat items that lower sanity (minus monster meat, which you already won't have penalties for). Conveniently, they all lower sanity by 10.

 

in character.lua, above master_postinit:
 

local function food(inst, food)  if inst.components.eater and food:HasTag("rawmeat") then       inst.components.sanity:DoDelta(10)   end end
then in master_postinit, add:

inst.components.eater:SetOnEatFn(food)
 
I also found the following functions:
inst.components.eater.ignoresspoilage = true
inst.components.eater:SetCanEatRaw()
inst.components.eater:SetCanEatHorrible()

The first being WX-78's perk. I actually don't know what the other two do, but I have them included in my master_postinit  :indecisiveness:
 
EDIT: Okay so this doesn't work for human meat (you lose more sanity than 10, also health), which is fine because there's currently no way to get it besides console commands. The one problem this has is that it still pulses your sanity green (since you're telling it to gain 10 right after losing it) and you hear the sound for sanity loss. Not sure how to fix those though.
Edited by StarmanUltra
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
 Share

×
  • Create New...