diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-08 20:30:54 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-08 20:47:15 +0200 |
commit | 976701ed6d6a45214bc2ea9fea3f6f7299ae379c (patch) | |
tree | 87ed8d58262ae2eb062e4b722a6ffa51e1bc7dc9 /lib | |
parent | ab026914d25d77fb14172922c66e630536180252 (diff) |
Lua: God quest: Move place_rand_dung() to C
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mods/theme/scpt/god.lua | 51 | ||||
-rw-r--r-- | lib/scpt/god.lua | 51 |
2 files changed, 2 insertions, 100 deletions
diff --git a/lib/mods/theme/scpt/god.lua b/lib/mods/theme/scpt/god.lua index 7567178c..71a85660 100644 --- a/lib/mods/theme/scpt/god.lua +++ b/lib/mods/theme/scpt/god.lua @@ -114,7 +114,7 @@ add_quest god_quest.quests_given = god_quest.quests_given + 1 -- actually place the dungeon in a random place - place_rand_dung() + quest_god_place_rand_dung() -- store the variables of the coords where the player was given the quest god_quest.player_y, god_quest.player_x = player.get_wild_coord() @@ -277,55 +277,6 @@ add_quest }, } --- this function places the lost temple at a randomly determined place. -function place_rand_dung() - local tries, grid - - -- erase old dungeon - if (god_quest.quests_given > 0) then - place_dungeon(god_quest.dung_y, god_quest.dung_x) - - -- erase old recall level - max_dlv[god_quest.DUNGEON_GOD + 1] = 0 - end - - -- initialise tries variable - tries = 1000 - - while tries > 0 do - - tries = tries - 1 - -- get grid coordinates, within a range which prevents dungeon being generated at the very edge of the wilderness (would crash the game). - god_quest.dung_x = rand_range(1, max_wild_x-2) - god_quest.dung_y = rand_range(1, max_wild_y-2) - - -- Is there a town/dungeon/potentially impassable feature there, ? - if (wild_map(god_quest.dung_y, god_quest.dung_x).entrance ~= 0) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).entrance ~= 0) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_EDGE) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_WATER) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_TREES) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_SHALLOW_LAVA) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_LAVA) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_MOUNTAIN) then - -- try again - else - --neither player, nor wall, then stop this 'while' - break - end - end - - -- Uhuh BAD ! lets use the default location up bree - if tries == 0 then - god_quest.dung_x = 32 - god_quest.dung_y = 19 - end - - -- create god dungeon in that place - place_dungeon(god_quest.dung_y, god_quest.dung_x, god_quest.DUNGEON_GOD) - -end - -- this function generates the relic at a randomly determined place in the temple. function generate_relic() local tries, grid, x, y, relic diff --git a/lib/scpt/god.lua b/lib/scpt/god.lua index 3f32888b..cc8b8fff 100644 --- a/lib/scpt/god.lua +++ b/lib/scpt/god.lua @@ -106,7 +106,7 @@ add_quest god_quest.quests_given = god_quest.quests_given + 1 -- actually place the dungeon in a random place - place_rand_dung() + quest_god_place_rand_dung() -- store the variables of the coords where the player was given the quest god_quest.player_y, god_quest.player_x = player.get_wild_coord() @@ -269,55 +269,6 @@ add_quest }, } --- this function places the lost temple at a randomly determined place. -function place_rand_dung() - local tries, grid - - -- erase old dungeon - if (god_quest.quests_given > 0) then - place_dungeon(god_quest.dung_y, god_quest.dung_x) - - -- erase old recall level - max_dlv[god_quest.DUNGEON_GOD + 1] = 0 - end - - -- initialise tries variable - tries = 1000 - - while tries > 0 do - - tries = tries - 1 - -- get grid coordinates, within a range which prevents dungeon being generated at the very edge of the wilderness (would crash the game). - god_quest.dung_x = rand_range(1, max_wild_x-2) - god_quest.dung_y = rand_range(1, max_wild_y-2) - - -- Is there a town/dungeon/potentially impassable feature there, ? - if (wild_map(god_quest.dung_y, god_quest.dung_x).entrance ~= 0) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).entrance ~= 0) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_EDGE) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_WATER) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_TREES) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_SHALLOW_LAVA) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_DEEP_LAVA) - or (wild_feat(wild_map(god_quest.dung_y, god_quest.dung_x)).terrain_idx == TERRAIN_MOUNTAIN) then - -- try again - else - --neither player, nor wall, then stop this 'while' - break - end - end - - -- Uhuh BAD ! lets use the default location up bree - if tries == 0 then - god_quest.dung_x = 32 - god_quest.dung_y = 19 - end - - -- create god dungeon in that place - place_dungeon(god_quest.dung_y, god_quest.dung_x, god_quest.DUNGEON_GOD) - -end - -- this function generates the relic at a randomly determined place in the temple. function generate_relic() local tries, grid, x, y, relic |