Buff medic class and allow item whitelisting

This commit is contained in:
LoneWolfHT 2020-10-13 16:23:09 -07:00
parent eb5ea25d54
commit 119e47d22e
3 changed files with 40 additions and 10 deletions

View file

@ -16,9 +16,13 @@ function ctf_classes.register(cname, def)
if not def.properties.item_blacklist then
def.properties.item_blacklist = {}
for i=1, #def.properties.initial_stuff do
def.properties.item_blacklist[i] =
ItemStack(def.properties.initial_stuff[i]):get_name()
for i, item in ipairs(def.properties.initial_stuff) do
local iname = ItemStack(item):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
@ -117,8 +121,10 @@ function ctf_classes.update(player)
set_max_hp(player, class.properties.max_hp)
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,
jump = class.properties.jump,
gravity = class.properties.gravity,
})
crafting.lock_all(player:get_player_name())

View file

@ -67,7 +67,7 @@ ctf_classes.register("shooter", {
ctf_classes.register("medic", {
description = "Medic",
pros = { "x2 regen for nearby friendlies", "+10% speed" },
pros = { "x2 regen for nearby friendlies", "Building supplies", "+10% speed" },
cons = {},
color = "#0af",
properties = {
@ -76,13 +76,27 @@ ctf_classes.register("medic", {
initial_stuff = {
"ctf_bandages:bandage 50",
"default:pick_steel",
"default:shovel_steel",
"default:cobble 99"
},
item_whitelist = {
"default:cobble"
},
allowed_guns = {
"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",
}
},
})

View file

@ -248,22 +248,32 @@ crafting.register_recipe({
-- Shovels
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({
type = "inv",
output = "default:shovel_" .. ore,
items = { "default:stick 2", ore_item },
always_known = true,
always_known = show,
level = 1,
})
end
-- Axes
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({
type = "inv",
output = "default:axe_" .. ore,
items = { "default:stick 2", ore_item .. " 3" },
always_known = true,
items = { "default:stick 2", ore_item},
always_known = show,
level = 1,
})
end