Skip to content

Commit

Permalink
Fix barrier removal in low ram mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneWolfHT committed Nov 26, 2023
1 parent 5daab62 commit ee4f02e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions mods/ctf/ctf_map/map_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,18 @@ function ctf_map.save_map(mapmeta)
-- Calculate where barriers are
local barriers = {}
local pos1, pos2 = mapmeta.pos1:copy(), mapmeta.pos2:copy()
local barrier_area = {pos1 = pos1:subtract(mapmeta.offset), pos2 = pos2:subtract(mapmeta.offset)}

if pos1.y > pos2.y then
pos1, pos2 = pos2, pos1
local t = pos2
pos2 = pos1
pos1 = t
end

if pos1.y + BARRIER_Y_SIZE < pos2.y then
pos2.y = pos1.y + BARRIER_Y_SIZE
end

local barrier_area = {pos1 = pos1:subtract(mapmeta.offset), pos2 = pos2:subtract(mapmeta.offset)}
local queue_break = false
while true do
local tmp = {
Expand All @@ -300,21 +302,21 @@ function ctf_map.save_map(mapmeta)
tmp.pos1, tmp.pos2 = pos1:subtract(mapmeta.offset), pos2:subtract(mapmeta.offset)

local data = vm:get_data()
local barrier_found = false
for i, v in ipairs(data) do
for b, rep in pairs(ctf_map.barrier_nodes) do
if v == b then
barrier_found = true
tmp.reps[i] = minetest.get_name_from_content_id(rep)
end
end
end

tmp.max = #data

local _
_, barrier_area.pos1 = vector.sort(barrier_area.pos1, tmp.pos1)
barrier_area.pos2 = vector.sort(barrier_area.pos2, tmp.pos2)

table.insert(barriers, tmp)
if barrier_found then
table.insert(barriers, tmp)
end

if queue_break then
break
Expand Down
2 changes: 1 addition & 1 deletion mods/ctf/ctf_map/maps
Submodule maps updated 60 files
+ abandoned_battlefield/barriers.data
+14 −14 abandoned_battlefield/map.conf
+ ahkmenrah_pyramids/barriers.data
+14 −14 ahkmenrah_pyramids/map.conf
+ ancient_pyramids/barriers.data
+14 −14 ancient_pyramids/map.conf
+ appleton/barriers.data
+14 −14 appleton/map.conf
+ big_ocean/barriers.data
+14 −14 big_ocean/map.conf
+ bridge/barriers.data
+14 −14 bridge/map.conf
+ capture_legend/barriers.data
+14 −14 capture_legend/map.conf
+ caverns/barriers.data
+14 −14 caverns/map.conf
+ coast/barriers.data
+14 −14 coast/map.conf
+ desert_spikes/barriers.data
+14 −14 desert_spikes/map.conf
+ dragons_dance/barriers.data
+14 −14 dragons_dance/map.conf
+ ewok_village/barriers.data
+14 −14 ewok_village/map.conf
+ green_hills/barriers.data
+14 −14 green_hills/map.conf
+ iceage/barriers.data
+14 −14 iceage/map.conf
+ lost_mountains/barriers.data
+14 −14 lost_mountains/map.conf
+ mayan_legend/barriers.data
+14 −14 mayan_legend/map.conf
+ nether_kingdom/barriers.data
+14 −14 nether_kingdom/map.conf
+ pirates_hideout/barriers.data
+14 −14 pirates_hideout/map.conf
+ plain_battle/barriers.data
+14 −14 plain_battle/map.conf
+ plains/barriers.data
+14 −14 plains/map.conf
+ race_day/barriers.data
+14 −14 race_day/map.conf
+ river_valley/barriers.data
+14 −14 river_valley/map.conf
+ sams_mansion/barriers.data
+14 −14 sams_mansion/map.conf
+ savanna_ravine/barriers.data
+14 −14 savanna_ravine/map.conf
+ skies_of_land/barriers.data
+14 −14 skies_of_land/map.conf
+ snowland/barriers.data
+14 −14 snowland/map.conf
+1 −2 the_wall/barriers.data
+14 −14 the_wall/map.conf
+ tunnel/barriers.data
+14 −14 tunnel/map.conf
+ two_hills/barriers.data
+14 −14 two_hills/map.conf
+ water_academy/barriers.data
+14 −14 water_academy/map.conf

0 comments on commit ee4f02e

Please sign in to comment.