From d5b2817c881eaf46e09dcc6b5e390c1412b87d72 Mon Sep 17 00:00:00 2001 From: Ben Deutsch Date: Sun, 5 Jul 2015 14:52:47 +0200 Subject: [PATCH] Individual components can be enabled / disabled via configuration --- components.lua | 335 +++++++++++++++++++++++-------------------- configuration.lua | 7 + depends.txt | 4 +- thirsty.conf.example | 26 +++- 4 files changed, 209 insertions(+), 163 deletions(-) diff --git a/components.lua b/components.lua index 9f2a3b1..ae674c1 100644 --- a/components.lua +++ b/components.lua @@ -22,28 +22,30 @@ on use. ]] -if (minetest.get_modpath("vessels")) then +if minetest.get_modpath("vessels") and thirsty.config.register_vessels then -- add "drinking" to vessels thirsty.augment_item_for_drinking('vessels:drinking_glass', 22) thirsty.augment_item_for_drinking('vessels:glass_bottle', 24) thirsty.augment_item_for_drinking('vessels:steel_bottle', 26) end --- our own simple wooden bowl -minetest.register_craftitem('thirsty:wooden_bowl', { - description = "Wooden bowl", - inventory_image = "thirsty_bowl_16.png", - liquids_pointable = true, - on_use = thirsty.on_use(nil), -}) +if minetest.get_modpath("default") and thirsty.config.register_bowl then + -- our own simple wooden bowl + minetest.register_craftitem('thirsty:wooden_bowl', { + description = "Wooden bowl", + inventory_image = "thirsty_bowl_16.png", + liquids_pointable = true, + on_use = thirsty.on_use(nil), + }) -minetest.register_craft({ - output = "thirsty:wooden_bowl", - recipe = { - {"group:wood", "", "group:wood"}, - {"", "group:wood", ""} - } -}) + minetest.register_craft({ + output = "thirsty:wooden_bowl", + recipe = { + {"group:wood", "", "group:wood"}, + {"", "group:wood", ""} + } + }) +end --[[ @@ -60,38 +62,42 @@ Wear corresponds to hydro level as follows: ]] -minetest.register_tool('thirsty:steel_canteen', { - description = 'Steel canteen', - inventory_image = "thirsty_steel_canteen_16.png", - liquids_pointable = true, - stack_max = 1, - on_use = thirsty.on_use(nil), -}) +if minetest.get_modpath("default") and thirsty.config.register_canteens then -minetest.register_tool('thirsty:bronze_canteen', { - description = 'Bronze canteen', - inventory_image = "thirsty_bronze_canteen_16.png", - liquids_pointable = true, - stack_max = 1, - on_use = thirsty.on_use(nil), -}) + minetest.register_tool('thirsty:steel_canteen', { + description = 'Steel canteen', + inventory_image = "thirsty_steel_canteen_16.png", + liquids_pointable = true, + stack_max = 1, + on_use = thirsty.on_use(nil), + }) -minetest.register_craft({ - output = "thirsty:steel_canteen", - recipe = { - { "group:wood", ""}, - { "default:steel_ingot", "default:steel_ingot"}, - { "default:steel_ingot", "default:steel_ingot"} - } -}) -minetest.register_craft({ - output = "thirsty:bronze_canteen", - recipe = { - { "group:wood", ""}, - { "default:bronze_ingot", "default:bronze_ingot"}, - { "default:bronze_ingot", "default:bronze_ingot"} - } -}) + minetest.register_tool('thirsty:bronze_canteen', { + description = 'Bronze canteen', + inventory_image = "thirsty_bronze_canteen_16.png", + liquids_pointable = true, + stack_max = 1, + on_use = thirsty.on_use(nil), + }) + + minetest.register_craft({ + output = "thirsty:steel_canteen", + recipe = { + { "group:wood", ""}, + { "default:steel_ingot", "default:steel_ingot"}, + { "default:steel_ingot", "default:steel_ingot"} + } + }) + minetest.register_craft({ + output = "thirsty:bronze_canteen", + recipe = { + { "group:wood", ""}, + { "default:bronze_ingot", "default:bronze_ingot"}, + { "default:bronze_ingot", "default:bronze_ingot"} + } + }) + +end --[[ @@ -99,48 +105,52 @@ Tier 3 ]] -minetest.register_node('thirsty:drinking_fountain', { - description = 'Drinking fountain', - drawtype = 'nodebox', - tiles = { - -- top, bottom, right, left, front, back - 'thirsty_drinkfount_top.png', - 'thirsty_drinkfount_bottom.png', - 'thirsty_drinkfount_side.png', - 'thirsty_drinkfount_side.png', - 'thirsty_drinkfount_side.png', - 'thirsty_drinkfount_side.png', - }, - paramtype = 'light', - groups = { cracky = 2 }, - node_box = { - type = "fixed", - fixed = { - { -3/16, -8/16, -3/16, 3/16, 3/16, 3/16 }, - { -8/16, 3/16, -8/16, 8/16, 6/16, 8/16 }, - { -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 }, - { -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, - { -8/16, 6/16, -6/16, -6/16, 8/16, 6/16 }, - { 6/16, 6/16, -6/16, 8/16, 8/16, 6/16 }, - }, - }, - selection_box = { - type = "regular", - }, - collision_box = { - type = "regular", - }, - on_rightclick = thirsty.on_rightclick(nil), -}) +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_drinking_fountain then -minetest.register_craft({ - output = "thirsty:drinking_fountain", - recipe = { - { "default:stone", "bucket:bucket_water", "default:stone"}, - { "", "default:stone", ""}, - { "", "default:stone", ""} - } -}) + minetest.register_node('thirsty:drinking_fountain', { + description = 'Drinking fountain', + drawtype = 'nodebox', + tiles = { + -- top, bottom, right, left, front, back + 'thirsty_drinkfount_top.png', + 'thirsty_drinkfount_bottom.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + node_box = { + type = "fixed", + fixed = { + { -3/16, -8/16, -3/16, 3/16, 3/16, 3/16 }, + { -8/16, 3/16, -8/16, 8/16, 6/16, 8/16 }, + { -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 }, + { -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, + { -8/16, 6/16, -6/16, -6/16, 8/16, 6/16 }, + { 6/16, 6/16, -6/16, 8/16, 8/16, 6/16 }, + }, + }, + selection_box = { + type = "regular", + }, + collision_box = { + type = "regular", + }, + on_rightclick = thirsty.on_rightclick(nil), + }) + + minetest.register_craft({ + output = "thirsty:drinking_fountain", + recipe = { + { "default:stone", "bucket:bucket_water", "default:stone"}, + { "", "default:stone", ""}, + { "", "default:stone", ""} + } + }) + +end --[[ @@ -148,60 +158,63 @@ Tier 4+: the water fountains, plus extenders ]] -minetest.register_node('thirsty:water_fountain', { - description = 'Water fountain', - tiles = { - -- top, bottom, right, left, front, back - 'thirsty_waterfountain_top.png', - 'thirsty_waterfountain_top.png', - 'thirsty_waterfountain_side.png', - 'thirsty_waterfountain_side.png', - 'thirsty_waterfountain_side.png', - 'thirsty_waterfountain_side.png', - }, - paramtype = 'light', - groups = { cracky = 2 }, -}) +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_fountains then -minetest.register_node('thirsty:water_extender', { - description = 'Water fountain extender', - tiles = { - 'thirsty_waterextender_top.png', - 'thirsty_waterextender_top.png', - 'thirsty_waterextender_side.png', - 'thirsty_waterextender_side.png', - 'thirsty_waterextender_side.png', - 'thirsty_waterextender_side.png', - }, - paramtype = 'light', - groups = { cracky = 2 }, -}) + minetest.register_node('thirsty:water_fountain', { + description = 'Water fountain', + tiles = { + -- top, bottom, right, left, front, back + 'thirsty_waterfountain_top.png', + 'thirsty_waterfountain_top.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + }) -minetest.register_craft({ - output = "thirsty:water_fountain", - recipe = { - { "default:copper_ingot", "bucket:bucket_water", "default:copper_ingot"}, - { "", "default:copper_ingot", ""}, - { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} - } -}) -minetest.register_craft({ - output = "thirsty:water_extender", - recipe = { - { "", "bucket:bucket_water", ""}, - { "", "default:copper_ingot", ""}, - { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} - } -}) + minetest.register_node('thirsty:water_extender', { + description = 'Water fountain extender', + tiles = { + 'thirsty_waterextender_top.png', + 'thirsty_waterextender_top.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + }) + + minetest.register_craft({ + output = "thirsty:water_fountain", + recipe = { + { "default:copper_ingot", "bucket:bucket_water", "default:copper_ingot"}, + { "", "default:copper_ingot", ""}, + { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} + } + }) + minetest.register_craft({ + output = "thirsty:water_extender", + recipe = { + { "", "bucket:bucket_water", ""}, + { "", "default:copper_ingot", ""}, + { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} + } + }) -minetest.register_abm({ - nodenames = {'thirsty:water_fountain'}, - interval = 2, - chance = 5, - action = thirsty.fountain_abm, -}) + minetest.register_abm({ + nodenames = {'thirsty:water_fountain'}, + interval = 2, + chance = 5, + action = thirsty.fountain_abm, + }) +end --[[ @@ -212,28 +225,32 @@ they are searched for in player's inventories ]] -minetest.register_craftitem('thirsty:injector', { - description = 'Water injector', - inventory_image = 'thirsty_injector.png', -}) -minetest.register_craft({ - output = "thirsty:injector", - recipe = { - { "default:diamond", "default:mese_crystal", "default:diamond"}, - { "default:mese_crystal", "bucket:bucket_water", "default:mese_crystal"}, - { "default:diamond", "default:mese_crystal", "default:diamond"} - } -}) +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_amulets then -minetest.register_craftitem('thirsty:extractor', { - description = 'Water extractor', - inventory_image = 'thirsty_extractor.png', -}) -minetest.register_craft({ - output = "thirsty:extractor", - recipe = { - { "default:mese_crystal", "default:diamond", "default:mese_crystal"}, - { "default:diamond", "bucket:bucket_water", "default:diamond"}, - { "default:mese_crystal", "default:diamond", "default:mese_crystal"} - } -}) + minetest.register_craftitem('thirsty:injector', { + description = 'Water injector', + inventory_image = 'thirsty_injector.png', + }) + minetest.register_craft({ + output = "thirsty:injector", + recipe = { + { "default:diamond", "default:mese_crystal", "default:diamond"}, + { "default:mese_crystal", "bucket:bucket_water", "default:mese_crystal"}, + { "default:diamond", "default:mese_crystal", "default:diamond"} + } + }) + + minetest.register_craftitem('thirsty:extractor', { + description = 'Water extractor', + inventory_image = 'thirsty_extractor.png', + }) + minetest.register_craft({ + output = "thirsty:extractor", + recipe = { + { "default:mese_crystal", "default:diamond", "default:mese_crystal"}, + { "default:diamond", "bucket:bucket_water", "default:diamond"}, + { "default:mese_crystal", "default:diamond", "default:mese_crystal"} + } + }) + +end diff --git a/configuration.lua b/configuration.lua index 75281c7..c8f21ed 100644 --- a/configuration.lua +++ b/configuration.lua @@ -75,6 +75,13 @@ thirsty.config = { ['thirsty:injector'] = 0.5, }, + register_vessels = true, + register_bowl = true, + register_canteens = true, + register_drinking_fountain = true, + register_fountains = true, + register_amulets = true, + } -- read more configuration from thirsty.conf diff --git a/depends.txt b/depends.txt index e3ead33..e809f30 100644 --- a/depends.txt +++ b/depends.txt @@ -1,5 +1,5 @@ -default -bucket +default? +bucket? hud? hudbars? vessels? diff --git a/thirsty.conf.example b/thirsty.conf.example index 9affe73..52545d7 100644 --- a/thirsty.conf.example +++ b/thirsty.conf.example @@ -23,10 +23,10 @@ thirsty.config.thirst_per_second = 1.0 / 20.0 thirsty.config.damage_per_second = 1.0 / 10.0 -- How long in seconds you have to remain still to drink from standing -- in water -thirsty.config.stand_still_for_drink = 1.0, +thirsty.config.stand_still_for_drink = 1.0 -- How long in seconds of not moving before a player is deemed AFK -- (away from keyboard), such players no longer get thirsty or damaged -thirsty.config.stand_still_for_afk = 120.0, -- 2 Minutes +thirsty.config.stand_still_for_afk = 120.0 -- 2 Minutes -- regen_from_node is a table defining, for each node type, the -- amount of hydro per second a player drinks by standing in it. @@ -79,3 +79,25 @@ thirsty.config.fountain_distance_per_level = 5 thirsty.config.extraction_for_item['thirsty:extractor'] = 0.6 -- How much hydration does a given item *inject* (fill you up with) thirsty.config.injection_for_item['thirsty:injector'] = 0.5 + +-- Registration of individual components +-- These flags enable or disable the predefined components included +-- in this mod. They do *not* enable or disable the functionality. + +-- Should we augment the vessels from the "vessels" mod? +thirsty.config.register_vessels = true + +-- Add the wooden bowl and crafting recipe? +thirsty.config.register_bowl = true + +-- Add the canteens and crafting recipes? +thirsty.config.register_canteens = true + +-- Add the drinking fountain and crafting recipes? +thirsty.config.register_drinking_fountain = true + +-- Add the fountain and extenders and crafting recipes? +thirsty.config.register_fountains = true + +-- Add the amulets (extractor / injector) and crafting recipes? +thirsty.config.register_amulets = true