Bug fixes

* Fixed 'Panty Thief' event requirements
* Improved event validation to avoid errors in user space
* Offset game object initialization to avoid bogus init errors
This commit is contained in:
LoafyLemon 2023-07-15 16:50:47 +01:00
parent 88a6b8941b
commit 2be9371482
3 changed files with 17 additions and 6 deletions

View File

@ -7,8 +7,8 @@ default her_ev_promoter_job_return = Event(id="her_ev_promoter_job_return", labe
default her_ev_promoter_job_hub = Event(id="her_ev_promoter_job_hub", label="her_promoter_job", priority=5, req="states.her.ev.promote_cardgame.offered and poker_outfit_ITEM.unlocked", repeat=True, autoenqueue=True, autodequeue=False, queue="her_eventqueue_jobs_promoter", subevents=["her_ev_promoter_job_return"])
default her_ev_panty_thief_t1_e1 = Event(id="her_ev_panty_thief_t1_e1", label="hg_pr_panty_thief_T1_E1", req="states.her.tier = 1", autoenqueue=True, autodequeue=False, queue="her_eventqueue_panty_thief")
default her_ev_panty_thief_t2_e1 = Event(id="her_ev_panty_thief_t2_e1", label="hg_pr_panty_thief_T2_E1", req="states.her.tier = 2", autoenqueue=True, autodequeue=False, queue="her_eventqueue_panty_thief")
default her_ev_panty_thief_t1_e1 = Event(id="her_ev_panty_thief_t1_e1", label="hg_pr_panty_thief_T1_E1", req="states.her.tier == 1", autoenqueue=True, autodequeue=False, queue="her_eventqueue_panty_thief")
default her_ev_panty_thief_t2_e1 = Event(id="her_ev_panty_thief_t2_e1", label="hg_pr_panty_thief_T2_E1", req="states.her.tier == 2", autoenqueue=True, autodequeue=False, queue="her_eventqueue_panty_thief")
default her_ev_panty_thief_t3_e1 = Event(id="her_ev_panty_thief_t3_e1", label="hg_pr_panty_thief_e1_return", req="game.daytime==False")
default her_ev_panty_thief_t3_e1_hub = Event(id="her_ev_panty_thief_t3_e1_hub", label="hg_pr_panty_thief_e1", req="states.her.tier >= 3", autoenqueue=True, autodequeue=False, queue="her_eventqueue_panty_thief", subevents=["her_ev_panty_thief_t3_e1"])

View File

@ -146,8 +146,9 @@ init -1 python:
self.completed = False
self.completed_failed = False
# Validation
if not renpy.has_label(self.label):
raise Exception("Supplied label does not exist.")
raise Exception(f"Supplied label does not exist:\n{self.label}")
if autoenqueue:
self.enqueue()
@ -221,7 +222,15 @@ init -1 python:
def requirements_met(self):
if self.req:
return eval(self.req)
try:
return eval(self.req)
except Exception as e:
msg = f"Event '{self.id}' requirements evaluation has failed:\n{e} for '{self.req}'"
if config.developer:
raise Exception(msg)
else:
print(msg)
renpy.notify("An error has occured. Check console for details.")
return True
def start(self, _caller=None):
@ -386,4 +395,4 @@ init -1 python:
init offset = -5
default eventqueue = EventQueue("mainloop")
default eventqueue = EventQueue("mainloop")

View File

@ -1,4 +1,4 @@
init python:
init -100 python:
def show_gold(st, at, old, new):
if st > 1.0:
return Text("G {}".format(new)), None
@ -86,6 +86,8 @@ screen gold(old, new):
timer 3.0 action Hide("gold")
init offset = -99
default game = Game()
# Points change displayable