Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 22, 2019
1 parent 31d4205 commit 5668924
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions mods/ctf/ctf_classes/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ function ctf_classes.register(cname, def)
def.speed = def.speed or 1
def.pros = def.pros or {}
def.cons = def.cons or {}
if def.can_capture == nil then
def.can_capture = true
end
end

function ctf_classes.set_skin(player, color, class)
Expand Down
17 changes: 9 additions & 8 deletions mods/ctf/ctf_classes/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ dofile(minetest.get_modpath("ctf_classes") .. "/ranged.lua")

ctf_classes.register("knight", {
description = "Knight",
pros = { "+10 HP" },
pros = { "+50% Health Points" },
cons = { "-10% speed" },
max_hp = 30,
speed = 0.90,
color = "#ccc",
})

ctf_classes.register("shooter", {
description = "Shooter",
pros = { "+10% ranged skill", "Can use rifles", "Can use grapling hooks" },
cons = {},
speed = 1.1,
pros = { "+10% ranged skill", "Rifles and grapling hooks" },
cons = { "Can't capture the flag" },
can_capture = false,
color = "#c60",
})

ctf_classes.register("medic", {
description = "Medic",
speed = 1.1,
max_hp = 10,
pros = { "x2 regen for nearby friendlies" },
cons = { "Can't capture the flag"},
cons = { "-50% Health Points" },
color = "#0af",
})

Expand Down Expand Up @@ -72,12 +73,12 @@ local flags = {
for _, flagname in pairs(flags) do
local old_func = minetest.registered_nodes[flagname].on_punch
local function on_punch(pos, node, player, ...)
if ctf_classes.get(player).name == "medic" then
if ctf_classes.get(player).can_capture then
local flag = ctf_flag.get(pos)
local team = ctf.player(player:get_player_name()).team
if not flag or not flag.team or not team or team ~= flag.team then
minetest.chat_send_player(player:get_player_name(),
"Medics can't capture the flag!")
"Shooters can't capture the flag!")
return
end
end
Expand Down
2 changes: 1 addition & 1 deletion mods/ctf/ctf_classes/ranged.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ end
check_grapple("shooter:grapple_gun_loaded")
check_grapple("shooter:grapple_gun")

minetest.register_override("shooter:rifle", {
minetest.override_item("shooter:rifle", {
description = "Rifle\n\nCan only be used by Shooters",
})
Binary file modified mods/ctf/ctf_classes/textures/ctf_classes_skin_medic_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mods/ctf/ctf_classes/textures/ctf_classes_skin_medic_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5668924

Please sign in to comment.