From fd9f2e97f2a3577853415df822922029f732463a Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sat, 11 Feb 2023 20:43:09 -0700 Subject: [PATCH] add a collectible satchel --- collectible_lore/LICENSE.txt | 22 ++++++++++++++++++ collectible_lore/items.lua | 21 ++++++++++------- collectible_lore/locale/template.txt | 3 ++- .../textures/collectible_lore_satchel.png | Bin 0 -> 698 bytes df_lorebooks/LICENSE.txt | 22 ++++++++++++++++++ df_lorebooks/ecology_trees.lua | 1 + 6 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 collectible_lore/LICENSE.txt create mode 100644 collectible_lore/textures/collectible_lore_satchel.png create mode 100644 df_lorebooks/LICENSE.txt diff --git a/collectible_lore/LICENSE.txt b/collectible_lore/LICENSE.txt new file mode 100644 index 0000000..ac77c00 --- /dev/null +++ b/collectible_lore/LICENSE.txt @@ -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. \ No newline at end of file diff --git a/collectible_lore/items.lua b/collectible_lore/items.lua index 9fceaf2..fec2ed8 100644 --- a/collectible_lore/items.lua +++ b/collectible_lore/items.lua @@ -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() diff --git a/collectible_lore/locale/template.txt b/collectible_lore/locale/template.txt index 27a96ea..530f7a0 100644 --- a/collectible_lore/locale/template.txt +++ b/collectible_lore/locale/template.txt @@ -3,5 +3,6 @@ ### items.lua ### += Cairn= -Collectible Ledger= +Collectibles Satchel= diff --git a/collectible_lore/textures/collectible_lore_satchel.png b/collectible_lore/textures/collectible_lore_satchel.png new file mode 100644 index 0000000000000000000000000000000000000000..7f0606702e9def986ae1778352b7c2a13ff9fbe1 GIT binary patch literal 698 zcmV;r0!96aP)bw#90HM?9d$z?X%hg+skH_U80vQaSJo^#8SZpV&o+LdM2vzFMk zmfE+M+qan6wU^knm)NwHwOTyXv6R4MKh?34)US}ytd7sCji82gqltK@i+Hk-d#aCo zr;U5Hlzgp>ccO@QqK0&;hjN~RaFcmzkalK%WLK|KGKpqYjb%`eX;p-2TbOE5ieXNU zXjF<~OM+idcV1C(SWIkGN!GKKeOXDOX-RxoNR3`bjaox^R!5#_N_SF2X;4LBNk3Rd zIZ`w#UPC%*N<5`%OIScQRzEk2TtKPVzfFCbh)I9@Ow zaz86@K`VPfEJGt1R4yWPKPzQ3AVee_T{I)pu#-n68CotLRwfuzIx}uNCw@gPicc|q zM=eq)8eTIbd_*T~IU!Cd9&|e;bU`UqDjH=qA$312aW)`>Nic;-El(vGW;P{pHzQal z8B{7BX)_^TFCkYd9B@7;f<7gVRz#~@Jf2oMeLyRcT}i%#YOZx$eM&l@Xj7?eRdhNj zYAqd&K`NV7J~h^ZApigX0d!JMQvg8b*k%9#0J}*ZS5VM gUEMvseGC`?0MvLVv6il+`v3p{07*qoM6N<$f=Q(a5dZ)H literal 0 HcmV?d00001 diff --git a/df_lorebooks/LICENSE.txt b/df_lorebooks/LICENSE.txt new file mode 100644 index 0000000..ac77c00 --- /dev/null +++ b/df_lorebooks/LICENSE.txt @@ -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. \ No newline at end of file diff --git a/df_lorebooks/ecology_trees.lua b/df_lorebooks/ecology_trees.lua index bde44c3..0b0212f 100644 --- a/df_lorebooks/ecology_trees.lua +++ b/df_lorebooks/ecology_trees.lua @@ -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({