2020-02-08 18:34:26 +09:00
|
|
|
--
|
|
|
|
-- =====================================================================================
|
|
|
|
--
|
|
|
|
-- OpenMiner
|
2020-02-25 01:42:10 +09:00
|
|
|
--
|
2020-02-08 18:34:26 +09:00
|
|
|
-- Copyright (C) 2018-2020 Unarelith, Quentin Bazin <openminer@unarelith.net>
|
2020-02-25 01:42:10 +09:00
|
|
|
-- Copyright (C) 2019-2020 the OpenMiner contributors (see CONTRIBUTORS.md)
|
|
|
|
--
|
|
|
|
-- This file is part of OpenMiner.
|
2020-02-08 18:34:26 +09:00
|
|
|
--
|
2020-02-25 01:42:10 +09:00
|
|
|
-- OpenMiner is free software; you can redistribute it and/or
|
2020-02-08 18:34:26 +09:00
|
|
|
-- modify it under the terms of the GNU Lesser General Public
|
|
|
|
-- License as published by the Free Software Foundation; either
|
|
|
|
-- version 2.1 of the License, or (at your option) any later version.
|
|
|
|
--
|
2020-02-25 01:42:10 +09:00
|
|
|
-- OpenMiner is distributed in the hope that it will be useful,
|
2020-02-08 18:34:26 +09:00
|
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
-- Lesser General Public License for more details.
|
|
|
|
--
|
|
|
|
-- You should have received a copy of the GNU Lesser General Public License
|
2020-02-25 01:42:10 +09:00
|
|
|
-- along with OpenMiner; if not, write to the Free Software Foundation, Inc.,
|
2020-02-08 18:34:26 +09:00
|
|
|
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
--
|
|
|
|
-- =====================================================================================
|
|
|
|
--
|
2019-01-04 18:05:35 +01:00
|
|
|
mod = LuaMod.new("default")
|
|
|
|
|
2020-01-30 21:53:28 +09:00
|
|
|
dofile("mods/default/blocks.lua")
|
|
|
|
dofile("mods/default/items.lua")
|
|
|
|
dofile("mods/default/recipes.lua")
|
2020-03-09 19:36:46 +01:00
|
|
|
dofile("mods/default/sky.lua")
|
2020-03-05 23:02:08 -05:00
|
|
|
dofile("mods/default/trees.lua")
|
2020-03-01 18:13:39 -05:00
|
|
|
dofile("mods/default/biomes.lua")
|
2020-03-08 13:47:11 +01:00
|
|
|
dofile("mods/default/dimensions.lua")
|
2018-12-20 02:51:30 +01:00
|
|
|
|
2020-03-10 14:02:20 +01:00
|
|
|
-- openminer:add_listener(EventType.OnBlockPlaced, function(pos, player, world, client, server)
|
|
|
|
-- server:send_chat_message(0, "Block placed at " .. pos.x .. ";" .. pos.y .. ";" .. pos.z .. " by Client" .. player:client_id(), client);
|
|
|
|
-- end)
|
|
|
|
|
2020-03-10 14:25:38 +01:00
|
|
|
openminer:add_listener(EventType.OnBlockActivated, function(pos, block, player, world, client, server)
|
|
|
|
if block:string_id() == "default:portal" then
|
|
|
|
server:send_chat_message(0, "Swoosh! Changing dimension...", client);
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2019-04-07 18:20:15 +02:00
|
|
|
function init(player)
|
|
|
|
local player_inv = player:inventory()
|
2018-12-28 21:23:26 +01:00
|
|
|
|
2020-03-09 10:38:30 +01:00
|
|
|
player_inv:add_stack("default:workbench", 1);
|
2019-01-07 04:56:42 +01:00
|
|
|
player_inv:add_stack("default:dirt", 64);
|
|
|
|
player_inv:add_stack("default:grass", 64);
|
|
|
|
player_inv:add_stack("default:stone", 64);
|
|
|
|
player_inv:add_stack("default:glass", 64);
|
|
|
|
player_inv:add_stack("default:glowstone", 64);
|
|
|
|
player_inv:add_stack("default:furnace", 1);
|
2020-01-30 15:31:49 +09:00
|
|
|
player_inv:add_stack("default:stone_pickaxe", 1);
|
2020-03-09 10:38:30 +01:00
|
|
|
player_inv:add_stack("default:stone_axe", 1);
|
2019-01-07 04:56:42 +01:00
|
|
|
|
2020-03-04 21:01:11 +01:00
|
|
|
player_inv:add_stack("default:oak_wood", 64);
|
|
|
|
player_inv:add_stack("default:oak_planks", 64);
|
2019-01-07 04:56:42 +01:00
|
|
|
player_inv:add_stack("default:cobblestone", 64);
|
|
|
|
player_inv:add_stack("default:stick", 64);
|
2020-01-30 15:31:49 +09:00
|
|
|
player_inv:add_stack("default:stone_hoe", 1);
|
|
|
|
player_inv:add_stack("default:stone_shovel", 1);
|
|
|
|
player_inv:add_stack("default:iron_ore", 64);
|
2019-01-07 04:56:42 +01:00
|
|
|
player_inv:add_stack("default:coal", 64);
|
2020-02-29 03:27:04 +01:00
|
|
|
|
|
|
|
player_inv:add_stack("default:iron_ingot", 64);
|
|
|
|
player_inv:add_stack("default:gold_ingot", 64);
|
|
|
|
player_inv:add_stack("default:diamond", 64);
|
2018-12-20 02:51:30 +01:00
|
|
|
end
|
|
|
|
|
2020-02-15 14:42:29 +09:00
|
|
|
function show_inventory(client, screen_width, screen_height, gui_scale)
|
2020-02-08 02:48:39 +09:00
|
|
|
local gui = LuaGUI.new()
|
|
|
|
|
2020-03-07 15:41:19 +01:00
|
|
|
gui:set_size(176, 166)
|
|
|
|
gui:set_centered(true)
|
2020-02-08 02:48:39 +09:00
|
|
|
|
2020-02-22 22:49:48 +09:00
|
|
|
gui:image {
|
|
|
|
name = "img_background",
|
2020-03-07 15:41:19 +01:00
|
|
|
pos = {x = 0, y = 0},
|
2020-02-22 22:49:48 +09:00
|
|
|
|
2020-03-10 13:15:23 +01:00
|
|
|
texture = "mods/default/textures/gui/inventory.png",
|
2020-02-22 22:49:48 +09:00
|
|
|
clip = {x = 0, y = 0, width = 176, height = 166},
|
|
|
|
}
|
|
|
|
|
|
|
|
gui:inventory {
|
|
|
|
name = "inv_main",
|
2020-03-07 15:41:19 +01:00
|
|
|
pos = {x = 7, y = 83},
|
2020-02-22 22:49:48 +09:00
|
|
|
|
2020-03-13 10:10:22 +01:00
|
|
|
inventory = {
|
|
|
|
source = "player",
|
|
|
|
player = "player",
|
|
|
|
inventory_name = "main",
|
|
|
|
offset = 9,
|
|
|
|
count = 9 * 3,
|
|
|
|
},
|
|
|
|
|
2020-02-22 22:49:48 +09:00
|
|
|
size = {x = 9, y = 3},
|
2020-03-01 12:28:26 +01:00
|
|
|
|
2020-03-01 15:45:09 +01:00
|
|
|
shift_destination = "inv_hotbar,inv_main",
|
2020-02-22 22:49:48 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
gui:inventory {
|
|
|
|
name = "inv_hotbar",
|
2020-03-07 15:41:19 +01:00
|
|
|
pos = {x = 7, y = 141},
|
2020-02-22 22:49:48 +09:00
|
|
|
|
2020-03-13 10:10:22 +01:00
|
|
|
inventory = {
|
|
|
|
source = "player",
|
|
|
|
player = "player",
|
|
|
|
inventory_name = "main",
|
|
|
|
offset = 0,
|
|
|
|
count = 9,
|
|
|
|
},
|
|
|
|
|
2020-02-22 22:49:48 +09:00
|
|
|
size = {x = 9, y = 1},
|
2020-03-01 12:28:26 +01:00
|
|
|
|
2020-03-01 15:45:09 +01:00
|
|
|
shift_destination = "inv_main,inv_hotbar",
|
2020-02-22 22:49:48 +09:00
|
|
|
}
|
|
|
|
|
2020-02-23 18:24:19 +09:00
|
|
|
gui:crafting {
|
2020-02-22 22:49:48 +09:00
|
|
|
name = "inv_crafting",
|
2020-03-07 15:41:19 +01:00
|
|
|
pos = {x = 97, y = 17},
|
|
|
|
result_pos = {x = 97 + 56, y = 17 + 10},
|
2020-02-23 18:24:19 +09:00
|
|
|
|
2020-03-13 09:34:12 +01:00
|
|
|
inventory = {
|
|
|
|
source = "temp",
|
|
|
|
size = 2,
|
|
|
|
},
|
2020-03-01 00:15:49 +01:00
|
|
|
|
2020-03-01 12:55:20 +01:00
|
|
|
shift_destination = "inv_main,inv_hotbar",
|
2020-02-08 02:48:39 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
gui:show(client)
|
|
|
|
end
|
2020-02-29 18:07:01 +01:00
|
|
|
|
2020-04-03 00:26:31 +02:00
|
|
|
openminer.mod_loader:register_mod(mod)
|
|
|
|
|