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

From RimWorld Wiki
Jump to navigation Jump to search
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{Rest Hours Per Day|RE=2.15|RRM=2.24|RFF=1|color=1}}
+
<noinclude>{{Documentation wanted}}{{documentation}}</noinclude><includeonly>
 
+
{{#if:{{{color|}}}|<td style="background: hsla(110, 100%, 40%, {{#expr: (1-(1/(((0.0057143 * {{{RE|1}}}  * {{{RRM|1}}}) /(0.00237 * {{{RFF|1}}} )) + 1))-0.65875)/(0.9207-0.65875) round 2}});">|<td>}} {{#vardefineecho: dayPercentageTemp | {{#expr: (1/(((0.0057143 * {{{RE|1}}}  * {{{RRM|1}}}) /(0.00237 * {{{RFF|1}}} )) + 1)) * 100 round 2}}}}%<br><small>({{#expr:{{#var:dayPercentageTemp}}*0.24 round 2}} hrs)</small></td></includeonly>
RE  = Rest Effectiveness
 
RRM = Rest Rate Multiplier
 
RFF = Rest Fall Factor
 
 
 
Where x = sleeping hours.
 
 
 
x * ~0.57143% * RE * RRM = (24-x) * 0.237% * RFR        <br>
 
x/(24-x) = (0.237% * RFR)/(~0.57143% * RE * RRM)        <br>
 
(24-x)/x = (~0.57143% * RE * RRM)/(0.237% * RFR)        <br>
 
(24/x)-1 = (~0.57143% * RE * RRM)/(0.237% * RFR)        <br>
 
24/x    = ((~0.57143% * RE * RRM)/(0.237% * RFR))+1    <br>
 
x        = 24/((~0.57143% * RE * RRM)/(0.237% * RFR))+1 <br>
 
</noinclude>
 
{{#if:{{{color|}}}|style="background: hsla(120, 100%, 50%, {{#expr: (1/(((0.0057143 * {{{RE|1}}}  * {{{RRM|1}}}) /(0.00237 )) + 1)) round 2}});" }}| {{#vardefineecho: dayPercentageTemp | {{#expr: (1/(((0.0057143 * {{{RE|1}}}  * {{{RRM|1}}}) /(0.00237 )) + 1)) * 100 round 2}}}}%<br><small>({{#expr:{{#var:dayPercentageTemp}}*0.24 round 2}} hrs)</small>
 

Revision as of 12:23, 3 September 2022

Documentation icon Template documentation[view] [edit] [history] [purge]

This template calculates how much time, in both percentage and absolute terms, a pawn requires to fully rest per day. It's only truly mean to be used by the tables on 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.
  • This will not work outside a table.

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 exact formulas used by this template are (always rounded to 2 decimals):

  • alpha: (1-(1/(((0.0057143 * 1 * 1) /(0.00237 * 1 )) + 1))-0.65875)/(0.9207-0.65875)
  • Percentage returned: (1/(((0.0057143 * 1 * 1) /(0.00237 * 1 )) + 1)) * 100
  • Hours returned: Percentage returned*0.24

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)
As above, but inside a table.
With color Without color
6.45%
(1.55 hrs)
6.45%
(1.55 hrs)