Interactive Object Highlight, Foreground, Bug fixes
* Added interactive room object highlights * Added spacebar hotkey for the room objects highlights * Added overlay param for room objects * Fixed paperwork wheel menu action available before paperwork unlocks * Improved foreground image handling for room objects
This commit is contained in:
parent
9d76d6088f
commit
4fbb2abad7
@ -162,6 +162,7 @@ init 1 python:
|
|||||||
screen hotkeys_main():
|
screen hotkeys_main():
|
||||||
tag hotkeys_main
|
tag hotkeys_main
|
||||||
|
|
||||||
|
if states.room == "main_room":
|
||||||
if states.map.unlocked:
|
if states.map.unlocked:
|
||||||
key "map" action Jump("desk")
|
key "map" action Jump("desk")
|
||||||
if states.paperwork_unlocked:
|
if states.paperwork_unlocked:
|
||||||
@ -172,3 +173,5 @@ screen hotkeys_main():
|
|||||||
key "fap" action Jump("jerk_off")
|
key "fap" action Jump("jerk_off")
|
||||||
key "summon" action Jump("door")
|
key "summon" action Jump("door")
|
||||||
key "sleep" action If(game.daytime, Jump("night_start"), Jump("day_start"))
|
key "sleep" action If(game.daytime, Jump("night_start"), Jump("day_start"))
|
||||||
|
|
||||||
|
key "K_SPACE" action RoomHighlightToggle
|
||||||
|
@ -15,7 +15,7 @@ init -1 python:
|
|||||||
|
|
||||||
class RoomObject(object):
|
class RoomObject(object):
|
||||||
|
|
||||||
def __init__(self, room, id, pos, idle, hover=None, foreground=None, background=None, anchor=(0.5, 0.5), focus_mask=True, action=NullAction(), hovered=None, unhovered=None, tooltip=None, decoration=None, zorder=0, hidden=False):
|
def __init__(self, room, id, pos, idle, hover=None, foreground=None, background=None, anchor=(0.5, 0.5), focus_mask=True, action=NullAction(), hovered=None, unhovered=None, tooltip=None, decoration=None, zorder=0, hidden=False, overlay=None):
|
||||||
self.room = room
|
self.room = room
|
||||||
self.id = id
|
self.id = id
|
||||||
self.pos = pos
|
self.pos = pos
|
||||||
@ -32,6 +32,7 @@ init -1 python:
|
|||||||
self.decoration = decoration
|
self.decoration = decoration
|
||||||
self.zorder = zorder
|
self.zorder = zorder
|
||||||
self.hidden = hidden
|
self.hidden = hidden
|
||||||
|
self.overlay = overlay
|
||||||
|
|
||||||
# Add to the main room if room was specified
|
# Add to the main room if room was specified
|
||||||
if self.room:
|
if self.room:
|
||||||
@ -47,7 +48,7 @@ init -1 python:
|
|||||||
|
|
||||||
def generate_hash(self):
|
def generate_hash(self):
|
||||||
salt = str( [self.id, self.pos, self.idle, self.hover, self.foreground, self.background, self.anchor, self.focus_mask,
|
salt = str( [self.id, self.pos, self.idle, self.hover, self.foreground, self.background, self.anchor, self.focus_mask,
|
||||||
self.action, self.hovered, self.unhovered, self.tooltip, self.decoration, self.zorder, self.hidden]
|
self.action, self.hovered, self.unhovered, self.tooltip, self.decoration, self.zorder, self.hidden, self.overlay]
|
||||||
)
|
)
|
||||||
|
|
||||||
return hash(salt)
|
return hash(salt)
|
||||||
@ -91,6 +92,21 @@ init -1 python:
|
|||||||
# return Transform(Fixed(self.hover, self.decoration.room_image, fit_first=True), shader="outline_shader")
|
# return Transform(Fixed(self.hover, self.decoration.room_image, fit_first=True), shader="outline_shader")
|
||||||
# return Transform(self.hover, shader="outline_shader")
|
# return Transform(self.hover, shader="outline_shader")
|
||||||
|
|
||||||
|
def get_foreground(self):
|
||||||
|
return self._get_foreground(self.generate_hash())
|
||||||
|
|
||||||
|
@functools.cache
|
||||||
|
def _get_foreground(self, hash):
|
||||||
|
if self.hidden:
|
||||||
|
return Null()
|
||||||
|
|
||||||
|
if self.overlay:
|
||||||
|
if self.foreground:
|
||||||
|
return Fixed(self.foreground, self.overlay)
|
||||||
|
return self.overlay
|
||||||
|
elif self.foreground:
|
||||||
|
return self.foreground
|
||||||
|
|
||||||
def set_decoration(self, decoration):
|
def set_decoration(self, decoration):
|
||||||
if not isinstance(decoration, (Decoration, NoneType)):
|
if not isinstance(decoration, (Decoration, NoneType)):
|
||||||
raise TypeError("Decoration must be a Decoration instance reference or a NoneType")
|
raise TypeError("Decoration must be a Decoration instance reference or a NoneType")
|
||||||
@ -142,6 +158,31 @@ init -1 python:
|
|||||||
return deco.replace_pos
|
return deco.replace_pos
|
||||||
return self.pos
|
return self.pos
|
||||||
|
|
||||||
|
def RoomHighlightToggle(state=None):
|
||||||
|
if not room_menu_active or renpy.in_rollback():
|
||||||
|
return
|
||||||
|
|
||||||
|
room = getattr(store, states.room, None)
|
||||||
|
|
||||||
|
if not room:
|
||||||
|
return
|
||||||
|
|
||||||
|
for i in room.objects:
|
||||||
|
if i.hidden or not i.action:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if i.overlay:
|
||||||
|
i.overlay = None
|
||||||
|
else:
|
||||||
|
i.overlay = At(Text("🔎", align=(0.5, 0.5), size=24), room_highlight_anim)
|
||||||
|
renpy.restart_interaction()
|
||||||
|
|
||||||
|
transform room_highlight_anim:
|
||||||
|
subpixel True
|
||||||
|
easein 0.5 zoom 1.2
|
||||||
|
easeout 0.5 zoom 1.0
|
||||||
|
repeat
|
||||||
|
|
||||||
default room_menu_active = False
|
default room_menu_active = False
|
||||||
|
|
||||||
screen room_menu():
|
screen room_menu():
|
||||||
|
@ -54,7 +54,7 @@ default desk_OBJ = RoomObject(
|
|||||||
action={
|
action={
|
||||||
"Sleep": (Text("💤", align=(0.5, 0.5)), IfExpr("game.daytime", Jump("night_start"), Jump("day_start")), "True"),
|
"Sleep": (Text("💤", align=(0.5, 0.5)), IfExpr("game.daytime", Jump("night_start"), Jump("day_start")), "True"),
|
||||||
"Jerk Off": (Text("🍆", align=(0.5, 0.5)), Jump("jerk_off"), "True"),
|
"Jerk Off": (Text("🍆", align=(0.5, 0.5)), Jump("jerk_off"), "True"),
|
||||||
"Do Paperwork": (Text("📝", align=(0.5, 0.5)), Jump("paperwork"), "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 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"), "game.cheats"),
|
||||||
},
|
},
|
||||||
@ -105,7 +105,7 @@ screen main_room():
|
|||||||
pos obj.get_pos()
|
pos obj.get_pos()
|
||||||
idle obj.get_idle()
|
idle obj.get_idle()
|
||||||
hover obj.get_hover()
|
hover obj.get_hover()
|
||||||
foreground obj.foreground
|
foreground obj.get_foreground()
|
||||||
background obj.background
|
background obj.background
|
||||||
focus_mask obj.focus_mask
|
focus_mask obj.focus_mask
|
||||||
tooltip obj.tooltip
|
tooltip obj.tooltip
|
||||||
|
@ -19,7 +19,7 @@ screen seventh_floor():
|
|||||||
pos obj.get_pos()
|
pos obj.get_pos()
|
||||||
idle obj.get_idle()
|
idle obj.get_idle()
|
||||||
hover obj.get_hover()
|
hover obj.get_hover()
|
||||||
foreground obj.foreground
|
foreground obj.get_foreground()
|
||||||
background obj.background
|
background obj.background
|
||||||
focus_mask obj.focus_mask
|
focus_mask obj.focus_mask
|
||||||
tooltip obj.tooltip
|
tooltip obj.tooltip
|
||||||
|
@ -16,6 +16,9 @@ screen snape_office():
|
|||||||
|
|
||||||
default objects = sorted(snape_office.objects, key=lambda x: x.zorder)
|
default objects = sorted(snape_office.objects, key=lambda x: x.zorder)
|
||||||
|
|
||||||
|
if room_menu_active:
|
||||||
|
use hotkeys_main
|
||||||
|
|
||||||
add "images/rooms/snape_office/bg.webp" zoom 0.5
|
add "images/rooms/snape_office/bg.webp" zoom 0.5
|
||||||
|
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
@ -24,7 +27,7 @@ screen snape_office():
|
|||||||
pos obj.get_pos()
|
pos obj.get_pos()
|
||||||
idle obj.get_idle()
|
idle obj.get_idle()
|
||||||
hover obj.get_hover()
|
hover obj.get_hover()
|
||||||
foreground obj.foreground
|
foreground obj.get_foreground()
|
||||||
background obj.background
|
background obj.background
|
||||||
focus_mask obj.focus_mask
|
focus_mask obj.focus_mask
|
||||||
tooltip obj.tooltip
|
tooltip obj.tooltip
|
||||||
|
Loading…
Reference in New Issue
Block a user