From 5dba3b99ec256440cfb552dbd3b5f275a1365462 Mon Sep 17 00:00:00 2001 From: Duane Date: Fri, 22 Jul 2016 01:58:19 -0500 Subject: [PATCH] Add starting equipment. --- init.lua | 16 +++++++++++++++- settingtypes.txt | 3 +++ treegen.lua | 3 +-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 369c846..c53f2d1 100644 --- a/init.lua +++ b/init.lua @@ -32,6 +32,11 @@ if fun_caves.use_villages == nil then fun_caves.use_villages = true end +fun_caves.starting_equipment = minetest.setting_getbool('fun_caves_starting_equipment') +if fun_caves.starting_equipment == nil then + fun_caves.starting_equipment = false +end + fun_caves.DEBUG = false -- for maintenance only @@ -379,6 +384,16 @@ if not armor_mod then end +if fun_caves.starting_equipment then + minetest.register_on_newplayer(function(player) + local inv = player:get_inventory() + inv:add_item("main", 'default:sword_wood') + inv:add_item("main", 'default:axe_wood') + inv:add_item("main", 'default:pick_wood') + end) +end + + minetest.register_on_joinplayer(function(player) if not (player and fun_caves.db.status) then return @@ -433,4 +448,3 @@ if fun_caves.db.status then end end ---------------------------------------------------------------------- - diff --git a/settingtypes.txt b/settingtypes.txt index 18dee7f..7b3bf87 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -12,3 +12,6 @@ fun_caves_breakable_wood (Breakable Wood) bool false # Unset this to remove primitive villages. fun_caves_use_villages (Villages) bool true + +# Set to give wooden tools to starting players. +fun_caves_starting_equipment (Starting Equipment) bool false diff --git a/treegen.lua b/treegen.lua index b5b5896..db0afa0 100644 --- a/treegen.lua +++ b/treegen.lua @@ -12,14 +12,13 @@ minetest.register_node("fun_caves:bark", newnode) newnode = fun_caves.clone_node("default:tree") newnode.description = "Giant Wood" newnode.tiles = {"fun_caves_tree.png"} +newnode.groups.flammable = 1 newnode.is_ground_content = false minetest.register_node("fun_caves:tree", newnode) newnode = fun_caves.clone_node("fun_caves:tree") newnode.description = "Giant Wood With Mineral" newnode.tiles = {"fun_caves_tree.png^fun_caves_mineral_aquamarine.png"} --- This drop list is more complicated than it ought to be. --- The lua documentation is inaccurate. newnode.drop = { max_items = 1, items = {