3 Revize 8f9a1518a4 ... 287d52a2c0

Autor SHA1 Zpráva Datum
  Scarlett Schäfer 287d52a2c0 Nicer Messages před 2 roky
  Scarlett Schäfer beb7d93cdb Fix: Doing Stuff in Kitchen před 2 roky
  Scarlett Schäfer cb1505d582 Missing School před 2 roky

+ 11 - 5
source/event/school/calendar.qsps

@@ -2,13 +2,19 @@
 
 if $ARGS[0] = 'schoolMode':
 
-    gs 'event_school_calendar','schoolModeCalculate'
+    if ARGS[1] = 0:
+        _time_schoolMode = time_current
+    else:
+        _time_schoolMode = ARGS[1]
+    end 
+
+    gs 'event_school_calendar','schoolModeCalculate',_time_schoolMode
 
-    _dayOfWeek_esc = FUNC('util_time','dayOfWeek',time_current)
+    _dayOfWeek_esc = FUNC('util_time','dayOfWeek',_time_schoolMode)
 
-    if time_current >= school_calendar['vacation_summer_start'] and time_current < school_calendar['vacation_summer_end']:
+    if _time_schoolMode >= school_calendar['vacation_summer_start'] and _time_schoolMode < school_calendar['vacation_summer_end']:
         $RESULT = 'vacation_summer'
-    elseif (time_current >= school_calendar['vacation_xmas_start'] and time_current < school_calendar['vacation_xmas_end_nextYear']) or time_current < school_calendar['vacation_xmas_end_thisYear']:
+    elseif (_time_schoolMode >= school_calendar['vacation_xmas_start'] and _time_schoolMode < school_calendar['vacation_xmas_end_nextYear']) or _time_schoolMode < school_calendar['vacation_xmas_end_thisYear']:
         $RESULT = 'vacation_xmas'
     
     elseif _dayOfWeek_esc = 5 or _dayOfWeek_esc = 6:
@@ -18,7 +24,7 @@ if $ARGS[0] = 'schoolMode':
     end
     
 elseif $ARGS[0] = 'schoolModeCalculate':
-    gs 'util_time','timeInfo_load',time_current
+    gs 'util_time','timeInfo_load',ARGS[1]
     _year = time_year
     if school_calendar_calculatedYear ! _year:
 

+ 12 - 0
source/event/school/schoolday.qsps

@@ -67,7 +67,18 @@ elseif $ARGS[0] = 'initialize':
 
     gs 'util_vars','set','school','initialized',1
 
+elseif $ARGS[0] = 'checkPresence':
 
+    _today = (ARGS[1] / 86400) * 86400
+    _lastPresence = (FUNC('util_vars','get','school','last_presence') / 86400) * 86400
+
+    if _lastPresence < _today:
+        if FUNC('event_school_calendar','schoolMode',_today) = 'schoolday':
+            gs 'util_message','add','Warning','You missed a day of school.'
+        end
+    end 
+
+    gs 'util_vars','set','school','last_presence',time_current
 
 elseif $ARGS[0] = 'execute':
     xgt 'event_school_schoolday','social'
@@ -137,6 +148,7 @@ elseif $ARGS[0] = 'performance':
 
     _seconds_to_endOfSchoolday = FUNC('util_time','timeUntilTimeOfDay',FUNC('util_vars','get','school','time_end'))
     gs 'util_time','pass',_seconds_to_endOfSchoolday
+    gs 'util_vars','set','school','last_presence',time_current
 
     act 'Leave':
         gt 'util_event','end','school_grounds'

+ 4 - 4
source/location/family/apartment/kitchen.qsps

@@ -14,18 +14,18 @@ elseif $ARGS[0] = 'show':
     end
 
     if food_low > 0:
-        gs 'util_action','render_action','Cook a low quality meal|You can cook this <<food_low>> times','gt ''location_residential_aparment_kitchen'',''cook'',''low''','','','R'
+        gs 'util_action','render_action','Cook a low quality meal|You can cook this <<food_low>> times','gt ''location_family_aparment_kitchen'',''cook'',''low''','','','R'
     end
 
     if food_med > 0:
-        gs 'util_action','render_action','Cook a medium quality meal|You can cook this <<food_med>> times','gt ''location_residential_aparment_kitchen'',''cook'',''med''','','','R'
+        gs 'util_action','render_action','Cook a medium quality meal|You can cook this <<food_med>> times','gt ''location_family_aparment_kitchen'',''cook'',''med''','','','R'
     end
 
     if food_high > 0:
-        gs 'util_action','render_action','Cook a high quality meal|You can cook this <<food_high>> times','gt ''location_residential_aparment_kitchen'',''cook'',''high''','','','R'
+        gs 'util_action','render_action','Cook a high quality meal|You can cook this <<food_high>> times','gt ''location_family_aparment_kitchen'',''cook'',''high''','','','R'
     end
 
-    gs 'util_action','render_action','Drink water','gt ''location_residential_aparment_kitchen'',''drink'',''water''','','','R'
+    gs 'util_action','render_action','Drink water','gt ''location_family_aparment_kitchen'',''drink'',''water''','','','R'
 
 
 

+ 12 - 4
source/location/school/grounds.qsps

@@ -11,10 +11,18 @@ elseif $ARGS[0] = 'show':
 
     gs 'util_location','render_title','School Grounds'
 
-    if FUNC('util_time','sunPosition',-1) = 'night':
-        gs 'util_image','render_image','locations/school/ground_night.jpg'
-    else
-        gs 'util_image','render_image','locations/school/ground.jpg'
+    if FUNC('util_time','season',-1) = 'winter':
+        if FUNC('util_time','sunPosition',-1) = 'night':
+            gs 'util_image','render_image','locations/school/ground_night_winter.jpg'
+        else
+            gs 'util_image','render_image','locations/school/ground_winter.jpg'
+        end
+    else:
+        if FUNC('util_time','sunPosition',-1) = 'night':
+            gs 'util_image','render_image','locations/school/ground_night.jpg'
+        else
+            gs 'util_image','render_image','locations/school/ground.jpg'
+        end
     end
 
     gs 'util_location','render_goto','residential',300,'Leave'

+ 22 - 0
source/onNewloc.qsps

@@ -42,6 +42,28 @@ $_style = '
         max-width: 80%;
     }
 
+    .message{
+        text-align:center;
+        font-size: 120%;
+        font-weight: bold;
+        border-radius: 1rem;
+        border: solid black 3px;
+    }
+
+    .message.Error{
+        background: red;
+    }
+
+    .message.Info{
+        background: CornflowerBlue;
+    }
+
+    .message.Warning{
+        background: yellow;
+    }
+
+    
+
     .npcGrid{
         display:grid;
         grid-template-columns: repeat(auto-fit, 150px);

+ 2 - 0
source/start/male.qsps

@@ -24,6 +24,8 @@ act 'Schoolboy':
     gs 'start_finalize'
 
     gs 'util_vars','set','school','isStudent',1
+    gs 'util_timed','registerDaily','checkSchoolDay',"gs 'event_school_schoolday','checkPresence',_execution_time",14*3600+1800
+
 
     gs 'util_item','add_item','casual_male1','0'
     gs 'util_wardrobe','wear_item','casual_male1','0'

+ 1 - 1
source/util/message.qsps

@@ -9,7 +9,7 @@ elseif $ARGS[0] = 'show':
 
     :LoopMessages
     if i < ARRSIZE('$message_type'):
-        *PL '<<$message_type[i]>>: <<$message_text[i]>>'
+        *P '<div class="message <<$message_type[i]>>"><<$message_text[i]>></div>'
         i += 1
         jump 'LoopMessages'
     end

+ 20 - 0
source/util/time.qsps

@@ -108,6 +108,8 @@ elseif $ARGS[0] = 'pass':
     
     temp_time = FUNC('util_time','add',ARGS[1])
 
+    gs 'util_timed','execute',time_current,temp_time
+
     temp_tickHourTarget = temp_time / 3600
     temp_tickDayTarget = temp_time / 86400
 
@@ -115,6 +117,8 @@ elseif $ARGS[0] = 'pass':
 
     gs 'util_body','hair_grow_dayly',temp_dayTicks
 
+
+
     time_current = temp_time
     time_tickDayLast = temp_tickDayTarget
 
@@ -124,6 +128,22 @@ elseif $ARGS[0] = 'pass':
 elseif $ARGS[0] = 'pass_rand':
     gs 'util_time', 'pass', rand((ARGS[1]*90)/100,(ARGS[1]*110)/100),$ARGS[2]
 
+elseif $ARGS[0] = 'season':
+    if ARGS[1] < 0:
+        gs 'util_time','timeInfo_load',time_current
+    else
+        gs 'util_time','timeInfo_load',ARGS[1]
+    end
+
+    if time_month >= 11 or time_month <= 2:
+        $RESULT = 'winter'
+    elseif time_month >= 9:
+        $RESULT = 'fall'
+    elseif time_month <= 4:
+        $RESULT = 'spring'
+    else
+        $RESULT = 'summer'
+    end
 elseif $ARGS[0] = 'seconds2readable':
     temp_seconds = ARGS[1]
     if temp_seconds < 120:

+ 40 - 0
source/util/timed.qsps

@@ -0,0 +1,40 @@
+# util_timed
+!!Process: syntaxadditions
+
+if $ARGS[0] = 'execute':
+    if ARGS[1] = -1:
+        _time_from = time_current
+    else:
+        _time_from = ARGS[1]
+    end
+
+    _time_to = ARGS[2]
+    _time_to_final = _time_to
+
+    _time_beginningOfNextDay = (_time_from / 86400 + 1) * 86400
+
+    if _time_to >= _time_beginningOfNextDay:
+        _time_to_final = _time_beginningOfNextDay - 1
+    end
+
+
+    !foreach($timed_daily_id as key => $value){
+        if timed_daily_time[key] > _time_from mod 86400 and timed_daily_time[key] <= _time_to_final mod 86400:
+            _execution_time = timed_daily_time[key] + (_time_from / 86400) * 86400
+            dynamic $timed_daily_command[key]
+        end
+    }
+        
+
+
+    if _time_to >= _time_beginningOfNextDay:
+        gs 'util_timed','execute',_time_beginningOfNextDay,_time_to
+    end
+
+elseif $ARGS[0] = 'registerDaily':
+    $timed_daily_id[] = $ARGS[1]
+    $timed_daily_command[] = $ARGS[2]
+    timed_daily_time[] = ARGS[3]
+end
+
+-