Navigation and Map - DRincs-Productions/NQTR-System GitHub Wiki

INFO: Navigation is based on defined dictionaries

ATTENTION: for the icon you have to create the idle image: Special idle Icon

Navigation

Room

The Room class is a Button.

Add a Room in list

(code-snippets: DR_RoomAdd_in_list)

define rooms = [
        Room(id="room_id", location_id="house", name=_("My room"), button_icon="icon myroom", bg="bg myroom", action_ids = []),
        Room(id="my_room", location_id="house", name=_("MC room"), button_icon="icon myroom", bg="bg myroom", action_ids = ["sleep","nap",]), 
        Room(id="bathroom", location_id="house", name=_("Bathroom"), button_icon="icon bathroom", bg="bg bathroom"), 
        Room(id="lounge", location_id="house", name=_("Lounge"), button_icon="icon lounge", bg="bg lounge"), 
        Room(id="terrace", location_id="house", name=_("Terrace"), button_icon="icon terrace", bg="bg terrace"), 
    ]

Change Room

INFO: changing the info will also change the current location

(code-snippets: DR_ChangeRoom)

label start:
    call change_room(room_id = "my_room")

Go Previous room

IMPORTANT: the chronology of rooms is only one, so be careful in using it

call go_previous_room

Location

The Location class is a Button.

Add a Location in list

(code-snippets: DR_LocationAdd_in_list)

define locations = [
        Location(id = "house_id", key_map="map", name=_("My house"), picture_in_background="icon map home", external_room_id="house_id_external_room", xalign=0.5, yalign=0.5),
]

Change Location

( it is not recommended to use it, it makes more sense to use Change Room )

call change_location(location_id = "my_location")

Map

The Map class is a Button.

image

Add a Location in dict

(code-snippets: DR_MapAdd_in_dict)

define maps = {
    "map": Map(
        name = _("Map"), bg = "bg map",
        map_id_north = "nightcity",
        map_id_south = None,
        map_id_west = None,
        map_id_east = None,
    ),
    "nightcity": Map(
        name = _("Night City"), bg = "bg nightcity",
        map_id_north = None,
        map_id_south = "map",
        map_id_west = None,
        map_id_east = None,
    ),
}

Check Go Out

Please note that to check whether the map can be used I used check_goout in open_map:

define block_goout_dialogue = _("Now is not the time to go outside")
label check_goout:
    if(not getFlags("goout")):
        "[block_goout_dialogue]"
        call screen room_navigation
    return

Unlock the map:

$ setFlags("goout", True)

Best sites for creating map images

Closed Room

( in progress )

It is possible to make a room closed: ... is a dictionary of closed rooms (id=room_id : Commitment()), it is used in change_room and in after_wait closed rooms are deleted (every hour). the expiration time is .tm_stop, if you don't want a deadline: .tm_stop = None. The room will remain closed from tm_start to tm_stop, only if at least one NPC is present in it, if you want the room always closed: .chs = None.

Examples of how to add them:

$ closed_rooms[cur_room.id] = df_routine["alice_sleep"]
jump after_wait
$ closed_rooms[cur_room.id] = df_routine["alice_sleep"]
# does not expire
$ closed_rooms[cur_room.id].tm_stop = None
# will remain closed even if there are no NPCs inside.
$ closed_rooms[cur_room.id].chs = None
jump after_wait
$ closed_rooms[cur_room.id] = Commitment(chs={"alice" : None}, tm_start=14, tm_stop=20)
jump after_wait

Where to change the image of the closed door or customise the event? in closed_room_event.

is closed room