From b56d84a301c1ef1ecb6af4bb9f8bd67cb7a8208f Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Thu, 25 Apr 2024 20:11:30 +0100 Subject: [PATCH] Refactoring cheats checks --- game/scripts/doll/main.rpy | 2 +- game/scripts/events/Start.rpy | 6 +++--- game/scripts/interface/topbar.rpy | 2 +- game/scripts/rooms/main_room/init.rpy | 2 +- game/scripts/script.rpy | 4 ++-- game/scripts/wardrobe/functions.rpy | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index cc47c9a6..29faf0b0 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -566,7 +566,7 @@ init python: for o in self.wardrobe_list: if x[0] == o.id: - if not o.unlocked and not game.cheats: + if not o.unlocked and not states.env.cheats: renpy.notify("Import failed: You don't own these items. Buy them first.") return None diff --git a/game/scripts/events/Start.rpy b/game/scripts/events/Start.rpy index 3915a8aa..2fc85d96 100644 --- a/game/scripts/events/Start.rpy +++ b/game/scripts/events/Start.rpy @@ -12,13 +12,13 @@ label start_wt: "Difficulty" "How difficult do you want the game to be?" "-Easy-{size=-8}\nIncreased gold, item drop rate and Slytherin-points gains.\nMood will improve faster.\nCheats are available.{/size}": $ states.env.difficulty = 1 - $ game.cheats = True + $ states.env.cheats = True "-Normal-{size=-8}\nBalanced gold, item drop rate and Slytherin-points gains.\nMood will improve normally.\nCheats are available.{/size}": $ states.env.difficulty = 2 - $ game.cheats = True + $ states.env.cheats = True "-Hardcore-{size=-8}\nReduced gold, item drop rate and Slytherin-points gains.\nMood will not improve over time.\nNo cheats.{/size}": $ states.env.difficulty = 3 - $ game.cheats = False + $ states.env.cheats = False if persistent.game_complete: menu: diff --git a/game/scripts/interface/topbar.rpy b/game/scripts/interface/topbar.rpy index 0c670c33..789b7693 100644 --- a/game/scripts/interface/topbar.rpy +++ b/game/scripts/interface/topbar.rpy @@ -212,7 +212,7 @@ screen ui_menu(): ypos 15 textbutton "Save" action ShowMenu("save") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] textbutton "Load" action ShowMenu("load") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] - if game.cheats and states.env.difficulty <= 2 and game.day > 1: + if states.env.cheats and states.env.difficulty <= 2 and game.day > 1: textbutton "Cheats" action [SetScreenVariable("toggle_menu", False), Jump("cheats")] background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] if game.day > 1 and renpy.android: textbutton "Preferences" action ShowMenu("preferences") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] diff --git a/game/scripts/rooms/main_room/init.rpy b/game/scripts/rooms/main_room/init.rpy index 93ac4902..604efc0a 100644 --- a/game/scripts/rooms/main_room/init.rpy +++ b/game/scripts/rooms/main_room/init.rpy @@ -57,7 +57,7 @@ default desk_OBJ = RoomObject( "Jerk Off": (Text("🍆", align=(0.5, 0.5)), Jump("jerk_off"), "True"), "Do Paperwork": (Text("📝", align=(0.5, 0.5)), Jump("paperwork"), "states.paperwork_unlocked"), "Open Deck Builder": (Text("🃏", align=(0.5, 0.5)), Jump("deck_builder"), "states.cardgame.unlocked"), - "Open Cheats Menu": (Text("🕹ī¸", align=(0.5, 0.5)), Jump("cheats"), "game.cheats"), + "Open Cheats Menu": (Text("🕹ī¸", align=(0.5, 0.5)), Jump("cheats"), "states.env.cheats"), }, hovered=Show( "gui_tooltip", diff --git a/game/scripts/script.rpy b/game/scripts/script.rpy index 739bb5a7..b303af8d 100644 --- a/game/scripts/script.rpy +++ b/game/scripts/script.rpy @@ -15,7 +15,7 @@ label start_quick: states.ton.level = 5 states.sna.level = 5 states.map.unlocked = True - game.cheats = True + states.env.cheats = True renpy.block_rollback() @@ -28,7 +28,7 @@ label start_dev: python: version = version_float() states.env.difficulty = 2 - game.cheats = True + states.env.cheats = True game.gold = 100000 states.map.unlocked = True states.sna.unlocked = True diff --git a/game/scripts/wardrobe/functions.rpy b/game/scripts/wardrobe/functions.rpy index ce2d2871..4133f87e 100644 --- a/game/scripts/wardrobe/functions.rpy +++ b/game/scripts/wardrobe/functions.rpy @@ -154,7 +154,7 @@ init -1 python: word_list = {"tonks": "friendship", "astoria": "affection", "susan": "confidence", "luna": "corruption", "cho": "recklessness", "hermione": "whoring"} word = word_list.get(states.active_girl, "whoring") - if game.cheats or states.env.difficulty <= 2: + if states.env.cheats or states.env.difficulty <= 2: renpy.show_screen("blktone") renpy.with_statement(d3) renpy.say(None, "{size=+6}> Try again at "+word+" level {color=#7a0000}"+str(value)+"{/color}.{/size}")