Add rocketeer class

This commit is contained in:
rubenwardy 2020-03-14 17:22:55 +00:00
parent db5948c219
commit 93693a8dfd
5 changed files with 33 additions and 5 deletions

View file

@ -2,12 +2,12 @@ function ctf_classes.show_gui(name, player)
player = player or minetest.get_player_by_name(name) player = player or minetest.get_player_by_name(name)
assert(player.get_player_name) assert(player.get_player_name)
if not ctf_classes.can_change(player) then if not ctf_classes.can_change(player) then
minetest.chat_send_player(name, "Move closer to the flag to change classes!") minetest.chat_send_player(name, "Move closer to your flag to change classes!")
return return
end end
local fs = { local fs = {
"size[9,3.4]" "size[", #ctf_classes.__classes_ordered * 3 , ",3.4]"
} }

View file

@ -76,6 +76,26 @@ ctf_classes.register("medic", {
}, },
}) })
ctf_classes.register("rocketeer", {
description = "Rocketeer",
pros = { "Can craft rockets" },
cons = {},
color = "#fa0",
properties = {
items = {
"shooter:rocket_gun_loaded",
"shooter:rocket 4",
},
allowed_guns = {
"shooter:pistol",
"shooter:smg",
"shooter:shotgun",
},
},
})
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
ctf_classes.update(player) ctf_classes.update(player)

View file

@ -17,8 +17,10 @@ local function get_shooter_specs(weapon_name, multiplier)
spec = table.copy(spec) spec = table.copy(spec)
specs_cache[idx] = spec specs_cache[idx] = spec
spec.range = spec.range * 1.5 for key, value in pairs(multiplier) do
spec.tool_caps.full_punch_interval = spec.tool_caps.full_punch_interval * 0.8 spec[key] = spec[key] * value
end
return spec return spec
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

View file

@ -28,13 +28,19 @@ function give_initial_stuff.register_stuff_provider(func, priority)
end end
function give_initial_stuff.get_stuff(player) function give_initial_stuff.get_stuff(player)
local seen_stuff = {}
local stuff = {} local stuff = {}
for i=1, #registered_stuff_providers do for i=1, #registered_stuff_providers do
local new_stuff = registered_stuff_providers[i](player) local new_stuff = registered_stuff_providers[i](player)
assert(new_stuff) assert(new_stuff)
for j=1, #new_stuff do for j=1, #new_stuff do
stuff[#stuff + 1] = new_stuff[j] local name = ItemStack(new_stuff[j]):get_name()
if not seen_stuff[name] then
seen_stuff[name] = true
stuff[#stuff + 1] = new_stuff[j]
end
end end
end end
return stuff return stuff