create built-in substitutes for fireflies and bones mods for when those aren't available

This commit is contained in:
FaceDeer 2022-08-11 13:41:51 -06:00
parent 56850bb7e7
commit 88f950a21a
21 changed files with 368 additions and 20 deletions

View File

@ -4,6 +4,53 @@ local dungeon_loot_path = minetest.get_modpath("dungeon_loot")
bones_loot = {}
local bones_formspec =
"size[8,9]" ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" ..
"listring[current_player;main]"
if minetest.get_modpath("default") then
bones_formspec = bones_formspec .. default.get_hotbar_bg(0,4.85)
end
if minetest.get_modpath("bones") then
df_dependencies.node_name_bones = "bones:bones"
else
minetest.register_node("bones_loot:bones", {
description = S("Bones"),
tiles = {
"bones_top.png^[transform2",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {oddly_diggable_by_hand=1},
sounds = df_dependencies.sound_gravel(),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return inv:is_empty("main")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", bones_formspec)
end,
on_blast = function(pos)
end,
})
df_dependencies.node_name_bones = "bones_loot:bones"
end
local bones_node = df_dependencies.node_name_bones
local local_loot = {}
local local_loot_register = function(t)
if t.name ~= nil then
@ -104,19 +151,8 @@ bones_loot.get_loot = function(pos, loot_type, max_stacks, exclusive_loot_type)
return items
end
local bones_formspec =
"size[8,9]" ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" ..
"listring[current_player;main]"
if minetest.get_modpath("default") then
bones_formspec = bones_formspec .. default.get_hotbar_bg(0,4.85)
end
bones_loot.place_bones = function(pos, loot_type, max_stacks, infotext, exclusive_loot_type)
minetest.set_node(pos, {name="bones:bones", param2 = math.random(1,4)-1})
minetest.set_node(pos, {name=bones_node, param2 = math.random(1,4)-1})
local meta = minetest.get_meta(pos)
if infotext == nil then
infotext = S("Someone's old bones")
@ -137,7 +173,7 @@ end
minetest.register_lbm({
label = "Repair underworld bones formspec",
name = "bones_loot:repair_underworld_bones_formspec",
nodenames = {"bones:bones"},
nodenames = {bones_node},
action = function(pos, node)
local meta = minetest.get_meta(pos)
if not meta:get("formspec") then

View File

@ -1,4 +1,4 @@
name = bones_loot
description = An API that allows bones to be placed procedurally with randomly generated loot
depends = bones
optional_depends = dungeon_loot, default
depends = df_dependencies
optional_depends = dungeon_loot, bones

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

View File

@ -0,0 +1,58 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 PilzAdam
Copyright (C) 2012-2016 Various Minetest developers and contributors
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.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2016 paramat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

View File

@ -194,6 +194,7 @@ local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_
local firefly_vi = vi + ystride * math.random(1, 5)
if data[firefly_vi] == c_air then
data[firefly_vi] = c_fireflies
minetest.get_node_timer(area:position(firefly_vi)):start(1)
end
end
end
@ -262,6 +263,7 @@ local jungle_warren_floor = function(abs_cracks, vi, area, data, data_param2)
local firefly_vi = vi + ystride * math.random(1, 5)
if data[firefly_vi] == c_air then
data[firefly_vi] = c_fireflies
minetest.get_node_timer(area:position(firefly_vi)):start(1)
end
end
end

View File

@ -103,7 +103,9 @@ df_caverns.register_biome_check(function(pos, heat, humidity)
if pos.y < df_caverns.config.sunless_sea_min or pos.y >= df_caverns.config.level3_min then
return nil
end
if heat > hot_zone_boundary then
if pos.y < sea_level then
return "sunless undersea"
elseif heat > hot_zone_boundary then
return "barren" -- hot zone
elseif heat > middle_zone_boundary then
return "fungispore"

View File

@ -6,6 +6,7 @@ local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
local bones_loot_path = minetest.get_modpath("bones_loot")
local bones_node = df_dependencies.node_name_bones
local named_waypoints_path = minetest.get_modpath("named_waypoints")
local name_generator_path = minetest.get_modpath("name_generator")

View File

@ -0,0 +1,185 @@
-- firefly/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator(minetest.get_current_modname())
local bottle = df_dependencies.node_name_glass_bottle
minetest.register_node("df_dependencies:firefly", {
description = S("Firefly"),
drawtype = "plantlike",
tiles = {{
name = "fireflies_firefly_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}},
inventory_image = "fireflies_firefly.png",
wield_image = "fireflies_firefly.png",
waving = 1,
paramtype = "light",
sunlight_propagates = true,
buildable_to = true,
walkable = false,
groups = {catchable = 1},
selection_box = {
type = "fixed",
fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
},
light_source = 6,
floodable = true,
on_place = function(itemstack, placer, pointed_thing)
local player_name = placer:get_player_name()
local pos = pointed_thing.above
if not minetest.is_protected(pos, player_name) and
not minetest.is_protected(pointed_thing.under, player_name) and
minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "df_dependencies:firefly"})
minetest.get_node_timer(pos):start(1)
itemstack:take_item()
end
return itemstack
end,
on_timer = function(pos, elapsed)
if minetest.get_node_light(pos) > 11 then
minetest.set_node(pos, {name = "df_dependencies:hidden_firefly"})
end
minetest.get_node_timer(pos):start(30)
end
})
minetest.register_node("df_dependencies:hidden_firefly", {
description = S("Hidden Firefly"),
drawtype = "airlike",
inventory_image = "fireflies_firefly.png^default_invisible_node_overlay.png",
wield_image = "fireflies_firefly.png^default_invisible_node_overlay.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
groups = {not_in_creative_inventory = 1},
floodable = true,
on_place = function(itemstack, placer, pointed_thing)
local player_name = placer:get_player_name()
local pos = pointed_thing.above
if not minetest.is_protected(pos, player_name) and
not minetest.is_protected(pointed_thing.under, player_name) and
minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "df_dependencies:hidden_firefly"})
minetest.get_node_timer(pos):start(1)
itemstack:take_item()
end
return itemstack
end,
on_timer = function(pos, elapsed)
if minetest.get_node_light(pos) <= 11 then
minetest.set_node(pos, {name = "df_dependencies:firefly"})
end
minetest.get_node_timer(pos):start(30)
end
})
-- bug net
minetest.register_tool("df_dependencies:bug_net", {
description = S("Bug Net"),
inventory_image = "fireflies_bugnet.png",
on_use = function(itemstack, player, pointed_thing)
local player_name = player and player:get_player_name() or ""
if not pointed_thing or pointed_thing.type ~= "node" or
minetest.is_protected(pointed_thing.under, player_name) then
return
end
local node_name = minetest.get_node(pointed_thing.under).name
local inv = player:get_inventory()
if minetest.get_item_group(node_name, "catchable") == 1 then
minetest.set_node(pointed_thing.under, {name = "air"})
local stack = ItemStack(node_name.." 1")
local leftover = inv:add_item("main", stack)
if leftover:get_count() > 0 then
minetest.add_item(pointed_thing.under, node_name.." 1")
end
end
if not minetest.is_creative_enabled(player_name) then
itemstack:add_wear_by_uses(256)
return itemstack
end
end
})
minetest.register_craft( {
output = "df_dependencies:bug_net",
recipe = {
{df_dependencies.node_name_string, df_dependencies.node_name_string},
{df_dependencies.node_name_string, df_dependencies.node_name_string},
{"group:stick", ""}
}
})
-- firefly in a bottle
minetest.register_node("df_dependencies:firefly_bottle", {
description = S("Firefly in a Bottle"),
inventory_image = "fireflies_bottle.png",
wield_image = "fireflies_bottle.png",
tiles = {{
name = "fireflies_bottle_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}},
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
light_source = 9,
walkable = false,
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
sounds = df_dependencies.sound_glass(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
if minetest.is_protected(pos, player:get_player_name()) or
minetest.get_node(lower_pos).name ~= "air" then
return
end
local upper_pos = {x = pos.x, y = pos.y + 2, z = pos.z}
local firefly_pos
if not minetest.is_protected(upper_pos, player:get_player_name()) and
minetest.get_node(upper_pos).name == "air" then
firefly_pos = upper_pos
elseif not minetest.is_protected(lower_pos, player:get_player_name()) then
firefly_pos = lower_pos
end
if firefly_pos then
minetest.add_item(pos, bottle)
minetest.set_node(pos, {name = "air"})
minetest.set_node(firefly_pos, {name = "df_dependencies:firefly"})
minetest.get_node_timer(firefly_pos):start(1)
end
end
})
minetest.register_craft( {
output = "df_dependencies:firefly_bottle",
recipe = {
{"df_dependencies:firefly"},
{bottle}
}
})

View File

@ -0,0 +1,58 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (c) 2018 Shara RedCat
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.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2018 Shara RedCat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -31,9 +31,9 @@ df_dependencies.select_optional = function(def)
return ret
end
dofile(modpath.."/nodes.lua")
dofile(modpath.."/sounds.lua")
dofile(modpath.."/helper_functions.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/misc.lua")
dofile(modpath.."/mapgen.lua")
@ -46,7 +46,7 @@ table.sort(mods_sorted)
for _, mod in ipairs(mods_sorted) do
mods_required = mods_required .. ", " .. mod
end
minetest.debug(mods_required)
--minetest.debug(mods_required)
-- This mod is meant to only exist at initialization time. Other mods should make copies of anything it points to for their own use.
minetest.after(1, function() df_dependencies = nil end)

View File

@ -93,7 +93,6 @@ df_dependencies.node_name_bed_top = select_required("beds:bed_top", "mcl_beds:be
df_dependencies.node_name_door_wood_a = select_required("doors:door_wood_a", "mcl_doors:wooden_door_b_1")
df_dependencies.node_name_door_hidden = select_required("doors:hidden", "mcl_doors:wooden_door_t_1")
-- from "stairs"
df_dependencies.node_name_slab_goblin_cap_stem_wood = select_required("stairs:slab_goblin_cap_stem_wood", "mcl_stairs:slab_goblin_cap_stem_wood")
@ -109,4 +108,11 @@ df_dependencies.node_name_slab_slade_block_top = select_optional("mcl_stairs:sla
-- from "tnt"
-- TODO: make optional
df_dependencies.node_name_gunpowder = select_required("tnt:gunpowder", "mcl_mobitems:gunpowder")
df_dependencies.node_name_gunpowder = select_required("tnt:gunpowder", "mcl_mobitems:gunpowder")
local modpath = minetest.get_modpath(minetest.get_current_modname())
if not df_dependencies.node_name_fireflies then
dofile(modpath.."/fireflies.lua")
df_dependencies.node_name_fireflies = "df_dependencies:firefly"
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B