Difference between revisions of "Template:Rest Hours Per Day/doc"

From RimWorld Wiki
Jump to navigation Jump to search
m (Improved the documentation. There are 2 values I do not understand: 0.65857 - lowest work % of a day AND 0.9207 - highest work % of a day. Will submit this anyway as it is an improvement.)
m (→‎Syntax: I misunderstood the color section. Now, if those 2 numbers at the end made sense...)
Line 6: Line 6:
 
RRM = Rest Rate Multiplier. Defaults to 1.<br/>
 
RRM = Rest Rate Multiplier. Defaults to 1.<br/>
 
RFF = Rest Fall Factor. Defaults to 1.<br/>
 
RFF = Rest Fall Factor. Defaults to 1.<br/>
color = Optional. It determines the alpha/transparency of hsla(110, 100%, 40%, color), which is ten applies to the "background". It goes from 0 to 1, with 0 being fully transparent and 1 fully opaque.
+
color = Optional. If present, the alpha/transparency of the background colour of this cell will be calculated. The lower the required hours, the less transparent the color
 +
* If not present, the cell will be colorless.
 +
* Internally the color is determined by hsla(110, 100%, 40%, alpha). The alpha values range from 0 to 1.
  
 
The formulas used by this template were obtained by solving the following equation (Where x = sleeping hours):
 
The formulas used by this template were obtained by solving the following equation (Where x = sleeping hours):

Revision as of 18:36, 27 February 2025

This template calculates how much time, in both percentage and absolute terms, a pawn requires to fully rest per day. It's only mean to be used by Template:Rest Hours Per Day, which itself is used in Rest#Comparison_tables.

Syntax

{{Rest Hours Per Day|RE|RRM|RFF|color}}

RE = Rest Effectiveness. Defaults to 1.
RRM = Rest Rate Multiplier. Defaults to 1.
RFF = Rest Fall Factor. Defaults to 1.
color = Optional. If present, the alpha/transparency of the background colour of this cell will be calculated. The lower the required hours, the less transparent the color

  • If not present, the cell will be colorless.
  • Internally the color is determined by hsla(110, 100%, 40%, alpha). The alpha values range from 0 to 1.

The formulas used by this template were obtained by solving the following equation (Where x = sleeping hours):

x * ~0.57143% * RE * RRM = (24-x) * 0.237% * RFR
x/(24-x) = (0.237% * RFR)/(~0.57143% * RE * RRM)
(24-x)/x = (~0.57143% * RE * RRM)/(0.237% * RFR)
(24/x)-1 = (~0.57143% * RE * RRM)/(0.237% * RFR)
24/x = ((~0.57143% * RE * RRM)/(0.237% * RFR))+1
x = 24/((~0.57143% * RE * RRM)/(0.237% * RFR))+1

The final value is then rounded to the second decimal place.

0.65857 - lowest work % of a day 0.9207 - highest work % of a day

Examples:

{{Rest Hours Per Day|RE=2.15|RRM=2.24|RFF=1|color=1}}

7.93%
(1.9 hrs)

{{Rest Hours Per Day|RE=2.15|RRM=2.24|RFF=0.8|color=1}}

6.45%
(1.55 hrs)