Skip to content

Commit

Permalink
Merge pull request #36 from WoosterUK/master
Browse files Browse the repository at this point in the history
Re-factor wand registration to avoid oversights in deconversion recipes
  • Loading branch information
thomasrudin committed Aug 14, 2019
2 parents 3c4c8be + 69606ed commit 2421b31
Showing 1 changed file with 28 additions and 36 deletions.
64 changes: 28 additions & 36 deletions wand.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@

minetest.register_craftitem("missions:wand_position", {
description = "Mission wand with position",
inventory_image = "missions_wand_position.png",
stack_max = 1
})

minetest.register_craftitem("missions:wand_chest", {
description = "Mission wand with chest-reference",
inventory_image = "missions_wand_chest.png",
stack_max = 1
})

minetest.register_craftitem("missions:wand_mission", {
description = "Mission wand with mission-reference",
inventory_image = "missions_wand_mission.png",
stack_max = 1
})


-- base wand
-- register item
minetest.register_craftitem("missions:wand", {
description = "Mission wand",
inventory_image = "missions_wand.png",
Expand All @@ -30,26 +12,36 @@ minetest.register_craftitem("missions:wand", {
end
})


-- crafts

minetest.register_craft({
type = "shapeless",
output = "missions:wand",
recipe = {"missions:wand_chest"}
})

minetest.register_craft({
type = "shapeless",
output = "missions:wand",
recipe = {"missions:wand_position"}
})

--register craft
minetest.register_craft({
output = "missions:wand 3",
recipe = {
{"default:stick", "", "default:obsidian_shard"},
{"", "default:stick", ""},
{"default:mese_crystal_fragment", "", "default:stick"}
}
})
})

-- converted wands
-- helper table to track which wands are being added
wands = {
["position"] = "position",
["chest"] = "chest-reference",
["mission"] = "mission-reference"
}

for key, value in pairs(wands) do
-- register item
minetest.register_craftitem("missions:wand_" .. key, {
description = "Mission wand with " .. value,
inventory_image = "missions_wand_" .. key .. ".png",
stack_max = 1
})

-- register deconversion
minetest.register_craft({
type = "shapeless",
output = "missions:wand",
recipe = {"missions:wand_" .. key}
})
end

0 comments on commit 2421b31

Please sign in to comment.