Merge branch 'master' into add_story

master
theFox6 2019-07-20 14:43:44 +02:00
commit 32c8e86764
No known key found for this signature in database
GPG Key ID: C884FE8D3BCE128A
23 changed files with 92 additions and 406 deletions

6
.gitmodules vendored
View File

@ -10,3 +10,9 @@
[submodule "mods/journal_modpack"]
path = mods/journal_modpack
url = https://github.com/theFox6/journal.git
[submodule "mods/neverenoughitems"]
path = mods/neverenoughitems
url = https://gitlab.com/trinium-mods/neverenoughitems
[submodule "mods/trinium_api"]
path = mods/trinium_api
url = https://gitlab.com/trinium-mods/trinium-api

44
mods/cmsg/init.lua Normal file
View File

@ -0,0 +1,44 @@
cmsg = {} -- API map
cmsg.time = 10
cmsg.max_messages = 15
cmsg.color = "FFFFFF"
local keys = {} -- map
local messages = {} -- map of lists
local huds = {} -- map
local function generate_clojure(player, key)
local pn = player:get_player_name()
keys[pn] = key
minetest.after(cmsg.time, function()
if keys[pn] == key then
messages[pn] = {}
player:hud_change(huds[pn], "text", "")
end
end)
end
minetest.register_on_joinplayer(function(player)
local pn = player:get_player_name()
huds[pn] = player:hud_add{
hud_elem_type = "text",
text = "",
number = tonumber(cmsg.color, 16),
position = {x = 0.85, y = 0.475},
offset = {x = -0, y = -256},
direction = 3,
alignment = {x = 0, y = 1},
scale = {x = 800, y = 20 * cmsg.max_messages},
}
messages[pn] = {}
end)
function cmsg.push_message_player(player, message)
local pn = player:get_player_name()
table.insert(messages[pn], message)
if #messages[pn] >= cmsg.max_messages then
table.remove(messages[pn], 1)
end
generate_clojure(player, {})
player:hud_change(huds[pn], "text", table.concat(messages[pn], "\n"))
end

2
mods/crafting/depends Normal file
View File

@ -0,0 +1,2 @@
nei
betterinv

34
mods/crafting/init.lua Normal file
View File

@ -0,0 +1,34 @@
minetest.register_node("crafting:crafting_table", {
description = "WorkBench",
tiles = {
"crafting_table_top.png", "crafting_table_bottom.png", "crafting_table_side3.png",
"crafting_table_side2.png", "crafting_table_side3.png", "crafting_table_side.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
on_construct = function(pos)
minetest.get_meta(pos):set_string("formspec", [=[
size[8,7.5]
list[current_player;main;0,3.5;8,4;]
list[current_player;craft;1.5,0;3,3;]
list[current_player;craftpreview;5.5,1;1,1;]
image[4.5,1;1,1;gui_furnace_arrow_bg.png]
]=])
end,
})
local old_getter = betterinv.tabs.default.getter
function betterinv.tabs.default.getter(player, context)
return old_getter(player, context) .. [=[
list[current_player;craft;2,2;2,1;]
list[current_player;craft;2,3;2,1;3]
list[current_player;craftpreview;5,2.5;1,1;]
image[4,2.5;1,1;gui_furnace_arrow_bg.png]
]=]
end
api.recipes.add_implementor("crafting_table", "crafting:crafting_table")
api.recipes.add_implementor("furnace", "factory:ind_furnace")
api.recipes.add_implementor("furnace", "factory:electronic_furnace")

3
mods/crafting/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = crafting
description = Crafting Table for WLS
depends = nei

View File

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 288 B

View File

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

View File

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

View File

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View File

@ -1,17 +0,0 @@
Minetest Game mod: creative
===========================
See license.txt for license information.
Authors of source code
----------------------
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (MIT)
Author of media (textures)
--------------------------
paramat (CC BY-SA 3.0):
* creative_prev_icon.png
* creative_next_icon.png
* creative_search_icon.png
* creative_clear_icon.png
* creative_trash_icon.png derived from a texture by kilbith (CC BY-SA 3.0)

View File

@ -1,2 +0,0 @@
ws_core
sfinv

View File

@ -1,91 +0,0 @@
creative = {}
sfinv.override_page("sfinv:crafting", {
is_in_nav = function(self, player, context)
return not creative.is_enabled_for(player:get_player_name())
end,
})
local function update_sfinv(name)
minetest.after(0, function()
local player = minetest.get_player_by_name(name)
if player then
if sfinv.get_page(player):sub(1, 9) == "creative:" then
sfinv.set_page(player, sfinv.get_homepage_name(player))
else
sfinv.set_player_inventory_formspec(player)
end
end
end)
end
minetest.register_privilege("creative", {
description = "Allow player to use creative inventory",
give_to_singleplayer = false,
give_to_admin = false,
on_grant = update_sfinv,
on_revoke = update_sfinv,
})
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function creative.is_enabled_for(name)
return creative_mode_cache or
minetest.check_player_privs(name, {creative = true})
end
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
if creative_mode_cache then
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
-- increased such that nodes of differing levels have an insignificant
-- effect on digtime.
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x = 1, y = 1, z = 2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = caps,
cracky = caps,
snappy = caps,
choppy = caps,
oddly_breakable_by_hand = caps,
},
damage_groups = {fleshy = 10},
}
})
end
-- Unlimited node placement
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
if placer and placer:is_player() then
return creative.is_enabled_for(placer:get_player_name())
end
end)
-- Don't pick up if the item is already in the inventory
local old_handle_node_drops = minetest.handle_node_drops
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() or
not creative.is_enabled_for(digger:get_player_name()) then
return old_handle_node_drops(pos, drops, digger)
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
end
end
end
end

View File

@ -1,235 +0,0 @@
local player_inventory = {}
local inventory_cache = {}
local function init_creative_cache(items)
inventory_cache[items] = {}
local i_cache = inventory_cache[items]
for name, def in pairs(items) do
if def.groups.not_in_creative_inventory ~= 1 and
def.description and def.description ~= "" then
i_cache[name] = def
end
end
table.sort(i_cache)
return i_cache
end
function creative.init_creative_inventory(player)
local player_name = player:get_player_name()
player_inventory[player_name] = {
size = 0,
filter = "",
start_i = 0
}
minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
local name = player2 and player2:get_player_name() or ""
if not creative.is_enabled_for(name) or
to_list == "main" then
return 0
end
return count
end,
allow_put = function(inv, listname, index, stack, player2)
return 0
end,
allow_take = function(inv, listname, index, stack, player2)
local name = player2 and player2:get_player_name() or ""
if not creative.is_enabled_for(name) then
return 0
end
return -1
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
end,
on_take = function(inv, listname, index, stack, player2)
if stack and stack:get_count() > 0 then
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
end
end,
}, player_name)
return player_inventory[player_name]
end
function creative.update_creative_inventory(player_name, tab_content)
local creative_list = {}
local inv = player_inventory[player_name] or
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
local items = inventory_cache[tab_content] or init_creative_cache(tab_content)
for name, def in pairs(items) do
if def.name:find(inv.filter, 1, true) or
def.description:lower():find(inv.filter, 1, true) then
creative_list[#creative_list+1] = name
end
end
table.sort(creative_list)
player_inv:set_size("main", #creative_list)
player_inv:set_list("main", creative_list)
inv.size = #creative_list
end
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
return stack:get_count()
end,
on_put = function(inv, listname)
inv:set_list(listname, {})
end,
})
trash:set_size("main", 1)
creative.formspec_add = ""
function creative.register_tab(name, title, items)
sfinv.register_page("creative:" .. name, {
title = title,
is_in_nav = function(self, player, context)
return creative.is_enabled_for(player:get_player_name())
end,
get = function(self, player, context)
local player_name = player:get_player_name()
creative.update_creative_inventory(player_name, items)
local inv = player_inventory[player_name]
local start_i = inv.start_i or 0
local pagenum = math.floor(start_i / (6*4) + 1)
local pagemax = math.ceil(inv.size / (6*4))
return sfinv.make_formspec(player, context,
"label[1.6,7.05;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
[[
image[4.85,1.6;0.8,0.8;creative_trash_icon.png]
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
list[current_player;main;4.8,6.9;8,1;]
list[current_player;main;4.8,3.6;8,3;8]
list[detached:creative_trash;main;4.8,1.5;1,1;]
listring[]
list[current_player;craft;6,1;2,1;0]
list[current_player;craft;6,2;2,1;3]
list[current_player;craftpreview;11,1.5;1,1;]
image[9,1.3;1.5,1.5;gui_furnace_arrow_bg.png]
image_button[0.2,7;1,0.8;creative_prev_icon.png;creative_prev;]
image_button[2.8,7;1,0.8;creative_next_icon.png;creative_next;]
image_button[2.4,6;0.8,0.8;creative_search_icon.png;creative_search;]
image_button[3.05,6;0.8,0.8;creative_clear_icon.png;creative_clear;]
background[-.34,-.3;13.66,8.84;gui_formbg.png]
tooltip[creative_search;Search]
tooltip[creative_clear;Reset]
tooltip[creative_prev;Previous page]
tooltip[creative_next;Next page]
listring[current_player;main]
field_close_on_enter[creative_filter;false]
]] ..
"field[0.4,6.23;2.4,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
"listring[detached:creative_" .. player_name .. ";main]" ..
"list[detached:creative_" .. player_name .. ";main;0,0;4,6;" .. tostring(start_i) .. "]" ..
ws_core.get_hotbar_bg(4.8,6.9) .. creative.formspec_add, false)
end,
on_enter = function(self, player, context)
local player_name = player:get_player_name()
local inv = player_inventory[player_name]
if inv then
inv.start_i = 0
end
end,
on_player_receive_fields = function(self, player, context, fields)
local player_name = player:get_player_name()
local inv = player_inventory[player_name]
assert(inv)
if fields.creative_clear then
inv.start_i = 0
inv.filter = ""
creative.update_creative_inventory(player_name, items)
sfinv.set_player_inventory_formspec(player, context)
elseif fields.creative_search or
fields.key_enter_field == "creative_filter" then
inv.start_i = 0
inv.filter = fields.creative_filter:lower()
creative.update_creative_inventory(player_name, items)
sfinv.set_player_inventory_formspec(player, context)
elseif not fields.quit then
local start_i = inv.start_i or 0
if fields.creative_prev then
start_i = start_i - 3*8
if start_i < 0 then
start_i = inv.size - (inv.size % (3*8))
if inv.size == start_i then
start_i = math.max(0, inv.size - (3*8))
end
end
elseif fields.creative_next then
start_i = start_i + 3*8
if start_i >= inv.size then
start_i = 0
end
end
inv.start_i = start_i
sfinv.set_player_inventory_formspec(player, context)
end
end
})
end
creative.register_tab("all", "All", minetest.registered_items)
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
creative.register_tab("tools", "Tools", minetest.registered_tools)
creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
local old_homepage_name = sfinv.get_homepage_name
function sfinv.get_homepage_name(player)
if creative.is_enabled_for(player:get_player_name()) then
return "creative:all"
else
return old_homepage_name(player)
end
end
minetest.register_node("creative:crafting_table", {
description = "WorkBench",
tiles = {
"crafting_table_top.png",
"crafting_table_bottom.png",
"crafting_table_side3.png",
"crafting_table_side2.png",
"crafting_table_side3.png",
"crafting_table_side.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
inv:set_size('main', 8*4)
inv:set_size('storage', 8*1)
meta:set_string('formspec',
'size[8,7.5;]'..
'list[current_player;main;0,3.5;8,4;]'..
'list[current_player;craft;3,0;3,3;]'..
'list[current_player;craftpreview;7,1;1,1;]')
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty('storage') and inv:is_empty('storage1')
end,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
}
})

View File

@ -1,61 +0,0 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
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
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
Copyright (C) 2018 paramat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

1
mods/neverenoughitems Submodule

@ -0,0 +1 @@
Subproject commit 7f83b0081d34435b4494e52bc555fa0c98cec517

1
mods/trinium_api Submodule

@ -0,0 +1 @@
Subproject commit a3c5a23701b77e2bea37a96098811ffa2fa94b7b

View File

@ -1 +1,2 @@
player_api?
nei