Buff medic class and allow item whitelisting
This commit is contained in:
parent
eb5ea25d54
commit
119e47d22e
3 changed files with 40 additions and 10 deletions
|
@ -16,9 +16,13 @@ function ctf_classes.register(cname, def)
|
||||||
|
|
||||||
if not def.properties.item_blacklist then
|
if not def.properties.item_blacklist then
|
||||||
def.properties.item_blacklist = {}
|
def.properties.item_blacklist = {}
|
||||||
for i=1, #def.properties.initial_stuff do
|
for i, item in ipairs(def.properties.initial_stuff) do
|
||||||
def.properties.item_blacklist[i] =
|
local iname = ItemStack(item):get_name()
|
||||||
ItemStack(def.properties.initial_stuff[i]):get_name()
|
|
||||||
|
-- Only add to item blacklist if not in the whitelist
|
||||||
|
if table.indexof(def.properties.item_whitelist or {}, iname) == -1 then
|
||||||
|
def.properties.item_blacklist[i] = iname
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -117,8 +121,10 @@ function ctf_classes.update(player)
|
||||||
set_max_hp(player, class.properties.max_hp)
|
set_max_hp(player, class.properties.max_hp)
|
||||||
ctf_classes.set_skin(player, color, class)
|
ctf_classes.set_skin(player, color, class)
|
||||||
|
|
||||||
physics.set(player:get_player_name(), "ctf_classes:speed", {
|
physics.set(player:get_player_name(), "ctf_classes:physics", {
|
||||||
speed = class.properties.speed,
|
speed = class.properties.speed,
|
||||||
|
jump = class.properties.jump,
|
||||||
|
gravity = class.properties.gravity,
|
||||||
})
|
})
|
||||||
|
|
||||||
crafting.lock_all(player:get_player_name())
|
crafting.lock_all(player:get_player_name())
|
||||||
|
|
|
@ -67,7 +67,7 @@ ctf_classes.register("shooter", {
|
||||||
|
|
||||||
ctf_classes.register("medic", {
|
ctf_classes.register("medic", {
|
||||||
description = "Medic",
|
description = "Medic",
|
||||||
pros = { "x2 regen for nearby friendlies", "+10% speed" },
|
pros = { "x2 regen for nearby friendlies", "Building supplies", "+10% speed" },
|
||||||
cons = {},
|
cons = {},
|
||||||
color = "#0af",
|
color = "#0af",
|
||||||
properties = {
|
properties = {
|
||||||
|
@ -76,13 +76,27 @@ ctf_classes.register("medic", {
|
||||||
|
|
||||||
initial_stuff = {
|
initial_stuff = {
|
||||||
"ctf_bandages:bandage 50",
|
"ctf_bandages:bandage 50",
|
||||||
|
"default:pick_steel",
|
||||||
|
"default:shovel_steel",
|
||||||
|
"default:cobble 99"
|
||||||
|
},
|
||||||
|
|
||||||
|
item_whitelist = {
|
||||||
|
"default:cobble"
|
||||||
},
|
},
|
||||||
|
|
||||||
allowed_guns = {
|
allowed_guns = {
|
||||||
"shooter_guns:pistol",
|
"shooter_guns:pistol",
|
||||||
"shooter_guns:machine_gun",
|
|
||||||
"shooter_guns:shotgun",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
crafting = {
|
||||||
|
"default:axe_bronze",
|
||||||
|
"default:axe_mese",
|
||||||
|
"default:axe_diamond",
|
||||||
|
"default:shovel_bronze",
|
||||||
|
"default:shovel_mese",
|
||||||
|
"default:shovel_diamond",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -248,22 +248,32 @@ crafting.register_recipe({
|
||||||
|
|
||||||
-- Shovels
|
-- Shovels
|
||||||
for ore, ore_item in pairs(full_ores) do
|
for ore, ore_item in pairs(full_ores) do
|
||||||
|
local show = true
|
||||||
|
if ore == "diamond" or ore == "mese" or ore == "bronze" then
|
||||||
|
show = false
|
||||||
|
end
|
||||||
|
|
||||||
crafting.register_recipe({
|
crafting.register_recipe({
|
||||||
type = "inv",
|
type = "inv",
|
||||||
output = "default:shovel_" .. ore,
|
output = "default:shovel_" .. ore,
|
||||||
items = { "default:stick 2", ore_item },
|
items = { "default:stick 2", ore_item },
|
||||||
always_known = true,
|
always_known = show,
|
||||||
level = 1,
|
level = 1,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Axes
|
-- Axes
|
||||||
for ore, ore_item in pairs(full_ores) do
|
for ore, ore_item in pairs(full_ores) do
|
||||||
|
local show = true
|
||||||
|
if ore == "diamond" or ore == "mese" or ore == "bronze" then
|
||||||
|
show = false
|
||||||
|
end
|
||||||
|
|
||||||
crafting.register_recipe({
|
crafting.register_recipe({
|
||||||
type = "inv",
|
type = "inv",
|
||||||
output = "default:axe_" .. ore,
|
output = "default:axe_" .. ore,
|
||||||
items = { "default:stick 2", ore_item .. " 3" },
|
items = { "default:stick 2", ore_item},
|
||||||
always_known = true,
|
always_known = show,
|
||||||
level = 1,
|
level = 1,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue