Jump to content

Curious about sanity.penalty being applied globally


seronis

Recommended Posts

Is the penalty applied in a sanityaura really supposed to be applied globally, ignoring distance to player?  In the sanity component you see the following code for determining penalty:

function Sanity:RecalculatePenalty()   self.penalty = 0   for k,v in pairs(Ents) do      if v.components.sanityaura and v.components.sanityaura.penalty then         self.penalty = self.penalty + v.components.sanityaura.penalty      end   end   self:DoDelta(0)end

Unless im forgetting something 'Ents' is the global entity list.  The code above isnt checking how far away these sources are.  Is this intended behavior ?

Link to comment
Share on other sites

Except it is called by the game.  GameLogic.lua  line 873 during world init.  Err also shadowwaxwell.lua line 29 and waxwelljournal.lua line 53.   So its being used by the game definitely. Im just curious if its a bug that distances are not checked.

Link to comment
Share on other sites

@seronis

 

The sanity penalty is not applied to the current sanity, but to the max sanity.

(sanity.lua)

function Sanity:GetMaxSanity()	return (self.max - self.penalty)end

You are correct that it checks globally, and that is the intended behaviour. Shadowwaxwell decreases the player's max sanity when spawned, regardless of where he is in the world.

 

Link to comment
Share on other sites

Yeah i know its applying to max sanity which will drop your current sanity if it was above the new max. Im making some personal tweaks to how max sanity is determined and I wanted to make sure I wasnt making bad assumptions about the penalty, and if this was considered a bug i was just gonna fix the bug in my code. And mostly since im making max sanity a dynamically changing thing i didnt want to introduce any bugs as i mess around with it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...