From 3955a1d765e4493978dc45af5dcce63f2c3e1c61 Mon Sep 17 00:00:00 2001 From: ANAND Date: Sat, 23 Feb 2019 20:40:15 +0530 Subject: [PATCH 1/6] Fix missing indestructible stairs and wool --- mods/ctf/ctf_map/depends.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ctf/ctf_map/depends.txt b/mods/ctf/ctf_map/depends.txt index 1927f44..35bedcd 100644 --- a/mods/ctf/ctf_map/depends.txt +++ b/mods/ctf/ctf_map/depends.txt @@ -1,4 +1,6 @@ default +stairs? +wool? ctf_team_base? ctf? ctf_match? From 84c55a3d7ae8e18fd7909409b682600878000f96 Mon Sep 17 00:00:00 2001 From: ANAND Date: Sat, 23 Feb 2019 20:41:35 +0530 Subject: [PATCH 2/6] Reduce width of name column in scores formspec (#344) --- mods/ctf/ctf_stats/gui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ctf/ctf_stats/gui.lua b/mods/ctf/ctf_stats/gui.lua index 0d21430..457e69e 100644 --- a/mods/ctf/ctf_stats/gui.lua +++ b/mods/ctf/ctf_stats/gui.lua @@ -2,7 +2,7 @@ local tablecolumns = { "tablecolumns[color;", "text;", - "text,width=20;", + "text,width=16;", "text,width=4;", "text,width=4;", "text,width=4;", From b54f6b204d96e780f8afdfd0fce49c1eb88ebd22 Mon Sep 17 00:00:00 2001 From: ANAND Date: Sat, 23 Feb 2019 20:41:49 +0530 Subject: [PATCH 3/6] Set collide_with_objects to false for arrows (#343) --- mods/pvp/shooter/crossbow.lua | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/mods/pvp/shooter/crossbow.lua b/mods/pvp/shooter/crossbow.lua index 354d8b5..553eb6f 100644 --- a/mods/pvp/shooter/crossbow.lua +++ b/mods/pvp/shooter/crossbow.lua @@ -32,6 +32,7 @@ end minetest.register_entity("shooter:arrow_entity", { physical = false, + collide_with_objects = false, visual = "mesh", mesh = "shooter_arrow.b3d", visual_size = {x=1, y=1}, @@ -48,7 +49,7 @@ minetest.register_entity("shooter:arrow_entity", { stop = function(self, pos) local acceleration = {x=0, y=-10, z=0} if self.state == "stuck" then - pos = pos or self.object:getpos() + pos = pos or self.object:get_pos() acceleration = {x=0, y=0, z=0} end if pos then @@ -56,24 +57,24 @@ minetest.register_entity("shooter:arrow_entity", { end self.object:set_properties({ physical = true, - collisionbox = {-1/8,-1/8,-1/8, 1/8,1/8,1/8}, + collisionbox = {-1/8, -1/8, -1/8, 1/8, 1/8, 1/8}, }) - self.object:setvelocity({x=0, y=0, z=0}) - self.object:setacceleration(acceleration) + self.object:set_velocity({x=0, y=0, z=0}) + self.object:set_acceleration(acceleration) end, strike = function(self, object) local puncher = self.player if puncher and shooter:is_valid_object(object) then if puncher ~= object then local dir = puncher:get_look_dir() - local p1 = puncher:getpos() - local p2 = object:getpos() + local p1 = puncher:get_pos() + local p2 = object:get_pos() local tpos = get_target_pos(p1, p2, dir, 0) shooter:spawn_particles(tpos, SHOOTER_EXPLOSION_TEXTURE) object:punch(puncher, nil, SHOOTER_ARROW_TOOL_CAPS, dir) end end - self:stop(object:getpos()) + self:stop(object:get_pos()) end, on_activate = function(self, staticdata) self.object:set_armor_groups({immortal=1}) @@ -129,7 +130,7 @@ minetest.register_entity("shooter:arrow_entity", { local frame = get_animation_frame(dir) self.object:set_animation({x=frame, y=frame}, 0) local objects = minetest.get_objects_inside_radius(pos, 5) - for _,obj in ipairs(objects) do + for _, obj in ipairs(objects) do if shooter:is_valid_object(obj) and obj ~= self.player then local collisionbox = {-0.25,-1.0,-0.25, 0.25,0.8,0.25} local offset = SHOOTER_PLAYER_OFFSET @@ -141,7 +142,7 @@ minetest.register_entity("shooter:arrow_entity", { collisionbox = def.collisionbox or collisionbox end end - local opos = vector.add(obj:getpos(), offset) + local opos = vector.add(obj:get_pos(), offset) local ray = {pos=pos, dir=dir} local plane = {pos=opos, normal={x=-1, y=0, z=-1}} local ipos = shooter:get_intersect_pos(ray, plane, collisionbox) @@ -183,7 +184,7 @@ for _, color in pairs(dye_basecolors) do itemstack:add_wear(65535/SHOOTER_CROSSBOW_USES) end itemstack = "shooter:crossbow 1 "..itemstack:get_wear() - local pos = user:getpos() + local pos = user:get_pos() local dir = user:get_look_dir() local yaw = user:get_look_yaw() if pos and dir and yaw then @@ -202,9 +203,9 @@ for _, color in pairs(dye_basecolors) do }) minetest.sound_play("shooter_throw", {object=obj}) local frame = get_animation_frame(dir) - obj:setyaw(yaw + math.pi) + obj:set_yaw(yaw + math.pi) obj:set_animation({x=frame, y=frame}, 0) - obj:setvelocity({x=dir.x * 14, y=dir.y * 14, z=dir.z * 14}) + obj:set_velocity({x=dir.x * 14, y=dir.y * 14, z=dir.z * 14}) if pointed_thing.type ~= "nothing" then local ppos = minetest.get_pointed_thing_position(pointed_thing, false) local _, npos = minetest.line_of_sight(pos, ppos, 1) @@ -227,7 +228,7 @@ for _, color in pairs(dye_basecolors) do return itemstack end end - obj:setacceleration({x=dir.x * -3, y=-5, z=dir.z * -3}) + obj:set_acceleration({x=dir.x * -3, y=-5, z=dir.z * -3}) end end return itemstack @@ -284,7 +285,7 @@ if SHOOTER_ENABLE_CRAFTING == true then minetest.register_craft({ output = "shooter:arrow_"..color, recipe = { - {"", "dye:"..color, "shooter:arrow_white"}, + {"", "dye:" .. color, "shooter:arrow_white"}, }, }) end From 03fea8fac2801f3c77ebafd4a5fd53aeee0234e5 Mon Sep 17 00:00:00 2001 From: ANAND Date: Sat, 23 Feb 2019 20:42:09 +0530 Subject: [PATCH 4/6] Set sprint_stamina to 10; double the prev. setting (#341) --- minetest.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minetest.conf b/minetest.conf index 380a4e1..15e560d 100644 --- a/minetest.conf +++ b/minetest.conf @@ -6,7 +6,7 @@ barrier = 106 regen_interval = 6 regen_amount = 1 random_messages_interval = 60 -sprint_stamina = 5 +sprint_stamina = 10 enable_lavacooling = false # From 91c5f47886c45822d0c7f61fedff29d58a7ab63d Mon Sep 17 00:00:00 2001 From: ANAND Date: Sun, 24 Feb 2019 10:41:16 +0530 Subject: [PATCH 5/6] Allow maps to optionally specify custom treasures (#351) --- mods/ctf/ctf_map/README.md | 63 +++++++++++++++++++++++-------- mods/ctf/ctf_map/depends.txt | 1 + mods/ctf/ctf_map/schem_map.lua | 36 +++++++++++++++++- mods/ctf/ctf_treasure/depends.txt | 1 - mods/ctf/ctf_treasure/init.lua | 42 +++++++++++---------- 5 files changed, 106 insertions(+), 37 deletions(-) diff --git a/mods/ctf/ctf_map/README.md b/mods/ctf/ctf_map/README.md index 7767c3f..43d08ee 100644 --- a/mods/ctf/ctf_map/README.md +++ b/mods/ctf/ctf_map/README.md @@ -1,51 +1,84 @@ # CTF Map -This mod handles multiple maps. +This mod handles creating and loading maps. -# Creating a new map +## Creating a new map -## 1. Dependencies +### 1. Dependencies * Minetest 0.4.16 or later. * Mods - * ctf_map (by copying the folder from this game to `minetest/mods`) - * worldedit and worldedit_commands. + * ctf_map (by copying the folder from this game to `minetest/mods`) + * worldedit and worldedit_commands. -## 2. Find an area +### 2. Find an area * Can use Minetest Game and any mapgen. * It must be a cube, and the barrier will be in the exact center. * It should be around 230x230 in surface area, but this can vary. * Feel free to modify the area to your needs. -## 3. Select the area +### 3. Select the area There are multiple ways do this, this is the simplist in most cases. * If you haven't modified the map at all, do the following to speed up barrier placement: - * Stop Minetest. - * Open up the world's world.mt - * Set backend to "dummy". - * Save. + * Stop Minetest. + * Open up the world's world.mt + * Set backend to "dummy". + * Save. * Using worldedit, select the area. * Type /gui, and click "From WE" then "To WE". * Check that the center location is the right place for the barrier to go. * Check that the bounds extend far enough. -## 4. Place barriers +### 4. Place barriers * Set the middle barrier direction. The barrier is a plane defined by a co-ordinate = 0. If the barrier is X=0, then it will placed with every node of the barrier having X=0. If the barrier is Z=0, then it will placed with every node of the barrier having Z=0. * Click "place barrier". Note that this command does not have an undo. -## 5. Meta data +### 5. Meta data * Set the meta data -## 6. Export +### 6. Export * Click export, and wait until completion. -* Copy the two files from `worlddir/schemes/` to `ctf_map/maps/`. +* Copy the two files from `worlddir/schems/` to `ctf_map/maps/`. * Rename the files so the two prefixed numbers are consistent to existing maps. * Profit! + +## Documentation + +### Map meta + +Each map's metadata is stored in an accompanying .conf file containing the following data: + +* `name`: Name of map. +* `author`: Author of the map. +* `hint`: [Optional] Helpful hint or tip for unique maps, to help players understand the map. +* `rotation`: Rotation of the schem. [`x`|`z`] +* `schematic`: Name of the map's schematic. +* `initial_stuff`: [Optional] Comma-separated list of itemstacks to be given to the player on join and on respawn. +* `treasures`: [Optional] List of treasures to be registered for the map, in a serialized format. Refer to the `treasures` sub-section for more details. +* `r`: Radius of the map. +* `h`: Height of the map. +* `team.i`: Name of team `i`. +* `team.i.color`: Color of team `i`. +* `team.i.pos`: Position of team `i`'s flag, relative to center of schem. +* `chests.i.from`, `chests.i.to`: [Optional] Positions of diagonal corners of custom chest zone `i`, relative to the center of the schem. +* `chests.i.n`: [Optional] Number of chests to place in custom chest zone `i`. + +#### `treasures` + +`treasures` is a list of treasures to be registered for this map in serialized format. + +An example `treasures` value that registers steel pick, shotgun, and grenade: + +```lua +treasures = default:pick_steel,0.5,5,1,10;shooter:shotgun,0.04,2,1;shooter:grenade,0.08,2,1 +``` + +(See [here](../../other/treasurer/README.md) to understand the magic numbers) diff --git a/mods/ctf/ctf_map/depends.txt b/mods/ctf/ctf_map/depends.txt index 35bedcd..246946f 100644 --- a/mods/ctf/ctf_map/depends.txt +++ b/mods/ctf/ctf_map/depends.txt @@ -1,4 +1,5 @@ default +ctf_treasure? stairs? wool? ctf_team_base? diff --git a/mods/ctf/ctf_map/schem_map.lua b/mods/ctf/ctf_map/schem_map.lua index a1b6aae..3dd9424 100644 --- a/mods/ctf/ctf_map/schem_map.lua +++ b/mods/ctf/ctf_map/schem_map.lua @@ -137,10 +137,12 @@ function ctf_match.load_map_meta(idx, name) local meta = Settings(conf_path) if meta:get("r") == nil then - error("Map was not properly configured " .. conf_path) + error("Map was not properly configured: " .. conf_path) end local initial_stuff = meta:get("initial_stuff") + local treasures = meta:get("treasures") + treasures = treasures and treasures:split(";") local map = { idx = idx, name = meta:get("name"), @@ -149,11 +151,12 @@ function ctf_match.load_map_meta(idx, name) rotation = meta:get("rotation"), schematic = name .. ".mts", initial_stuff = initial_stuff and initial_stuff:split(","), + treasures = treasures, r = tonumber(meta:get("r")), h = tonumber(meta:get("h")), offset = offset, teams = {}, - chests = {}, + chests = {} } assert(map.r <= max_r) @@ -176,6 +179,35 @@ function ctf_match.load_map_meta(idx, name) i = i + 1 end + -- Register per-map treasures or the default set of treasures + -- if treasures field hasn't been defined in map meta + if treasurer and ctf_treasure then + treasurer.treasures = {} + if treasures then + for _, item in pairs(treasures) do + item = item:split(",") + -- treasurer.register_treasure(name, rarity, preciousness, count) + if #item == 4 then + treasurer.register_treasure(item[1], + tonumber(item[2]), + tonumber(item[3]), + tonumber(item[4])) + -- treasurer.register_treasure(name, rarity, preciousness, {min, max}) + elseif #item == 5 then + treasurer.register_treasure(item[1], + tonumber(item[2]), + tonumber(item[3]), + { + tonumber(item[4]), + tonumber(item[5]) + }) + end + end + else + ctf_treasure.register_default_treasures() + end + end + -- Read custom chest zones from config i = 1 while meta:get("chests." .. i .. ".from") do diff --git a/mods/ctf/ctf_treasure/depends.txt b/mods/ctf/ctf_treasure/depends.txt index f05833c..f55ee17 100644 --- a/mods/ctf/ctf_treasure/depends.txt +++ b/mods/ctf/ctf_treasure/depends.txt @@ -1,2 +1 @@ treasurer -default diff --git a/mods/ctf/ctf_treasure/init.lua b/mods/ctf/ctf_treasure/init.lua index 77a5fbc..31ec1be 100644 --- a/mods/ctf/ctf_treasure/init.lua +++ b/mods/ctf/ctf_treasure/init.lua @@ -1,21 +1,25 @@ -treasurer.register_treasure("default:ladder",0.3,5,{1,20}) -treasurer.register_treasure("default:torch",0.3,5,{1,20}) -treasurer.register_treasure("default:cobble",0.4,5,{45,99}) -treasurer.register_treasure("default:apple",0.3,5,{1,8}) -treasurer.register_treasure("default:wood",0.3,5,{30,60}) -treasurer.register_treasure("doors:door_steel",0.3,5,{1,3}) +ctf_treasure = {} -treasurer.register_treasure("default:pick_steel",0.5,5,{1,10}) -treasurer.register_treasure("default:sword_stone",0.6,5,{1,10}) -treasurer.register_treasure("default:sword_steel",0.4,5,{1,4}) -treasurer.register_treasure("default:shovel_stone",0.6,5,{1,10}) -treasurer.register_treasure("default:shovel_steel",0.3,5,{1,10}) +function ctf_treasure.register_default_treasures() + treasurer.register_treasure("default:ladder",0.3,5,{1,20}) + treasurer.register_treasure("default:torch",0.3,5,{1,20}) + treasurer.register_treasure("default:cobble",0.4,5,{45,99}) + treasurer.register_treasure("default:apple",0.3,5,{1,8}) + treasurer.register_treasure("default:wood",0.3,5,{30,60}) + treasurer.register_treasure("doors:door_steel",0.3,5,{1,3}) -treasurer.register_treasure("shooter:crossbow",0.5,2,{1,5}) -treasurer.register_treasure("shooter:pistol",0.4,2,{1,5}) -treasurer.register_treasure("shooter:rifle",0.1,2,{1,2}) -treasurer.register_treasure("shooter:shotgun",0.04,2,1) -treasurer.register_treasure("shooter:grenade",0.08,2,1) -treasurer.register_treasure("shooter:machine_gun",0.02,2,1) -treasurer.register_treasure("shooter:ammo",0.3,2,{1,10}) -treasurer.register_treasure("shooter:arrow_white",0.5,2,{2,18}) + treasurer.register_treasure("default:pick_steel",0.5,5,{1,10}) + treasurer.register_treasure("default:sword_stone",0.6,5,{1,10}) + treasurer.register_treasure("default:sword_steel",0.4,5,{1,4}) + treasurer.register_treasure("default:shovel_stone",0.6,5,{1,10}) + treasurer.register_treasure("default:shovel_steel",0.3,5,{1,10}) + + treasurer.register_treasure("shooter:crossbow",0.5,2,{1,5}) + treasurer.register_treasure("shooter:pistol",0.4,2,{1,5}) + treasurer.register_treasure("shooter:rifle",0.1,2,{1,2}) + treasurer.register_treasure("shooter:shotgun",0.04,2,1) + treasurer.register_treasure("shooter:grenade",0.08,2,1) + treasurer.register_treasure("shooter:machine_gun",0.02,2,1) + treasurer.register_treasure("shooter:ammo",0.3,2,{1,10}) + treasurer.register_treasure("shooter:arrow_white",0.5,2,{2,18}) +end From b2fc3028228747b75f68b7f9756de0d67099b22a Mon Sep 17 00:00:00 2001 From: ANAND Date: Thu, 28 Feb 2019 09:18:50 +0530 Subject: [PATCH 6/6] Combine furnace recipes; use group:stone as input (#340) --- mods/ctf/ctf_crafting/init.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index 98b7d3d..380d684 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -46,20 +46,11 @@ crafting.register_recipe({ level = 1, }) --- Furnace <== Cobble x8 +-- Furnace <== group:stone x8 crafting.register_recipe({ type = "inv", output = "default:furnace", - items = { "default:cobble 8" }, - always_known = true, - level = 1, -}) - --- Furnace <== Desert cobble x8 -crafting.register_recipe({ - type = "inv", - output = "default:furnace", - items = { "default:desert_cobble 8" }, + items = { "group:stone 8" }, always_known = true, level = 1, })