Individual components can be enabled / disabled via configuration

master
Ben Deutsch 2015-07-05 14:52:47 +02:00
parent 234880964f
commit d5b2817c88
4 changed files with 209 additions and 163 deletions

View File

@ -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 -- add "drinking" to vessels
thirsty.augment_item_for_drinking('vessels:drinking_glass', 22) thirsty.augment_item_for_drinking('vessels:drinking_glass', 22)
thirsty.augment_item_for_drinking('vessels:glass_bottle', 24) thirsty.augment_item_for_drinking('vessels:glass_bottle', 24)
thirsty.augment_item_for_drinking('vessels:steel_bottle', 26) thirsty.augment_item_for_drinking('vessels:steel_bottle', 26)
end end
-- our own simple wooden bowl if minetest.get_modpath("default") and thirsty.config.register_bowl then
minetest.register_craftitem('thirsty:wooden_bowl', { -- our own simple wooden bowl
description = "Wooden bowl", minetest.register_craftitem('thirsty:wooden_bowl', {
inventory_image = "thirsty_bowl_16.png", description = "Wooden bowl",
liquids_pointable = true, inventory_image = "thirsty_bowl_16.png",
on_use = thirsty.on_use(nil), liquids_pointable = true,
}) on_use = thirsty.on_use(nil),
})
minetest.register_craft({ minetest.register_craft({
output = "thirsty:wooden_bowl", output = "thirsty:wooden_bowl",
recipe = { recipe = {
{"group:wood", "", "group:wood"}, {"group:wood", "", "group:wood"},
{"", "group:wood", ""} {"", "group:wood", ""}
} }
}) })
end
--[[ --[[
@ -60,38 +62,42 @@ Wear corresponds to hydro level as follows:
]] ]]
minetest.register_tool('thirsty:steel_canteen', { if minetest.get_modpath("default") and thirsty.config.register_canteens then
description = 'Steel canteen',
inventory_image = "thirsty_steel_canteen_16.png",
liquids_pointable = true,
stack_max = 1,
on_use = thirsty.on_use(nil),
})
minetest.register_tool('thirsty:bronze_canteen', { minetest.register_tool('thirsty:steel_canteen', {
description = 'Bronze canteen', description = 'Steel canteen',
inventory_image = "thirsty_bronze_canteen_16.png", inventory_image = "thirsty_steel_canteen_16.png",
liquids_pointable = true, liquids_pointable = true,
stack_max = 1, stack_max = 1,
on_use = thirsty.on_use(nil), on_use = thirsty.on_use(nil),
}) })
minetest.register_craft({ minetest.register_tool('thirsty:bronze_canteen', {
output = "thirsty:steel_canteen", description = 'Bronze canteen',
recipe = { inventory_image = "thirsty_bronze_canteen_16.png",
{ "group:wood", ""}, liquids_pointable = true,
{ "default:steel_ingot", "default:steel_ingot"}, stack_max = 1,
{ "default:steel_ingot", "default:steel_ingot"} on_use = thirsty.on_use(nil),
} })
})
minetest.register_craft({ minetest.register_craft({
output = "thirsty:bronze_canteen", output = "thirsty:steel_canteen",
recipe = { recipe = {
{ "group:wood", ""}, { "group:wood", ""},
{ "default:bronze_ingot", "default:bronze_ingot"}, { "default:steel_ingot", "default:steel_ingot"},
{ "default:bronze_ingot", "default:bronze_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', { if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_drinking_fountain then
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({ minetest.register_node('thirsty:drinking_fountain', {
output = "thirsty:drinking_fountain", description = 'Drinking fountain',
recipe = { drawtype = 'nodebox',
{ "default:stone", "bucket:bucket_water", "default:stone"}, tiles = {
{ "", "default:stone", ""}, -- top, bottom, right, left, front, back
{ "", "default:stone", ""} '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', { if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_fountains then
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_node('thirsty:water_extender', { minetest.register_node('thirsty:water_fountain', {
description = 'Water fountain extender', description = 'Water fountain',
tiles = { tiles = {
'thirsty_waterextender_top.png', -- top, bottom, right, left, front, back
'thirsty_waterextender_top.png', 'thirsty_waterfountain_top.png',
'thirsty_waterextender_side.png', 'thirsty_waterfountain_top.png',
'thirsty_waterextender_side.png', 'thirsty_waterfountain_side.png',
'thirsty_waterextender_side.png', 'thirsty_waterfountain_side.png',
'thirsty_waterextender_side.png', 'thirsty_waterfountain_side.png',
}, 'thirsty_waterfountain_side.png',
paramtype = 'light', },
groups = { cracky = 2 }, paramtype = 'light',
}) groups = { cracky = 2 },
})
minetest.register_craft({ minetest.register_node('thirsty:water_extender', {
output = "thirsty:water_fountain", description = 'Water fountain extender',
recipe = { tiles = {
{ "default:copper_ingot", "bucket:bucket_water", "default:copper_ingot"}, 'thirsty_waterextender_top.png',
{ "", "default:copper_ingot", ""}, 'thirsty_waterextender_top.png',
{ "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} 'thirsty_waterextender_side.png',
} 'thirsty_waterextender_side.png',
}) 'thirsty_waterextender_side.png',
minetest.register_craft({ 'thirsty_waterextender_side.png',
output = "thirsty:water_extender", },
recipe = { paramtype = 'light',
{ "", "bucket:bucket_water", ""}, groups = { cracky = 2 },
{ "", "default:copper_ingot", ""}, })
{ "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}
} 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({ minetest.register_abm({
nodenames = {'thirsty:water_fountain'}, nodenames = {'thirsty:water_fountain'},
interval = 2, interval = 2,
chance = 5, chance = 5,
action = thirsty.fountain_abm, action = thirsty.fountain_abm,
}) })
end
--[[ --[[
@ -212,28 +225,32 @@ they are searched for in player's inventories
]] ]]
minetest.register_craftitem('thirsty:injector', { if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_amulets then
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', { minetest.register_craftitem('thirsty:injector', {
description = 'Water extractor', description = 'Water injector',
inventory_image = 'thirsty_extractor.png', inventory_image = 'thirsty_injector.png',
}) })
minetest.register_craft({ minetest.register_craft({
output = "thirsty:extractor", output = "thirsty:injector",
recipe = { recipe = {
{ "default:mese_crystal", "default:diamond", "default:mese_crystal"}, { "default:diamond", "default:mese_crystal", "default:diamond"},
{ "default:diamond", "bucket:bucket_water", "default:diamond"}, { "default:mese_crystal", "bucket:bucket_water", "default:mese_crystal"},
{ "default:mese_crystal", "default:diamond", "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

View File

@ -75,6 +75,13 @@ thirsty.config = {
['thirsty:injector'] = 0.5, ['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 -- read more configuration from thirsty.conf

View File

@ -1,5 +1,5 @@
default default?
bucket bucket?
hud? hud?
hudbars? hudbars?
vessels? vessels?

View File

@ -23,10 +23,10 @@ thirsty.config.thirst_per_second = 1.0 / 20.0
thirsty.config.damage_per_second = 1.0 / 10.0 thirsty.config.damage_per_second = 1.0 / 10.0
-- How long in seconds you have to remain still to drink from standing -- How long in seconds you have to remain still to drink from standing
-- in water -- 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 -- How long in seconds of not moving before a player is deemed AFK
-- (away from keyboard), such players no longer get thirsty or damaged -- (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 -- regen_from_node is a table defining, for each node type, the
-- amount of hydro per second a player drinks by standing in it. -- 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 thirsty.config.extraction_for_item['thirsty:extractor'] = 0.6
-- How much hydration does a given item *inject* (fill you up with) -- How much hydration does a given item *inject* (fill you up with)
thirsty.config.injection_for_item['thirsty:injector'] = 0.5 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