mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Starting Inventory fix #4 Optimized and remove chatcommand.
This commit is contained in:
parent
88493091b6
commit
d48b3dcaee
@ -13,7 +13,7 @@ end
|
|||||||
|
|
||||||
local give_inventory = minetest.settings:get("starting_inv_contents", false)
|
local give_inventory = minetest.settings:get("starting_inv_contents", false)
|
||||||
|
|
||||||
local stuff_string
|
local stuff_string = "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron,mcl_torches:torch 32,mcl_core:cobble 32"
|
||||||
|
|
||||||
mcl_starting_inventory = {
|
mcl_starting_inventory = {
|
||||||
items = {}
|
items = {}
|
||||||
@ -55,20 +55,8 @@ function mcl_starting_inventory.get_list()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if give_inventory then
|
if give_inventory then
|
||||||
stuff_string = "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron,mcl_torches:torch 32,mcl_core:cobble 32"
|
|
||||||
mcl_starting_inventory.add_from_csv(stuff_string)
|
mcl_starting_inventory.add_from_csv(stuff_string)
|
||||||
mcl_log("Okay to give inventory:\n" .. dump(mcl_starting_inventory.get_list()))
|
mcl_log("Okay to give inventory:\n" .. dump(mcl_starting_inventory.get_list()))
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_newplayer(mcl_starting_inventory.give)
|
minetest.register_on_newplayer(mcl_starting_inventory.give)
|
||||||
|
|
||||||
minetest.register_chatcommand("give_starting_inventory", {
|
|
||||||
description = "Grant yourself the starting inventory.",
|
|
||||||
func = function(name, params)
|
|
||||||
stuff_string = "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron,mcl_torches:torch 32,mcl_core:cobble 32"
|
|
||||||
mcl_log("Manually giving inventory:\n" .. dump(mcl_starting_inventory.get_list()))
|
|
||||||
mcl_starting_inventory.add_from_csv(stuff_string)
|
|
||||||
minetest.chat_send_player(name, "Granted Starting Inventory.")
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
Loading…
Reference in New Issue
Block a user