aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/give_initial_stuff
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-05-24 15:46:26 +0200
committerGitHub <noreply@github.com>2020-05-24 14:46:26 +0100
commit6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23 (patch)
treef2bada583c6f4d3032f28b2627bf052174f0a847 /games/minimal/mods/give_initial_stuff
parenta9b74f4c3966ad38c2f9a97364d3fdda0e514c93 (diff)
downloadminetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.tar.gz
minetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.tar.bz2
minetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.zip
Replacement for Minimal Development Test (PR) (#9450)
Diffstat (limited to 'games/minimal/mods/give_initial_stuff')
-rw-r--r--games/minimal/mods/give_initial_stuff/init.lua47
-rw-r--r--games/minimal/mods/give_initial_stuff/mod.conf2
2 files changed, 35 insertions, 14 deletions
diff --git a/games/minimal/mods/give_initial_stuff/init.lua b/games/minimal/mods/give_initial_stuff/init.lua
index 29b835c7d..491a531e4 100644
--- a/games/minimal/mods/give_initial_stuff/init.lua
+++ b/games/minimal/mods/give_initial_stuff/init.lua
@@ -1,16 +1,37 @@
+local give_if_not_gotten_already = function(inv, list, item)
+ if not inv:contains_item(list, item) then
+ inv:add_item(list, item)
+ end
+end
+
+local give_initial_stuff = function(player)
+ local inv = player:get_inventory()
+ give_if_not_gotten_already(inv, "main", "basetools:pick_mese")
+ give_if_not_gotten_already(inv, "main", "basetools:axe_steel")
+ give_if_not_gotten_already(inv, "main", "basetools:shovel_steel")
+ give_if_not_gotten_already(inv, "main", "bucket:bucket")
+ give_if_not_gotten_already(inv, "main", "testnodes:light14")
+ give_if_not_gotten_already(inv, "main", "chest_of_everything:chest")
+ minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name())
+end
+
minetest.register_on_newplayer(function(player)
- print("[minimal] giving initial stuff to player")
- player:get_inventory():add_item('main', 'default:pick_stone')
- player:get_inventory():add_item('main', 'default:torch 99')
- player:get_inventory():add_item('main', 'default:cobble 99')
- player:get_inventory():add_item('main', 'default:wood 99')
- player:get_inventory():add_item('main', 'default:axe_steel')
- player:get_inventory():add_item('main', 'default:shovel_steel')
- player:get_inventory():add_item('main', 'default:pick_wood')
- player:get_inventory():add_item('main', 'default:pick_steel')
- player:get_inventory():add_item('main', 'default:pick_mese')
- player:get_inventory():add_item('main', 'default:mese 99')
- player:get_inventory():add_item('main', 'default:water_source 99')
- player:get_inventory():add_item('main', 'experimental:tester_tool_1')
+ if minetest.settings:get_bool("give_initial_stuff", true) then
+ give_initial_stuff(player)
+ end
end)
+minetest.register_chatcommand("stuff", {
+ params = "",
+ privs = { give = true },
+ description = "Give yourself initial items",
+ func = function(name, param)
+ local player = minetest.get_player_by_name(name)
+ if not player or not player:is_player() then
+ return false, "No player."
+ end
+ give_initial_stuff(player)
+ return true
+ end,
+})
+
diff --git a/games/minimal/mods/give_initial_stuff/mod.conf b/games/minimal/mods/give_initial_stuff/mod.conf
index bd293f418..1ba49f52a 100644
--- a/games/minimal/mods/give_initial_stuff/mod.conf
+++ b/games/minimal/mods/give_initial_stuff/mod.conf
@@ -1,3 +1,3 @@
name = give_initial_stuff
description = Gives items to players on join
-depends = default
+depends = basetools, bucket, chest_of_everything, testnodes