Browse Source

[fixed] mods working in the sleep cycle. Update to how mods check for being in the cycle.

anjuna krokus 6 months ago
parent
commit
a6641e51f3

+ 3 - 3
locations/bed.qsrc

@@ -1,5 +1,4 @@
 # bed
-$sleep_loc = 'bed'
 menu_off = 1
 
 !! Prepare to lie down, move to events related to entering the bed.
@@ -14,10 +13,11 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'bed' and $$ARGS[0] = 'mod_sleeptriggers'
+	!! Either check for: if $ARGS[0] = 'bed' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
-
+	
+	gs 'LOCA'. 'bed', 'mod_sleeptriggers'
 	gt 'bed_events', 'start'
 end
 

+ 2 - 2
locations/bed2.qsrc

@@ -1,5 +1,4 @@
 # bed2
-$sleep_loc = 'bed2'
 
 !! Lying in bed hub. From here PC can take various actions, including going to sleep.
 !!
@@ -26,10 +25,11 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'bed2' and $ARGS[0] = 'mod_sleeptriggers'
+	!! Either check for: if $ARGS[0] = 'bed2' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
 
+	gs 'LOCA', 'bed2', 'mod_sleeptriggers'
 	gt 'bed2', 'main'
 end
 

+ 2 - 4
locations/bed_events.qsrc

@@ -1,5 +1,4 @@
 # bed_events
-$sleep_loc = 'bed_events'
 menu_off = 1
 
 !! Bed events trigger after going to lie down on the bed, but before actually lying down in bed (and getting to choose to sleep, get out, read a book, etc)
@@ -37,7 +36,7 @@ end
 
 if $ARGS[0] = 'mod_sleepevents':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'bed_events' and $ARGS[0] = 'mod_sleepevents'
+	!! Either check for: if $ARGS[0] = 'bed_events' and $ARGS[1] = 'mod_sleepevents'
 	!!
 	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
 	!! A random event will be chosen from amongst the added ones.
@@ -52,6 +51,7 @@ if $ARGS[0] = 'mod_sleepevents':
 	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
 	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
 
+	gs 'LOCA', 'bed_events', 'mod_sleepevents'
 	gt 'bed_events', 'event_handler'
 end
 
@@ -100,7 +100,6 @@ end
 
 if $ARGS[0] = 'exit':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'
@@ -109,7 +108,6 @@ end
 
 if $ARGS[0] = 'continue':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'

+ 2 - 3
locations/bed_get_out.qsrc

@@ -1,5 +1,4 @@
 # bed_get_out
-$sleep_loc = 'bed_get_out'
 
 
 if $ARGS[0] = 'start' or $ARGS[0] = '':
@@ -16,17 +15,17 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Check for: if $sleep_loc = 'bed_get_out' and $ARGS[0] = 'mod_sleeptriggers'
+	!! Check for: if $ARGS[0] = 'bed_get_out' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
 	
+	gs 'LOCA', 'bed_get_out', 'mod_sleeptriggers'
 	xgt 'bed_get_out_events', 'start'
 end
 
 
 if $ARGS[0] = 'end':
 	menu_off = 0
-	killvar '$sleep_loc'
 	if fullmorrout = 1:
 		if $loc = 'bedrPar':
 			gt 'vanrPar'

+ 2 - 4
locations/bed_get_out_events.qsrc

@@ -1,5 +1,4 @@
 # bed_get_out_events
-$sleep_loc = 'bed_get_out_events'
 menu_off = 1
 
 !! wakeup events trigger during when waking up
@@ -34,7 +33,7 @@ end
 
 if $ARGS[0] = 'mod_sleepevents':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'bed_get_out_events' and $ARGS[0] = 'mod_sleepevents'
+	!! Either check for: if $ARGS[0] = 'bed_get_out_events' and $ARGS[1] = 'mod_sleepevents'
 	!!
 	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
 	!! A random event will be chosen from amongst the added ones.
@@ -48,6 +47,7 @@ if $ARGS[0] = 'mod_sleepevents':
 	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
 	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
 
+	gs 'LOCA', 'bed_get_out_events', 'mod_sleepevents'
 	xgt 'bed_get_out_events', 'event_handler'
 end
 
@@ -97,7 +97,6 @@ end
 
 if $ARGS[0] = 'exit':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'
@@ -106,7 +105,6 @@ end
 
 if $ARGS[0] = 'continue':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'

+ 2 - 4
locations/dream_events.qsrc

@@ -1,5 +1,4 @@
 # dream_events
-$sleep_loc = 'dream_events'
 menu_off = 1
 
 !! Dream events trigger after deciding to go to sleep, but before any time has advanced.
@@ -57,7 +56,7 @@ end
 
 if $ARGS[0] = 'mod_sleepevents':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'dream_events' and $ARGS[0] = 'mod_sleepevents'
+	!! Either check for: if $ARGS[0] = 'dream_events' and $ARGS[1] = 'mod_sleepevents'
 	!!
 	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
 	!! A random event will be chosen from amongst the added ones.
@@ -71,6 +70,7 @@ if $ARGS[0] = 'mod_sleepevents':
 	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
 	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
 
+	gs 'LOCA', 'dream_events', 'mod_sleepevents'
 	gt 'dream_events', 'event_handler'
 end
 
@@ -120,7 +120,6 @@ end
 
 if $ARGS[0] = 'exit':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'
@@ -129,7 +128,6 @@ end
 
 if $ARGS[0] = 'continue':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'

+ 2 - 2
locations/pre_sleep.qsrc

@@ -1,5 +1,4 @@
 # pre_sleep
-$sleep_loc = 'pre_sleep'
 
 !! Deals with all the triggers that happen to prepare to for the sleep cycle, before the dream events start.
 !!
@@ -159,10 +158,11 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_triggers'
+	!! Either check for: if $ARGS[0] = 'pre_sleep' and $ARGS[1] = 'mod_triggers'
 	!!
 	!! This is NOT for events!!
 
+	gs 'LOCA', 'pre_sleep', 'mod_sleeptriggers'
 	xgt 'pre_sleep', 'end'
 end
 

+ 2 - 4
locations/pre_sleep_events.qsrc

@@ -1,5 +1,4 @@
 # pre_sleep_events
-$sleep_loc = 'pre_sleep_events'
 menu_off = 1
 
 !! Pre-sleep events trigger after deciding to go to sleep, but before dreaming and falling asleep (and thus before the auto-save).
@@ -46,7 +45,7 @@ end
 
 if $ARGS[0] = 'mod_sleepevents':
 	!! This location is here to allow mods to hook into the system.
-	!! Check for: if $sleep_loc = 'pre_sleep_events' and $ARGS[0] = 'mod_sleepevents'
+	!! Check for: if $ARGS[0] = 'pre_sleep_events' and $ARGS[1] = 'mod_sleepevents'
 	!!
 	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
 	!! A random event will be chosen from amongst the added ones.
@@ -61,6 +60,7 @@ if $ARGS[0] = 'mod_sleepevents':
 	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
 	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
 
+	gs 'LOCA', 'pre_sleep_events', 'mod_sleepevents'
 	gt 'pre_sleep_events', 'event_handler'
 end
 
@@ -110,7 +110,6 @@ end
 
 if $ARGS[0] = 'exit':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'
@@ -119,7 +118,6 @@ end
 
 if $ARGS[0] = 'continue':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'

+ 2 - 3
locations/sleep.qsrc

@@ -1,5 +1,4 @@
 # sleep
-$sleep_loc = 'sleep'
 
 !! Deals with the sleep cycle, advancing both time and stats during sleep.
 !!
@@ -157,11 +156,11 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_sleeptriggers'
+	!! Check for: if $ARGS[0] = 'pre_sleep' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
 	
-	gs 'LOCA', 'mod_sleeptriggers'
+	gs 'LOCA', 'sleep', 'mod_sleeptriggers'
 end
 
 

+ 2 - 5
locations/sleep_events.qsrc

@@ -1,5 +1,4 @@
 # sleep_events
-$sleep_loc = 'sleep_events'
 menu_off = 1
 
 !! Sleep events trigger during the sleep cycle and can either wake you up or you can continue to sleep
@@ -36,7 +35,7 @@ end
 
 if $ARGS[0] = 'mod_sleepevents':
 	!! This location is here to allow mods to hook into the system.
-	!! Either check for: if $sleep_loc = 'sleep_events' and $ARGS[0] = 'mod_sleepevents'
+	!! Either check for: if $ARGS[0] = 'sleep_events' and $ARGS[1] = 'mod_sleepevents'
 	!!
 	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
 	!! A random event will be chosen from amongst the added ones.
@@ -50,7 +49,7 @@ if $ARGS[0] = 'mod_sleepevents':
 	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
 	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
 
-	gs 'LOCA', 'mod_sleepevents'
+	gs 'LOCA', 'sleep_events', 'mod_sleepevents'
 	gs 'sleep_events', 'event_handler'
 end
 
@@ -114,7 +113,6 @@ end
 
 if $ARGS[0] = 'exit':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'
@@ -123,7 +121,6 @@ end
 
 if $ARGS[0] = 'continue':
 	sleepVars['events_done'] = 0
-	killvar '$sleep_loc'
 	killvar '$sleep_events'
 	killvar '$sleep_events_priority'
 	killvar 'temp_slev_id'

+ 2 - 4
locations/sleep_simple.qsrc

@@ -12,7 +12,6 @@ if $ARGS[0] = 'simple':
 
 
 	gs 'sleep', 'calc_minutes_to_wakeup'
-	$sleep_loc = 'sleep_simple'
 
 	InSleep = 1
 	:sleep_simple_loop
@@ -35,16 +34,15 @@ if $ARGS[0] = 'simple':
 
 	sleepVars['time_now'] = daystart * 1440 + hour * 60 + minut
 	InSleep = 0
-	$sleep_loc = ''
 	gs 'stat'
 end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Check for: if $sleep_loc = 'sleep_simple' and $ARGS[0] = 'mod_sleeptriggers'
+	!! Check for: if $ARGS[0] = 'sleep_simple' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
-	gs 'LOCA', 'mod_sleeptriggers'
+	gs 'LOCA', 'sleep_simple', 'mod_sleeptriggers'
 end
 
 if $ARGS[0] = 'nap_bed':

+ 2 - 2
locations/wakeup.qsrc

@@ -1,5 +1,4 @@
 # wakeup
-$sleep_loc = 'wakeup'
 
 !! Deals with all the triggers that happen when waking up.
 !!
@@ -19,10 +18,11 @@ end
 
 if $ARGS[0] = 'mod_sleeptriggers':
 	!! This location is here to allow mods to hook into the system.
-	!! Check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_sleeptriggers'
+	!! Check for: if $ARGS[0] = 'pre_sleep' and $ARGS[1] = 'mod_sleeptriggers'
 	!!
 	!! This is NOT for events!!
 	
+	gs 'LOCA', 'wakeup', 'mod_sleeptriggers'
 	xgt 'wakeup_events', 'start'
 end