mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Created Starting Chest that is given to players.
Based on the "give_initial_stuff" mod.
This commit is contained in:
parent
8feefcdd7b
commit
5424ca8c2b
5 changed files with 91 additions and 0 deletions
11
mods/PLAYER/mcl_starting_chest/README.txt
Normal file
11
mods/PLAYER/mcl_starting_chest/README.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
Adapted for Mineclone 2 by Michieal.
|
||||
|
||||
Based on:
|
||||
Minetest Game mod: give_initial_stuff
|
||||
=====================================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
49
mods/PLAYER/mcl_starting_chest/init.lua
Normal file
49
mods/PLAYER/mcl_starting_chest/init.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
--- Copyright 2023, Michieal. (Modifications for the mod to be usable in Mineclone 2.)
|
||||
--- Based on mtg mod, give_initial_stuff. "Written by C55 and various minetest developers."
|
||||
---
|
||||
--- Copyright notice created for the license to be valid. (MIT 3)
|
||||
|
||||
local stuff_string = minetest.settings:get("starter_chest_contents") or
|
||||
"mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron," ..
|
||||
"mcl_torches:torch 32,mcl_core:cobble 64"
|
||||
|
||||
mcl_starting_chest = {
|
||||
items = {}
|
||||
}
|
||||
|
||||
function mcl_starting_chest.give(player)
|
||||
minetest.log("action",
|
||||
"Giving initial stuff to player " .. player:get_player_name())
|
||||
local inv = player:get_inventory()
|
||||
for _, stack in ipairs(mcl_starting_chest.items) do
|
||||
inv:add_item("main", stack)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_starting_chest.add(stack)
|
||||
mcl_starting_chest.items[#mcl_starting_chest.items + 1] = ItemStack(stack)
|
||||
end
|
||||
|
||||
function mcl_starting_chest.clear()
|
||||
mcl_starting_chest.items = {}
|
||||
end
|
||||
|
||||
function mcl_starting_chest.add_from_csv(str)
|
||||
local items = str:split(",")
|
||||
for _, itemname in ipairs(items) do
|
||||
mcl_starting_chest.add(itemname)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_starting_chest.set_list(list)
|
||||
mcl_starting_chest.items = list
|
||||
end
|
||||
|
||||
function mcl_starting_chest.get_list()
|
||||
return mcl_starting_chest.items
|
||||
end
|
||||
|
||||
mcl_starting_chest.add_from_csv(stuff_string)
|
||||
if minetest.settings:get_bool("mcl_starting_chest") then
|
||||
minetest.register_on_newplayer(mcl_starting_chest.give)
|
||||
end
|
25
mods/PLAYER/mcl_starting_chest/license.txt
Normal file
25
mods/PLAYER/mcl_starting_chest/license.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
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
|
3
mods/PLAYER/mcl_starting_chest/mod.conf
Normal file
3
mods/PLAYER/mcl_starting_chest/mod.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
name = mcl_starting_chest
|
||||
description = Mineclone 2 mod, Starting Chest. (Gives starter chest to players.)
|
||||
depends = mcl_core, mcl_chests
|
|
@ -231,6 +231,9 @@ mcl_extended_pet_control (Extended pet control) bool true
|
|||
# Enable hamburgers for villagers to follow
|
||||
mcl_enable_hamburger (Enable Hamburger) bool true
|
||||
|
||||
# Starting chest contents (given directly to the new player) type: string
|
||||
starter_chest_contents (player starter pack) string "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron,mcl_torches:torch 32,mcl_core:cobble 64"
|
||||
|
||||
[Debugging]
|
||||
# If enabled, this will show the itemstring of an item in the description.
|
||||
mcl_item_id_debug (Item ID Debug) bool false
|
||||
|
|
Loading…
Reference in a new issue