From 0374670579ae29416ad9a5e5671746ef3cf59382 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Wed, 3 May 2017 17:52:58 -0700 Subject: [PATCH] Move 'bottled_water' item from 'overrides' to 'antum' mod --- antum/depends.txt | 3 + antum/init.lua | 9 ++- antum/items.lua | 63 ++++++++++++++++++ .../textures/bottled_water.png | Bin overrides/crafting/invisibility.lua | 22 ++---- 5 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 antum/depends.txt create mode 100644 antum/items.lua rename {overrides => antum}/textures/bottled_water.png (100%) diff --git a/antum/depends.txt b/antum/depends.txt new file mode 100644 index 0000000..daec980 --- /dev/null +++ b/antum/depends.txt @@ -0,0 +1,3 @@ +bucket? +craft_guide? +vessels? diff --git a/antum/init.lua b/antum/init.lua index b92ad58..3cb0677 100644 --- a/antum/init.lua +++ b/antum/init.lua @@ -30,4 +30,11 @@ antum.modname = minetest.get_current_modname() antum.modpath = minetest.get_modpath(antum.modname) -dofile(antum.modpath .. '/' .. 'functions.lua') +local scripts = { + 'functions', + 'items', +} + +for I in pairs(scripts) do + dofile(antum.modpath .. '/' .. scripts[I] .. '.lua') +end diff --git a/antum/items.lua b/antum/items.lua new file mode 100644 index 0000000..2a47dcd --- /dev/null +++ b/antum/items.lua @@ -0,0 +1,63 @@ +--[[ LICENSE HEADER + + MIT License + + Copyright © 2017 Jordan Irwin + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +--]] + + +local depends_satisfied = true + +local depends = { + 'bucket', + 'vessels', +} + +for I in pairs(depends) do + if not minetest.get_modpath(depends[I]) then + depends_satisfied = false + end +end + + +minetest.register_craftitem('antum:bottled_water', { + description = 'A bottle of water', + inventory_image = 'bottled_water.png', +}) + + +if depends_satisfied then + antum.log_action(antum.modname, 'Registering craft "' .. antum.modname .. ':bottled_water"') + + minetest.register_craft({ + output = 'antum:bottled_water', + type = 'shapeless', + recipe = { + 'bucket:bucket_water', 'vessels:glass_bottle', + }, + replacements = { + {'bucket:bucket_water', 'bucket:bucket_empty'}, + }, + }) +else + antum.log_warn(antum.modname, 'Not registering craft for "' .. antum.modname .. ':bottled_water", dependency not satisfied') +end diff --git a/overrides/textures/bottled_water.png b/antum/textures/bottled_water.png similarity index 100% rename from overrides/textures/bottled_water.png rename to antum/textures/bottled_water.png diff --git a/overrides/crafting/invisibility.lua b/overrides/crafting/invisibility.lua index 3e4650a..f61f501 100644 --- a/overrides/crafting/invisibility.lua +++ b/overrides/crafting/invisibility.lua @@ -28,7 +28,9 @@ local depends_satisfied = true local depends = { + 'antum', 'bucket', + 'default', 'vessels', } @@ -41,7 +43,7 @@ end if depends_satisfied then -- Override vessels:glass_bottle --[[ - minetest.override_item('vessesl:glass_bottle', { + minetest.override_item('vessels:glass_bottle', { description = 'Glass Bottle (empty)', drawtype = 'plantlike', tiles = {'vessels_glass_bottle.png'}, @@ -102,23 +104,7 @@ if depends_satisfied then end end, })--]] - - minetest.register_craftitem(':antum:bottled_water', { - description = 'A bottle of water', - inventory_image = 'bottled_water.png', - }) - - minetest.register_craft({ - output = 'antum:bottled_water', - type = 'shapeless', - recipe = { - 'bucket:bucket_water', 'vessels:glass_bottle', - }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"}, - }, - }) minetest.register_craft({ output = 'invisibility:potion', @@ -127,4 +113,4 @@ if depends_satisfied then 'antum:bottled_water', 'default:mese_crystal_fragment', }, }) -end \ No newline at end of file +end