|
@@ -303,7 +303,30 @@ if $ARGS[0] = 'dream':
|
|
|
gs 'stat'
|
|
|
gs 'dreams', 'start'
|
|
|
|
|
|
- :loopson
|
|
|
+!! to avoid sleeping the whole day I decide to calcululate the duration of the sleep in advance
|
|
|
+!! the quality of the sleep depends on many factors, so the time of sleep can be modify later, especially the part when the time of sleep is shortened
|
|
|
+
|
|
|
+ varsleep['time_to_full'] = (100 - pcs_sleep) * 4
|
|
|
+!! fully exhausted Sveta can recover in 420 minutes = 7 hours of sleep
|
|
|
+!! healthy Sveta can hardly sleep more then 10 hours = 600 minutes
|
|
|
+!! so we can add about 3 hours to time to full as a limit
|
|
|
+ varsleep['time_to_full'] += 150 + rand(0,60)
|
|
|
+
|
|
|
+ varsleep['time_now'] = daystart*1440 + hour * 60 + minut
|
|
|
+
|
|
|
+
|
|
|
+ if alarm_holiday = 1 and (kanikuli > 0 or week > 5):
|
|
|
+ varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
|
|
|
+ elseif week > 5:
|
|
|
+ varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
|
|
|
+ else
|
|
|
+ varsleep['alarm_time'] = daystart*1440 + timer * 60 + timerM
|
|
|
+ end
|
|
|
+ if varsleep['time_now'] >= varsleep['alarm_time']: varsleep['alarm_time'] += 1440
|
|
|
+
|
|
|
+ if budilnikOn = 1: varsleep['minutes to wakeup'] = min(varsleep['time_to_full'], varsleep['alarm_time'] - varsleep['time_now']) else varsleep['minutes to wakeup'] = varsleep['time_to_full']
|
|
|
+
|
|
|
+ :loopson_bed
|
|
|
minut += 1
|
|
|
stime += 1
|
|
|
if recuperation = 0:pcs_health += 5
|
|
@@ -353,21 +376,9 @@ if $ARGS[0] = 'dream':
|
|
|
gs 'stat'
|
|
|
end
|
|
|
|
|
|
- alarm_now = hour * 60 + minut
|
|
|
- if alarm_holiday = 1 and (kanikuli > 0 or week > 5):
|
|
|
- alarm_time = timerEnd * 60 + timerEndM
|
|
|
- elseif week > 5:
|
|
|
- alarm_time = timerEnd * 60 + timerEndM
|
|
|
- else
|
|
|
- alarm_time = timer * 60 + timerM
|
|
|
- end
|
|
|
- alarm_set = alarm_time - rand(1,5)
|
|
|
- if alarm_set <0:
|
|
|
- alarm_set += 1440
|
|
|
- elseif alarm_set >= 1440:
|
|
|
- alarm_set -= 1440
|
|
|
- end
|
|
|
|
|
|
+ varsleep['minutes to wakeup'] -= 1
|
|
|
+ if varsleep['minutes to wakeup'] > 0:jump 'loopson_bed'
|
|
|
|
|
|
if slept_in = 1:
|
|
|
gs 'stat'
|
|
@@ -387,10 +398,9 @@ if $ARGS[0] = 'dream':
|
|
|
$waketext = 'Your alarm goes off at <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, '+iif(pcs_sleep < 90, 'but you could do with some extra sleep.', 'and you''ve had plenty of sleep.')+''
|
|
|
gs 'bed2', 'extra'
|
|
|
gs 'bed2', 'wake'
|
|
|
- else
|
|
|
- jump 'loopson'
|
|
|
end
|
|
|
*nl
|
|
|
+
|
|
|
'<<$waketext>>'
|
|
|
end
|
|
|
|