Add traps
This commit is contained in:
parent
0095c18678
commit
20daeebead
11 changed files with 116 additions and 1 deletions
|
@ -1 +1,2 @@
|
||||||
crafting
|
crafting
|
||||||
|
ctf_traps?
|
||||||
|
|
|
@ -193,3 +193,43 @@ crafting.register_recipe({
|
||||||
always_known = true,
|
always_known = true,
|
||||||
level = 1,
|
level = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
crafting.register_recipe({
|
||||||
|
type = "inv",
|
||||||
|
output = "ctf_traps:spike 1",
|
||||||
|
items = { "default:steel_ingot 5" },
|
||||||
|
always_known = true,
|
||||||
|
level = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
crafting.register_recipe({
|
||||||
|
type = "inv",
|
||||||
|
output = "ctf_traps:dirt 1",
|
||||||
|
items = { "default:dirt 5", "default:coal_lump" },
|
||||||
|
always_known = true,
|
||||||
|
level = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
crafting.register_recipe({
|
||||||
|
type = "inv",
|
||||||
|
output = "ctf_traps:cobble 1",
|
||||||
|
items = { "default:cobble 5", "default:coal_lump" },
|
||||||
|
always_known = true,
|
||||||
|
level = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
crafting.register_recipe({
|
||||||
|
type = "inv",
|
||||||
|
output = "ctf_traps:stone 1",
|
||||||
|
items = { "default:stone 5", "default:coal_lump" },
|
||||||
|
always_known = true,
|
||||||
|
level = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
crafting.register_recipe({
|
||||||
|
type = "inv",
|
||||||
|
output = "ctf_traps:damage_cobble 1",
|
||||||
|
items = { "default:cobble", "default:coal_lump 4", "default:steel_ingot 4" },
|
||||||
|
always_known = true,
|
||||||
|
level = 1,
|
||||||
|
})
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 99bac967d656014ee44201936e4c1884a21f3ada
|
Subproject commit 9e2581925aed31e5572507a0aba8120c18f41fa0
|
2
mods/ctf/ctf_traps/depends.txt
Normal file
2
mods/ctf/ctf_traps/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
default
|
||||||
|
ctf
|
1
mods/ctf/ctf_traps/description.txt
Normal file
1
mods/ctf/ctf_traps/description.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Adds various traps for CTF. Ghost nodes like stone, dirt and cobblestone. The mod also adds spikes and fake cobble
|
71
mods/ctf/ctf_traps/init.lua
Normal file
71
mods/ctf/ctf_traps/init.lua
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
minetest.register_node("ctf_traps:dirt", {
|
||||||
|
description = "Unwalkable Dirt",
|
||||||
|
tiles = {"ctf_traps_dirt.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
groups = {crumbly=3, soil=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("ctf_traps:stone", {
|
||||||
|
description = "Unwalkable Stone",
|
||||||
|
tiles = {"ctf_traps_stone.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
groups = {cracky=3, stone=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("ctf_traps:cobble", {
|
||||||
|
description = "Unwalkable Cobblestone",
|
||||||
|
tiles = {"ctf_traps_cobble.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
groups = {cracky=3, stone=2}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("ctf_traps:spike", {
|
||||||
|
description = "Spike",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"ctf_traps_spike.png"},
|
||||||
|
inventory_image = "ctf_traps_spike.png",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
damage_per_second = 5,
|
||||||
|
groups = {cracky=1, level=2},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("ctf_traps:damage_cobble", {
|
||||||
|
description = "Cobblestone that damages digger of enemy team",
|
||||||
|
tiles = {"ctf_traps_damage_cobble.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = true,
|
||||||
|
groups = {cracky=3, stone=2},
|
||||||
|
on_dig = function(pos, node, digger)
|
||||||
|
local name = digger:get_player_name()
|
||||||
|
if not digger then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local digger_team = ctf.player(name).team
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local placer_team = meta:get_string("placer") or "missing"
|
||||||
|
if digger_team ~= placer_team then
|
||||||
|
local hp = digger:get_hp()
|
||||||
|
digger:set_hp(hp - 7)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
meta:set_string("placer", "")
|
||||||
|
return minetest.node_dig(pos, node, digger)
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local name = placer:get_player_name()
|
||||||
|
meta:set_string("placer", ctf.player(name).team)
|
||||||
|
end
|
||||||
|
})
|
BIN
mods/ctf/ctf_traps/textures/ctf_traps_cobble.png
Normal file
BIN
mods/ctf/ctf_traps/textures/ctf_traps_cobble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 697 B |
BIN
mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png
Normal file
BIN
mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 687 B |
BIN
mods/ctf/ctf_traps/textures/ctf_traps_dirt.png
Normal file
BIN
mods/ctf/ctf_traps/textures/ctf_traps_dirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 823 B |
BIN
mods/ctf/ctf_traps/textures/ctf_traps_spike.png
Normal file
BIN
mods/ctf/ctf_traps/textures/ctf_traps_spike.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 353 B |
BIN
mods/ctf/ctf_traps/textures/ctf_traps_stone.png
Normal file
BIN
mods/ctf/ctf_traps/textures/ctf_traps_stone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 507 B |
Loading…
Reference in a new issue