diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-04-28 00:35:02 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-04-28 00:35:02 -0300 |
commit | 17fecb4277df1effb7177096314797e5e43dc857 (patch) | |
tree | 30883082020cf0775a9aeb80b09c869b53e68e4b /npc/functions/maze.txt | |
parent | 917104fdcbf583d1ac73ee5758a5e1d8b17e52cf (diff) | |
download | serverdata-17fecb4277df1effb7177096314797e5e43dc857.tar.gz serverdata-17fecb4277df1effb7177096314797e5e43dc857.tar.bz2 serverdata-17fecb4277df1effb7177096314797e5e43dc857.tar.xz serverdata-17fecb4277df1effb7177096314797e5e43dc857.zip |
Prepare for maze system expansion (we'll go from 24 mazes to 75 mazes)
Diffstat (limited to 'npc/functions/maze.txt')
-rw-r--r-- | npc/functions/maze.txt | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/npc/functions/maze.txt b/npc/functions/maze.txt index b2dde03b4..8867f09b8 100644 --- a/npc/functions/maze.txt +++ b/npc/functions/maze.txt @@ -9,20 +9,50 @@ // MAZE_INST → Instance ID of the Maze ///////////////////////////////////////////////////////////////////////////////// -// CreateMaze(scope=IOT_CHAR) +// CreateMaze(scope=IOT_CHAR{, size=MAZE_SIZE_S}) // Creates the maze instances so they can be configured -// But does not initializes anything +// But does not initializes anything. function script CreateMaze { .@scope = getarg(0, IOT_CHAR); - .@min = getarg(1, MAZE_MIN); - .@max = getarg(2, MAZE_MAX); - // Pseudo-random maze ID - // (It is not random at all; But two mazes won't repeat) - MAZE_ID += 1; - if (MAZE_ID > .@max) - MAZE_ID = .@min; - if (MAZE_ID < .@min) - MAZE_ID = .@min; + .@size = getarg(1, MAZE_SIZE_S); + + // Small mazes (30x30 average) (24 total) + if (.@size & MAZE_SIZE_S) { + .@p = getarraysize(.@ids); + setarray .@ids[.@p], 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24; + } + // Medium mazes (45x45 average) (15 total) + if (.@size & MAZE_SIZE_M) { + .@p = getarraysize(.@ids); + setarray .@ids[.@p], 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39; + } + // Great mazes (60x60 average) (20 total) + if (.@size & MAZE_SIZE_G) { + .@p = getarraysize(.@ids); + setarray .@ids[.@p], 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59; + } + // Xtra mazes (75x75 average) (10 total) + if (.@size & MAZE_SIZE_X) { + .@p = getarraysize(.@ids); + setarray .@ids[.@p], 60, 61, 62, 63, 64, 65, 66, 67, 68, 69; + } + // Abs. mazes (90x90 average) (6 total) + if (.@size & MAZE_SIZE_A) { + .@p = getarraysize(.@ids); + setarray .@ids[.@p], 70, 71, 72, 73, 74, 75; + } + + // Get a random maze, but it must not be repeated + do + { + .@r = any_of(.@ids); + if (MAZE_ID == .@r) + continue; + MAZE_ID = .@r; + break; + } while (true); .@MAZEMP$=sprintf("030-%02d", MAZE_ID); MAZE_MAP$=sprintf("mz%02d@"+getcharid(0), MAZE_ID); |