From 59d199a7a5f78eeba7a33045a3684e5db7d40d21 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 14 Mar 2020 22:48:50 +0000 Subject: [PATCH] Add rocket crafting --- mods/ctf/ctf_classes/api.lua | 5 +++++ mods/ctf/ctf_classes/classes.lua | 4 ++++ mods/ctf/ctf_classes/mod.conf | 2 +- mods/ctf/ctf_crafting/init.lua | 18 ++++++++++++++++++ mods/other/crafting | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/mods/ctf/ctf_classes/api.lua b/mods/ctf/ctf_classes/api.lua index 1de7c29..174c81c 100644 --- a/mods/ctf/ctf_classes/api.lua +++ b/mods/ctf/ctf_classes/api.lua @@ -119,6 +119,11 @@ function ctf_classes.update(player) physics.set(player:get_player_name(), "ctf_classes:speed", { speed = speed, }) + + crafting.lock_all(player:get_player_name()) + for i=1, #(class.properties.crafting or {}) do + crafting.unlock(player:get_player_name(), class.properties.crafting[i]) + end end local function sqdist(a, b) diff --git a/mods/ctf/ctf_classes/classes.lua b/mods/ctf/ctf_classes/classes.lua index 5142e63..5502488 100644 --- a/mods/ctf/ctf_classes/classes.lua +++ b/mods/ctf/ctf_classes/classes.lua @@ -96,5 +96,9 @@ ctf_classes.register("rocketeer", { "shooter_guns:smg", "shooter_guns:shotgun", }, + + crafting = { + "shooter_rocket:rocket" + }, }, }) diff --git a/mods/ctf/ctf_classes/mod.conf b/mods/ctf/ctf_classes/mod.conf index 4b3a279..ba549d8 100644 --- a/mods/ctf/ctf_classes/mod.conf +++ b/mods/ctf/ctf_classes/mod.conf @@ -1,3 +1,3 @@ name = ctf_classes -depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie +depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie, crafting description = Adds classes, including knight, shooter, and medic diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index 36fd84c..d4ef1de 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -11,6 +11,24 @@ local upgrades = { mese = "diamond", } +-- Rocket <== Gold ingot x16 + Coal lump x5 +crafting.register_recipe({ + type = "inv", + output = "shooter_rocket:rocket", + items = { "default:gold_ingot 16", "default:coal_lump 5" }, + always_known = false, + level = 1, +}) + +-- Rocket <== Mese x5 + Coal lump x5 +crafting.register_recipe({ + type = "inv", + output = "shooter_rocket:rocket", + items = { "default:mese 5", "default:coal_lump 5" }, + always_known = false, + level = 1, +}) + -- Swords for from, to in pairs(upgrades) do crafting.register_recipe({ diff --git a/mods/other/crafting b/mods/other/crafting index c6cd6ad..6072315 160000 --- a/mods/other/crafting +++ b/mods/other/crafting @@ -1 +1 @@ -Subproject commit c6cd6ad62d9f4076a22d985defc8a966a17f569d +Subproject commit 60723159bba3893e9750177b2d6a6f09e077bd72