add a collectible satchel

This commit is contained in:
FaceDeer 2023-02-11 20:43:09 -07:00
parent 0ea940f104
commit fd9f2e97f2
6 changed files with 60 additions and 9 deletions

View File

@ -0,0 +1,22 @@
License for Code and Textures
----------------
Copyright (C) 2023 FaceDeer
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.

View File

@ -20,7 +20,10 @@ local set_cairn_looted_by_list = function(pos, list)
modmeta:set_string("cairn_" .. minetest.pos_to_string(pos), minetest.serialize(list))
end
local cairn_loot = function(pos, player_name)
local cairn_loot = function(pos, player)
local player_name = player:get_player_name()
if not player_name then return end
local list = get_cairn_looted_by_list(pos)
if list[player_name] then
return false
@ -31,6 +34,11 @@ local cairn_loot = function(pos, player_name)
minetest.debug("unlocked " .. lore_id)
list[player_name] = true
set_cairn_looted_by_list(pos, list)
local leftover = player:get_inventory():add_item("main", "collectible_lore:satchel")
if not leftover:is_empty() then
minetest.item_drop(leftover, player, vector.add(pos, vector.new(0,1,0)))
end
return true
end
@ -65,10 +73,7 @@ minetest.register_node("collectible_lore:cairn", {
}
},
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local player_name = clicker:get_player_name()
if player_name then
cairn_loot(pos, player_name)
end
cairn_loot(pos, clicker)
end,
is_ground_content = true,
@ -149,9 +154,9 @@ local get_formspec_for_player = function(player_name)
return table.concat(form)
end
minetest.register_craftitem("collectible_lore:ledger", {
description = S("Collectible Ledger"),
inventory_image = "collectible_lore_ledger.png",
minetest.register_craftitem("collectible_lore:satchel", {
description = S("Collectibles Satchel"),
inventory_image = "collectible_lore_satchel.png",
stack_max = 99,
on_use = function(itemstack, user, pointed_thing)
local player_name = user:get_player_name()

View File

@ -3,5 +3,6 @@
### items.lua ###
<Locked>=
Cairn=
Collectible Ledger=
Collectibles Satchel=

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

22
df_lorebooks/LICENSE.txt Normal file
View File

@ -0,0 +1,22 @@
License for Code and Textures
----------------
Copyright (C) 2023 FaceDeer
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.

View File

@ -206,6 +206,7 @@ I write to you today to express my frustration with the abundance of Spindlestem
It is perhaps a petty thing to write a missive containing nothing but a short complaint directed at this most base and useless of of fungus, but one must give vent at times. These caverns are filled with wonders and yet these tedious growths clutter them. They are hardly worth the time to write about, which gives me such annoyance that I find I must regardless.]]),
author = S("Sir Reginald Sterling"),
sort = base + 12,
})
collectible_lore.register_lorebook({