Allow defining random-teleport exclusion zones in lua

Adds a new lua command

  des.exclusion({ type = "teleport", region = { x1,y1, x2,y2 } });

which allows defining "exclusion zones" in the level, areas where
random teleports (or falling into the level) will never place the hero.
Does not prevent targeted teleportation into the area.

Breaks saves and bones.
This commit is contained in:
Pasi Kallinen
2023-08-24 17:42:06 +03:00
parent 0794a64b9d
commit e407af4477
15 changed files with 143 additions and 3 deletions

View File

@@ -340,6 +340,7 @@ struct instance_globals_e {
struct bubble *ebubbles;
/* new stuff */
struct exclusion_zone *exclusion_zones;
int early_raw_messages; /* if raw_prints occurred early prior
to gb.beyond_savefile_load */

View File

@@ -58,6 +58,14 @@ typedef struct dest_area { /* non-stairway level change identifier */
coordxy nhx, nhy; /* opposite corner of invalid area */
} dest_area;
/* teleportation exclusion zones in the level */
typedef struct exclusion_zone {
xint16 zonetype; /* level_region_types */
coordxy lx, ly;
coordxy hx, hy;
struct exclusion_zone *next;
} exclusion_zone;
typedef struct dungeon { /* basic dungeon identifier */
char dname[24]; /* name of the dungeon (eg. "Hell") */
char proto[15]; /* name of prototype file (eg. "tower") */

View File

@@ -745,6 +745,9 @@ extern char *stairs_description(stairway *, char *, boolean);
extern schar print_dungeon(boolean, schar *, xint16 *);
extern char *get_annotation(d_level *);
extern int donamelevel(void);
extern void free_exclusions(void);
extern void save_exclusions(NHFILE *);
extern void load_exclusions(NHFILE *);
extern int dooverview(void);
extern void show_overview(int, int);
extern void rm_mapseen(int);

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 88
#define EDITLEVEL 89
/*
* Development status possibilities.