mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-20 01:43:45 +01:00
Move global core variables to mcl_init
This commit is contained in:
parent
f652d5ecb5
commit
91950ee026
@ -1,2 +1,3 @@
|
||||
mcl_init
|
||||
mcl_sounds
|
||||
mcl_util
|
||||
|
@ -1,24 +1,8 @@
|
||||
-- Minetest 0.4 mod: default
|
||||
-- See README.txt for licensing and other information.
|
||||
-- The API documentation in here was moved into doc/lua_api.txt
|
||||
|
||||
-- Definitions made by this mod that other mods can use too
|
||||
mcl_core = {}
|
||||
mcl_core.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
|
||||
mcl_core.gui_bg = "bgcolor[#080808BB;true]"
|
||||
mcl_core.gui_bg_img = ""
|
||||
|
||||
mcl_core.inventory_header = mcl_core.gui_slots .. mcl_core.gui_bg
|
||||
|
||||
-- Repair percentage for toolrepair
|
||||
mcl_core.repair = 0.05
|
||||
|
||||
minetest.nodedef_default.stack_max = 64
|
||||
minetest.craftitemdef_default.stack_max = 64
|
||||
|
||||
-- Set random seed for all other mods (Remember to make sure no other mod calls this function)
|
||||
math.randomseed(os.time())
|
||||
|
||||
-- Load files
|
||||
dofile(minetest.get_modpath("mcl_core").."/functions.lua")
|
||||
dofile(minetest.get_modpath("mcl_core").."/nodes.lua")
|
||||
|
1
mods/CORE/mcl_init/description.txt
Normal file
1
mods/CORE/mcl_init/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Initialization mod of MineClone 2. Defines some common shared variables and sets up initial default settings which have to be set at the beginning.
|
18
mods/CORE/mcl_init/init.lua
Normal file
18
mods/CORE/mcl_init/init.lua
Normal file
@ -0,0 +1,18 @@
|
||||
-- Some global variables (don't overwrite them!)
|
||||
mcl_vars = {}
|
||||
|
||||
--- GUI / inventory menu colors
|
||||
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
|
||||
mcl_vars.gui_bg = "bgcolor[#080808BB;true]"
|
||||
mcl_vars.gui_bg_img = ""
|
||||
|
||||
mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg
|
||||
|
||||
-- Set default stack sizes
|
||||
minetest.nodedef_default.stack_max = 64
|
||||
minetest.craftitemdef_default.stack_max = 64
|
||||
|
||||
-- Set random seed for all other mods (Remember to make sure no other mod calls this function)
|
||||
math.randomseed(os.time())
|
||||
|
||||
|
1
mods/CORE/mcl_init/mod.conf
Normal file
1
mods/CORE/mcl_init/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = mcl_init
|
@ -3039,8 +3039,8 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||
local tag = self.nametag or ""
|
||||
|
||||
minetest.show_formspec(name, "mobs_nametag", "size[8,4]"
|
||||
.. default.gui_bg
|
||||
.. default.gui_bg_img
|
||||
.. mcl_vars.gui_bg
|
||||
.. mcl_vars.gui_bg_img
|
||||
.. "field[0.5,1;7.5,0;name;" .. S("Enter name:") .. ";" .. tag .. "]"
|
||||
.. "button_exit[2.5,3.5;3,1;mob_rename;" .. S("Rename") .. "]")
|
||||
|
||||
|
@ -232,7 +232,7 @@ crafting.set_creative_formspec = function(player, start_i, pagenum, show, page,
|
||||
"image[" .. boffset[check] .. ";1,1;crafting_creative_marker.png]"
|
||||
end
|
||||
formspec = "size[10,9.3]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
|
||||
"label[-5,-5;"..name.."]"..
|
||||
"item_image_button[-0.1,0;1,1;mcl_core:brick_block;blocks;]".. --build blocks
|
||||
|
@ -1,2 +1,3 @@
|
||||
mcl_init
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
|
@ -66,7 +66,7 @@ local function set_inventory(player)
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
img_element..
|
||||
--armor
|
||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;1]"..
|
||||
@ -98,7 +98,7 @@ local function set_workbench(player)
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
|
@ -251,8 +251,8 @@ function craftguide:get_formspec(player_name, is_fuel)
|
||||
data.pagemax = max(1, ceil(#data.items / ipp))
|
||||
|
||||
local formspec = "size["..data.iX..","..(iY+3)..".6;]"..
|
||||
mcl_core.gui_slots ..
|
||||
mcl_core.gui_bg ..
|
||||
mcl_vars.gui_slots ..
|
||||
mcl_vars.gui_bg ..
|
||||
[[background[1,1;1,1;craftguide_bg.png;true]
|
||||
button[2.4,0.21;0.8,0.5;search;?]
|
||||
button[3.05,0.21;0.8,0.5;clear;X]
|
||||
|
@ -1,3 +1,4 @@
|
||||
mcl_init
|
||||
mesecons
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
|
@ -13,7 +13,7 @@ local setup_dispenser = function(pos)
|
||||
-- Set formspec and inventory
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"image[3,-0.2;5,0.75;mcl_dispensers_fnt_dispenser.png]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
@ -1,2 +1,3 @@
|
||||
mcl_init
|
||||
mesecons
|
||||
mcl_util
|
||||
|
@ -13,7 +13,7 @@ local setup_dropper = function(pos)
|
||||
-- Set formspec and inventory
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"image[3,-0.2;5,0.75;mcl_droppers_fnt_dropper.png]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
@ -1,3 +1,4 @@
|
||||
mcl_init
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_end
|
||||
|
@ -40,7 +40,7 @@ minetest.register_node("mcl_chests:chest", {
|
||||
meta:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,0.5;9,3;]"..
|
||||
"list[current_name;main;0,3.5;9,3;]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
@ -54,7 +54,7 @@ minetest.register_node("mcl_chests:chest", {
|
||||
m:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
@ -69,7 +69,7 @@ minetest.register_node("mcl_chests:chest", {
|
||||
meta:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,3.5;9,3;]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
@ -83,7 +83,7 @@ minetest.register_node("mcl_chests:chest", {
|
||||
m:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
||||
"list[current_name;main;0,3.5;9,3;]"..
|
||||
"list[current_player;main;0,7.5;9,3;9]"..
|
||||
@ -95,7 +95,7 @@ minetest.register_node("mcl_chests:chest", {
|
||||
else
|
||||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"image[0,-0.2;5,0.75;fnt_chest.png]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
@ -158,7 +158,7 @@ minetest.register_node("mcl_chests:chest_left", {
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"image[0,-0.2;5,0.75;fnt_chest.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
@ -1,3 +1,4 @@
|
||||
mcl_init
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_craftguide
|
||||
|
@ -1,7 +1,7 @@
|
||||
local furnace_inactive_formspec =
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
@ -208,7 +208,7 @@ minetest.register_abm({
|
||||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
|
@ -5,7 +5,7 @@ local chest = minetest.get_content_id("mcl_chests:chest")
|
||||
local mcl_hoppers_formspec =
|
||||
"size[9,7]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;mcl_hoppers_inventory.png]"..
|
||||
mcl_core.inventory_header..
|
||||
mcl_vars.inventory_header..
|
||||
"list[current_name;main;2,0.5;5,1;]"..
|
||||
"list[current_player;main;0,2.5;9,3;9]"..
|
||||
"list[current_player;main;0,5.74;9,1;]"..
|
||||
|
Loading…
Reference in New Issue
Block a user