Jump to content

"Sit on ground" returns too much stamina?


trombonaught

Recommended Posts

Hi gang. I just did some research for a youtube vid and I found that sitting on the ground is the most efficient stamina recovery method (apart from the hack of sitting on ground AND taking the rest action while doing so).

 

I clocked it at about 0.54 stamina per minute (regardless of time setting), compared to 0.32/minute for chairs and beds or 0.108/minute standing around.

 

Is this a bug or is it working as intended?

 

I'll link to the video timing where I explain it, but basically the info is as above. Version 41.69, only mod is for damage display, and  I performed on sleep enabled as well as sleep disabled server with insane population. All other server settings were default.

 

Link to comment
Share on other sites

"Too much" in comparison to what?

 

Looking at the code, sitting on ground has a 5x multiplier and is same as sitting in a car. Using the "Rest" action on furniture only has a 2x multiplier (and also seems to ignore Sandbox settings and fatigue for recovery). 

 

If anything, the "Rest" action recovers too little. Probably because you can combine the two, which is an odd concept by itself - they should be mutually exclusive, with resting giving a bonus over ground.

Link to comment
Share on other sites

1 hour ago, Tiax said:

"Too much" in comparison to what?

 

Looking at the code, sitting on ground has a 5x multiplier and is same as sitting in a car. Using the "Rest" action on furniture only has a 2x multiplier (and also seems to ignore Sandbox settings and fatigue for recovery). 

 

If anything, the "Rest" action recovers too little. Probably because you can combine the two, which is an odd concept by itself - they should be mutually exclusive, with resting giving a bonus over ground.

Erm... in comparison to furniture, as the post says 😆

 

Where did you find the 2x multiplier? I guess "bug" is the wrong word and I'm more curious just to hear if it's intended or an oversight. Sitting on a dirt floor is currently more restful than sitting on a couch which to me just suggests unintended.

 

(But I got comments like yours back from facebook and discord as well so like, maybe I'm the only person who just doesn't find dirt better than chairs irl 😅)

Edited by trombonaught
Link to comment
Share on other sites

3 hours ago, trombonaught said:

Erm... in comparison to furniture, as the post says 😆

 

Where did you find the 2x multiplier? I guess "bug" is the wrong word and I'm more curious just to hear if it's intended or an oversight. Sitting on a dirt floor is currently more restful than sitting on a couch which to me just suggests unintended.

 

(But I got comments like yours back from facebook and discord as well so like, maybe I'm the only person who just doesn't find dirt better than chairs irl 😅)

The rest action is in the lua files. For the sitting on ground, for comparison, you'll have to dig a little deeper into the java classes. I'll add the formulas/code snippets here, when home.

 

I do agree though: the current system is not really intuitive from a game logic perspective (cold floor > comfy sofa).

 

Edit:

-- lua\client\TimedActions\ISRestAction.lua:13
-- note: self.mul = 2

function ISRestAction:update()
    if self.character then
        local endurance = self.character:getStats():getEndurance() + ((ZomboidGlobals.ImobileEnduranceIncrease * self.character:getRecoveryMod() * self.mul) * getGameTime():getMultiplier())
        if endurance > 1 then endurance = 1 end
        if endurance < 0 then endurance = 0 end
        self.character:getStats():setEndurance(endurance)

        self.character:setMetabolicTarget(Metabolics.SeatedResting);
    end
end
// IsoPlayer.java:2800
// Note: public static double SittingEnduranceMultiplier = 5.0D;

private void updateEndurance(float var1) {
      Stats var10000;
      float var2;

      if (this.isSitOnGround()) {
         var2 = (float)ZomboidGlobals.SittingEnduranceMultiplier;
         var2 *= 1.0F - this.stats.fatigue;
         var2 *= GameTime.instance.getMultiplier();
         var10000 = this.stats;
         var10000.endurance = (float)((double)var10000.endurance + ZomboidGlobals.ImobileEnduranceReduce * SandboxOptions.instance.getEnduranceRegenMultiplier() * (double)this.getRecoveryMod() * (double)var2);
         this.stats.endurance = PZMath.clamp(this.stats.endurance, 0.0F, 1.0F);
      } 
  
  // rest omitted
}

 

Edited by Tiax
Added snippets
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...