Add files via upload
26
CONTRIBUTING
Normal file
@ -0,0 +1,26 @@
|
||||
========================================================================
|
||||
|
||||
To contribute to this project, you must understand and agree to the
|
||||
terms in this document at the time of contribution.
|
||||
|
||||
- A "contribution" consists of all files, patches and changes, source
|
||||
control commits, comments and other metadata submitted to the project
|
||||
maintainer(s) for inclusion or other use in the project.
|
||||
|
||||
- All contributions must consist only of your own original work, to
|
||||
which you retain copyright, or to which copyright is not applicable.
|
||||
|
||||
- All copyrightable portions must be non-exclusively, perpetually and
|
||||
irrevocably licensed under the same license terms as the overall
|
||||
project.
|
||||
|
||||
- You will receive attribution in the project's license, in the form of
|
||||
"Portions (C) ...", which shall cover all portions of all
|
||||
contributions. You agree that this constitutes adequate attribution
|
||||
under the terms of the license.
|
||||
|
||||
- You may request to be attributed pseudonymously at the time of
|
||||
submission. Unless otherwise specified, source control metadata
|
||||
will be used for attribution.
|
||||
|
||||
------------------------------------------------------------------------
|
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (C)2018 Aaron Suen <warr1024@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.
|
32
README
Normal file
@ -0,0 +1,32 @@
|
||||
========================================================================
|
||||
CORE DESIGN PRINCIPLES
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Do as much in node-space in the world as possible.
|
||||
- Minimize use of off-grid entities.
|
||||
- Avoid encapsulating things in inventories, machines, GUIs.
|
||||
- Crafting and transforming in-world.
|
||||
- Minimal set of primitive composable functions.
|
||||
- Each node should do one job (or one part of a job).
|
||||
- Only include the most primitive, fungible components.
|
||||
- Avoid redundant functionality, include fewest possible
|
||||
different elements.
|
||||
- Complex emergent gameplay by combining simple nodes.
|
||||
- Challenging and constrained gameplay.
|
||||
- Limited inventories, very restricted item storage, e.g. one
|
||||
stack per node.
|
||||
- Large, complex machines to design and build for resource
|
||||
transformations.
|
||||
- Subtle environmental hazards, like deadfalls and pestilence.
|
||||
- Rich, subtle interactions.
|
||||
- Digging, placing, punching and battering.
|
||||
- Different effects from different tools (including empty hand).
|
||||
- Different faces of node may have different effects.
|
||||
- Focus on puzzle-oriented single-player/cooperative gameplay.
|
||||
- Avoid dependence on action, combat, PvP.
|
||||
- Slow-moving hazards, players have a chance to think and plan.
|
||||
- Acessible for slow reflexes, slow networks, mobile devices.
|
||||
|
||||
|
||||
........................................................................
|
||||
========================================================================
|
@ -1,2 +1,2 @@
|
||||
# WasteLands_Survival
|
||||
An apocalyptic based game for MT.
|
||||
# WasteLand-Survival
|
||||
An Apocalyptic style game
|
||||
|
BIN
menu/header.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
17
mods/creative/README.txt
Normal file
@ -0,0 +1,17 @@
|
||||
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)
|
2
mods/creative/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
ws_core
|
||||
sfinv
|
91
mods/creative/init.lua
Normal file
@ -0,0 +1,91 @@
|
||||
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
|
234
mods/creative/inventory.lua
Normal file
@ -0,0 +1,234 @@
|
||||
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.5,0.8;2,2;]
|
||||
list[current_player;craftpreview;11,1.5;1,1;]
|
||||
image[9,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
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},
|
||||
}
|
||||
}
|
||||
})
|
61
mods/creative/license.txt
Normal file
@ -0,0 +1,61 @@
|
||||
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/
|
BIN
mods/creative/textures/crafting_table_bottom.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
mods/creative/textures/crafting_table_side.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
mods/creative/textures/crafting_table_side2.png
Normal file
After Width: | Height: | Size: 516 B |
BIN
mods/creative/textures/crafting_table_side3.png
Normal file
After Width: | Height: | Size: 292 B |
BIN
mods/creative/textures/crafting_table_top.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
mods/creative/textures/creative_clear_icon.png
Normal file
After Width: | Height: | Size: 708 B |
BIN
mods/creative/textures/creative_next_icon.png
Normal file
After Width: | Height: | Size: 727 B |
BIN
mods/creative/textures/creative_prev_icon.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
mods/creative/textures/creative_search_icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
mods/creative/textures/creative_trash_icon.png
Normal file
After Width: | Height: | Size: 712 B |
13
mods/sfinv/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Minetest Game mod: sfinv
|
||||
========================
|
||||
See license.txt for license information.
|
||||
|
||||
Simple Fast Inventory.
|
||||
A cleaner, simpler, solution to having an advanced inventory in Minetest.
|
||||
See game_api.txt for this mod's API.
|
||||
Available for use outside of MTG here:
|
||||
https://forum.minetest.net/viewtopic.php?t=19765
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
rubenwardy (MIT)
|
183
mods/sfinv/api.lua
Normal file
@ -0,0 +1,183 @@
|
||||
sfinv = {
|
||||
pages = {},
|
||||
pages_unordered = {},
|
||||
contexts = {},
|
||||
enabled = true
|
||||
}
|
||||
|
||||
function sfinv.register_page(name, def)
|
||||
assert(name, "Invalid sfinv page. Requires a name")
|
||||
assert(def, "Invalid sfinv page. Requires a def[inition] table")
|
||||
assert(def.get, "Invalid sfinv page. Def requires a get function.")
|
||||
assert(not sfinv.pages[name], "Attempt to register already registered sfinv page " .. dump(name))
|
||||
|
||||
sfinv.pages[name] = def
|
||||
def.name = name
|
||||
table.insert(sfinv.pages_unordered, def)
|
||||
end
|
||||
|
||||
function sfinv.override_page(name, def)
|
||||
assert(name, "Invalid sfinv page override. Requires a name")
|
||||
assert(def, "Invalid sfinv page override. Requires a def[inition] table")
|
||||
local page = sfinv.pages[name]
|
||||
assert(page, "Attempt to override sfinv page " .. dump(name) .. " which does not exist.")
|
||||
for key, value in pairs(def) do
|
||||
page[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||
-- Only show tabs if there is more than one page
|
||||
if #nav > 1 then
|
||||
return "tabheader[0,0;sfinv_nav_tabs;" .. table.concat(nav, ",") ..
|
||||
";" .. current_idx .. ";true;false]"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local theme_inv = [[
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
]]
|
||||
|
||||
function sfinv.make_formspec(player, context, content, show_inv, size)
|
||||
local tmp = {
|
||||
size or "size[13,8]",
|
||||
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
|
||||
content
|
||||
}
|
||||
if show_inv then
|
||||
tmp[#tmp + 1] = theme_inv
|
||||
end
|
||||
return table.concat(tmp, "")
|
||||
end
|
||||
|
||||
function sfinv.get_homepage_name(player)
|
||||
return "sfinv:crafting"
|
||||
end
|
||||
|
||||
function sfinv.get_formspec(player, context)
|
||||
-- Generate navigation tabs
|
||||
local nav = {}
|
||||
local nav_ids = {}
|
||||
local current_idx = 1
|
||||
for i, pdef in pairs(sfinv.pages_unordered) do
|
||||
if not pdef.is_in_nav or pdef:is_in_nav(player, context) then
|
||||
nav[#nav + 1] = pdef.title
|
||||
nav_ids[#nav_ids + 1] = pdef.name
|
||||
if pdef.name == context.page then
|
||||
current_idx = #nav_ids
|
||||
end
|
||||
end
|
||||
end
|
||||
context.nav = nav_ids
|
||||
context.nav_titles = nav
|
||||
context.nav_idx = current_idx
|
||||
|
||||
-- Generate formspec
|
||||
local page = sfinv.pages[context.page] or sfinv.pages["404"]
|
||||
if page then
|
||||
return page:get(player, context)
|
||||
else
|
||||
local old_page = context.page
|
||||
local home_page = sfinv.get_homepage_name(player)
|
||||
|
||||
if old_page == home_page then
|
||||
minetest.log("error", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||
", which is also the old page")
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
context.page = home_page
|
||||
assert(sfinv.pages[context.page], "[sfinv] Invalid homepage")
|
||||
minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||
" so switching to homepage")
|
||||
|
||||
return sfinv.get_formspec(player, context)
|
||||
end
|
||||
end
|
||||
|
||||
function sfinv.get_or_create_context(player)
|
||||
local name = player:get_player_name()
|
||||
local context = sfinv.contexts[name]
|
||||
if not context then
|
||||
context = {
|
||||
page = sfinv.get_homepage_name(player)
|
||||
}
|
||||
sfinv.contexts[name] = context
|
||||
end
|
||||
return context
|
||||
end
|
||||
|
||||
function sfinv.set_context(player, context)
|
||||
sfinv.contexts[player:get_player_name()] = context
|
||||
end
|
||||
|
||||
function sfinv.set_player_inventory_formspec(player, context)
|
||||
local fs = sfinv.get_formspec(player,
|
||||
context or sfinv.get_or_create_context(player))
|
||||
player:set_inventory_formspec(fs)
|
||||
end
|
||||
|
||||
function sfinv.set_page(player, pagename)
|
||||
local context = sfinv.get_or_create_context(player)
|
||||
local oldpage = sfinv.pages[context.page]
|
||||
if oldpage and oldpage.on_leave then
|
||||
oldpage:on_leave(player, context)
|
||||
end
|
||||
context.page = pagename
|
||||
local page = sfinv.pages[pagename]
|
||||
if page.on_enter then
|
||||
page:on_enter(player, context)
|
||||
end
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
|
||||
function sfinv.get_page(player)
|
||||
local context = sfinv.contexts[player:get_player_name()]
|
||||
return context and context.page or sfinv.get_homepage_name(player)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if sfinv.enabled then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
sfinv.contexts[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "" or not sfinv.enabled then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Get Context
|
||||
local name = player:get_player_name()
|
||||
local context = sfinv.contexts[name]
|
||||
if not context then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Was a tab selected?
|
||||
if fields.sfinv_nav_tabs and context.nav then
|
||||
local tid = tonumber(fields.sfinv_nav_tabs)
|
||||
if tid and tid > 0 then
|
||||
local id = context.nav[tid]
|
||||
local page = sfinv.pages[id]
|
||||
if id and page then
|
||||
sfinv.set_page(player, id)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Pass event to page
|
||||
local page = sfinv.pages[context.page]
|
||||
if page and page.on_player_receive_fields then
|
||||
return page:on_player_receive_fields(player, context, fields)
|
||||
end
|
||||
end
|
||||
end)
|
22
mods/sfinv/init.lua
Normal file
@ -0,0 +1,22 @@
|
||||
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
||||
|
||||
sfinv.register_page("sfinv:crafting", {
|
||||
title = "Crafting",
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
list[current_player;craft;1.75,0.5;3,3;]
|
||||
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||
image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
listring[current_player;main]
|
||||
listring[current_player;craft]
|
||||
image[0,4.7;1,1;gui_hb_bg.png]
|
||||
image[1,4.7;1,1;gui_hb_bg.png]
|
||||
image[2,4.7;1,1;gui_hb_bg.png]
|
||||
image[3,4.7;1,1;gui_hb_bg.png]
|
||||
image[4,4.7;1,1;gui_hb_bg.png]
|
||||
image[5,4.7;1,1;gui_hb_bg.png]
|
||||
image[6,4.7;1,1;gui_hb_bg.png]
|
||||
image[7,4.7;1,1;gui_hb_bg.png]
|
||||
]], true)
|
||||
end
|
||||
})
|
24
mods/sfinv/license.txt
Normal file
@ -0,0 +1,24 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2016-2018 rubenwardy <rubenwardy@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
|
301
mods/ws_core/README.txt
Normal file
@ -0,0 +1,301 @@
|
||||
Minetest Game mod: default
|
||||
==========================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media (textures, models and sounds)
|
||||
----------------------------------------------
|
||||
Everything not listed in here:
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
|
||||
Cisoun's texture pack (CC BY-SA 3.0):
|
||||
default_jungletree.png
|
||||
default_lava.png
|
||||
default_leaves.png
|
||||
default_sapling.png
|
||||
default_bush_sapling.png
|
||||
default_stone.png
|
||||
default_tree.png
|
||||
default_tree_top.png
|
||||
default_water.png
|
||||
|
||||
Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0):
|
||||
default_torch.png
|
||||
default_torch_on_ceiling.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
VanessaE's animated torches (CC BY-SA 3.0):
|
||||
default_torch_animated.png
|
||||
default_torch_on_ceiling_animated.png
|
||||
default_torch_on_floor_animated.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
RealBadAngel's animated water (CC BY-SA 3.0):
|
||||
default_water_source_animated.png
|
||||
default_water_flowing_animated.png
|
||||
|
||||
VanessaE (CC BY-SA 3.0):
|
||||
default_desert_sand.png
|
||||
default_desert_stone.png
|
||||
default_sand.png
|
||||
default_mese_crystal.png
|
||||
default_mese_crystal_fragment.png
|
||||
|
||||
Calinou (CC BY-SA 3.0):
|
||||
default_brick.png
|
||||
default_papyrus.png
|
||||
default_mineral_copper.png
|
||||
default_glass_detail.png
|
||||
|
||||
PilzAdam (CC BY-SA 3.0):
|
||||
default_jungleleaves.png
|
||||
default_junglesapling.png
|
||||
default_obsidian_glass.png
|
||||
default_obsidian_shard.png
|
||||
default_mineral_gold.png
|
||||
|
||||
jojoa1997 (CC BY-SA 3.0):
|
||||
default_obsidian.png
|
||||
|
||||
InfinityProject (CC BY-SA 3.0):
|
||||
default_mineral_diamond.png
|
||||
|
||||
Splizard (CC BY-SA 3.0):
|
||||
default_pine_sapling.png
|
||||
default_pine_needles.png
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
default_coal_block.png
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0)
|
||||
default_pinetree.png
|
||||
default_pinetree_top.png
|
||||
default_pinewood.png
|
||||
default_acacia_leaves.png
|
||||
default_acacia_leaves_simple.png
|
||||
default_acacia_sapling.png
|
||||
default_acacia_bush_sapling.png
|
||||
default_acacia_tree.png
|
||||
default_acacia_tree_top.png
|
||||
default_acacia_wood.png
|
||||
default_acacia_bush_stem.png
|
||||
default_bush_stem.png
|
||||
default_junglewood.png
|
||||
default_jungletree_top.png
|
||||
default_sandstone_brick.png
|
||||
default_obsidian_brick.png
|
||||
default_stone_brick.png
|
||||
default_desert_stone_brick.png
|
||||
default_sandstone_block.png
|
||||
default_obsidian_block.png
|
||||
default_stone_block.png
|
||||
default_desert_stone_block.png
|
||||
default_river_water.png
|
||||
default_river_water_source_animated.png
|
||||
default_river_water_flowing_animated.png
|
||||
default_dry_grass.png
|
||||
default_dry_grass_side.png
|
||||
default_dry_grass_*.png
|
||||
default_grass.png
|
||||
default_grass_side.png
|
||||
default_mese_block.png
|
||||
default_silver_sand.png
|
||||
default_mese_post_light_side.png
|
||||
default_mese_post_light_side_dark.png
|
||||
default_mese_post_light_top.png
|
||||
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
|
||||
default_marram_grass_*.png -- Derived from textures by TumeniNodes (CC-BY-SA 3.0)
|
||||
default_emergent_jungle_sapling.png
|
||||
|
||||
TumeniNodes (CC BY-SA 3.0):
|
||||
default_desert_cobble.png -- Derived from a texture by brunob.santos (CC BY-SA 3.0)
|
||||
default_coniferous_litter.png
|
||||
default_coniferous_litter_side.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_aspen_leaves.png -- Derived from Sofar's texture
|
||||
default_wood.png
|
||||
default_clay_brick.png
|
||||
default_iron_ingot.png
|
||||
default_gold_ingot.png
|
||||
default_tool_steelsword.png
|
||||
default_diamond.png
|
||||
default_tool_*.png
|
||||
default_lava_source_animated.png
|
||||
default_lava_flowing_animated.png
|
||||
default_stick.png
|
||||
default_chest_front.png
|
||||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
default_mineral_mese.png
|
||||
default_meselamp.png
|
||||
bubble.png
|
||||
gui_*.png
|
||||
|
||||
sofar (CC BY-SA 3.0):
|
||||
default_aspen_sapling
|
||||
default_aspen_tree
|
||||
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
|
||||
default_aspen_wood, derived from default_pine_wood (by paramat)
|
||||
default_chest_inside
|
||||
|
||||
sofar (CC0 1.0):
|
||||
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
|
||||
|
||||
Neuromancer (CC BY-SA 3.0):
|
||||
default_cobble.png, based on texture by Brane praefect
|
||||
default_mossycobble.png, based on texture by Brane praefect
|
||||
default_dirt.png
|
||||
default_furnace_*.png
|
||||
|
||||
Gambit (CC BY-SA 3.0):
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_copper_lump.png
|
||||
default_iron_lump.png
|
||||
default_gold_lump.png
|
||||
default_clay_lump.png
|
||||
default_coal.png
|
||||
default_grass_*.png
|
||||
default_paper.png
|
||||
default_diamond_block.png
|
||||
default_ladder_steel.png
|
||||
default_sign_wall_wood.png
|
||||
default_flint.png
|
||||
default_snow.png
|
||||
default_snow_side.png
|
||||
default_snowball.png
|
||||
default_key.png
|
||||
default_key_skeleton.png
|
||||
default_book.png
|
||||
|
||||
asl97 (CC BY-SA 3.0):
|
||||
default_ice.png
|
||||
|
||||
KevDoy (CC BY-SA 3.0):
|
||||
heart.png
|
||||
|
||||
Pithydon (CC BY-SA 3.0)
|
||||
default_coral_brown.png
|
||||
default_coral_orange.png
|
||||
default_coral_skeleton.png
|
||||
|
||||
Ferk (CC0 1.0):
|
||||
default_item_smoke.png
|
||||
default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart
|
||||
|
||||
npx (CC BY-SA 3.0):
|
||||
default_rainforest_litter.png
|
||||
default_rainforest_litter_side.png
|
||||
|
||||
kaeza (CC-BY-SA 3.0):
|
||||
default_desert_sandstone.png
|
||||
default_desert_sandstone_brick.png
|
||||
default_desert_sandstone_block.png
|
||||
|
||||
kilbith (CC BY-SA 3.0):
|
||||
default_steel_block.png
|
||||
default_copper_block.png
|
||||
default_bronze_block.png
|
||||
default_gold_block.png
|
||||
default_tin_block.png
|
||||
default_mineral_tin.png
|
||||
default_tin_ingot.png
|
||||
default_tin_lump.png
|
||||
|
||||
tobyplowy (CC BY-SA 3.0):
|
||||
default_kelp.png
|
||||
|
||||
CloudyProton (CC BY-SA 3.0):
|
||||
default_book_written.png, based on default_book.png by Gambit
|
||||
|
||||
Mossmanikin (CC BY-SA 3.0):
|
||||
default_fern_*.png
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
||||
|
||||
sonictechtonic (CC BY 3.0):
|
||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
||||
player_damage.ogg
|
||||
|
||||
Mito551 (sounds) (CC BY-SA 3.0):
|
||||
default_dig_choppy.ogg
|
||||
default_dig_cracky.ogg
|
||||
default_dig_crumbly.1.ogg
|
||||
default_dig_crumbly.2.ogg
|
||||
default_dig_dig_immediate.ogg
|
||||
default_dig_oddly_breakable_by_hand.ogg
|
||||
default_dug_node.1.ogg
|
||||
default_dug_node.2.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_grass_footstep.2.ogg
|
||||
default_grass_footstep.3.ogg
|
||||
default_gravel_footstep.1.ogg
|
||||
default_gravel_footstep.2.ogg
|
||||
default_gravel_footstep.3.ogg
|
||||
default_gravel_footstep.4.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_place_node.1.ogg
|
||||
default_place_node.2.ogg
|
||||
default_place_node.3.ogg
|
||||
default_place_node_hard.1.ogg
|
||||
default_place_node_hard.2.ogg
|
||||
default_hard_footstep.1.ogg
|
||||
default_hard_footstep.2.ogg
|
||||
default_hard_footstep.3.ogg
|
||||
default_sand_footstep.1.ogg
|
||||
default_sand_footstep.2.ogg
|
||||
default_wood_footstep.1.ogg
|
||||
default_wood_footstep.2.ogg
|
||||
default_dirt_footstep.1.ogg
|
||||
default_dirt_footstep.2.ogg
|
||||
default_glass_footstep.ogg
|
||||
|
||||
Metal sounds:
|
||||
default_dig_metal.ogg - yadronoff - CC-BY-3.0
|
||||
- https://www.freesound.org/people/yadronoff/sounds/320397/
|
||||
default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0
|
||||
- http://opengameart.org/users/qubodup
|
||||
default_metal_footstep.*.ogg - Ottomaani138 - CC0
|
||||
- https://www.freesound.org/people/Ottomaani138/sounds/232692/
|
||||
default_place_node_metal.*.ogg - Ogrebane - CC0
|
||||
- http://opengameart.org/content/wood-and-metal-sound-effects-volume-2
|
||||
|
||||
Tool breaking sounds added by sofar: CC-BY-3.0
|
||||
default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/
|
||||
|
||||
AGFX (CC BY 3.0):
|
||||
https://www.freesound.org/people/AGFX/packs/1253/
|
||||
default_water_footstep.1.ogg
|
||||
default_water_footstep.2.ogg
|
||||
default_water_footstep.3.ogg
|
||||
(default_water_footstep.4.ogg is silent)
|
||||
|
||||
blukotek (CC0 1.0):
|
||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
||||
default_dig_snappy.ogg
|
||||
|
||||
Chests sounds added by sofar, derived of several files mixed together:
|
||||
default_chest_open.ogg
|
||||
default_chest_close.ogg
|
||||
- http://www.freesound.org/people/Sevin7/sounds/269722/ CC0
|
||||
- http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0
|
||||
|
||||
Ryding (CC0 1.0):
|
||||
http://freesound.org/people/Ryding/sounds/94337/
|
||||
default_snow_footstep.*.ogg
|
74
mods/ws_core/aliases.lua
Normal file
@ -0,0 +1,74 @@
|
||||
-- mods/ws_core/aliases.lua
|
||||
|
||||
-- Aliases to support loading worlds using nodes following the old naming convention
|
||||
-- These can also be helpful when using chat commands, for example /giveme
|
||||
minetest.register_alias("stone", "ws_core:stone")
|
||||
minetest.register_alias("stone_with_coal", "ws_core:stone_with_coal")
|
||||
minetest.register_alias("stone_with_iron", "ws_core:stone_with_iron")
|
||||
minetest.register_alias("dirt_with_grass", "ws_core:dirt_dry")
|
||||
minetest.register_alias("dirt_with_grass_footsteps", "ws_core:dirt_dry")
|
||||
minetest.register_alias("dirt", "ws_core:dirt_dry")
|
||||
minetest.register_alias("sand", "ws_core:sandy_dirt")
|
||||
minetest.register_alias("gravel", "ws_core:dirt_dry")
|
||||
minetest.register_alias("sandstone", "ws_core:sandstone")
|
||||
minetest.register_alias("clay", "ws_core:clay")
|
||||
minetest.register_alias("brick", "ws_core:brick")
|
||||
minetest.register_alias("tree", "ws_core:dead_tree")
|
||||
minetest.register_alias("leaves", "ws_core:air")
|
||||
minetest.register_alias("bookshelf", "ws_core:bookshelf")
|
||||
minetest.register_alias("glass", "ws_core:glass")
|
||||
minetest.register_alias("wooden_fence", "ws_core:fence_wood")
|
||||
minetest.register_alias("rail", "carts:rail")
|
||||
minetest.register_alias("ladder", "ws_core:ladder_wood")
|
||||
minetest.register_alias("wood", "ws_core:wood")
|
||||
minetest.register_alias("mese", "ws_core:mese")
|
||||
minetest.register_alias("cloud", "ws_core:cloud")
|
||||
minetest.register_alias("water_flowing", "ws_core:water_flowing")
|
||||
minetest.register_alias("water_source", "ws_core:water_source")
|
||||
minetest.register_alias("lava_flowing", "ws_core:lava_flowing")
|
||||
minetest.register_alias("lava_source", "ws_core:lava_source")
|
||||
minetest.register_alias("torch", "ws_core:torch")
|
||||
minetest.register_alias("sign_wall", "ws_core:sign_wall_wood")
|
||||
minetest.register_alias("furnace", "ws_core:furnace")
|
||||
minetest.register_alias("chest", "ws_core:chest")
|
||||
minetest.register_alias("locked_chest", "ws_core:chest_locked")
|
||||
minetest.register_alias("cobble", "ws_core:cobble")
|
||||
minetest.register_alias("mossycobble", "ws_core:mossycobble")
|
||||
minetest.register_alias("steelblock", "ws_core:steelblock")
|
||||
minetest.register_alias("sapling", "ws_core:sapling")
|
||||
minetest.register_alias("apple", "ws_core:apple")
|
||||
minetest.register_alias("jungletree", "default:ignore")
|
||||
|
||||
minetest.register_alias("WPick", "ws_core:pick_wood")
|
||||
minetest.register_alias("STPick", "ws_core:pick_stone")
|
||||
minetest.register_alias("SteelPick", "ws_core:pick_steel")
|
||||
minetest.register_alias("MesePick", "ws_core:pick_mese")
|
||||
minetest.register_alias("WShovel", "ws_core:shovel_wood")
|
||||
minetest.register_alias("STShovel", "ws_core:shovel_stone")
|
||||
minetest.register_alias("SteelShovel", "ws_core:shovel_steel")
|
||||
minetest.register_alias("WAxe", "ws_core:axe_wood")
|
||||
minetest.register_alias("STAxe", "ws_core:axe_stone")
|
||||
minetest.register_alias("SteelAxe", "ws_core:axe_steel")
|
||||
minetest.register_alias("WSword", "ws_core:sword_wood")
|
||||
minetest.register_alias("STSword", "ws_core:sword_stone")
|
||||
minetest.register_alias("SteelSword", "ws_core:sword_steel")
|
||||
|
||||
minetest.register_alias("Stick", "ws_core:stick")
|
||||
minetest.register_alias("paper", "ws_core:paper")
|
||||
minetest.register_alias("book", "ws_core:book")
|
||||
minetest.register_alias("lump_of_coal", "ws_core:coal")
|
||||
minetest.register_alias("lump_of_iron", "ws_core:steel_ingot")
|
||||
minetest.register_alias("lump_of_clay", "ws_core:clay_lump")
|
||||
minetest.register_alias("steel_ingot", "ws_core:steel_ingot")
|
||||
minetest.register_alias("clay_brick", "ws_core:clay_brick")
|
||||
minetest.register_alias("snow", "ws_core:snow")
|
||||
|
||||
-- 'mese_block' was used for a while for the block form of mese
|
||||
minetest.register_alias("ws_core:mese_block", "ws_core:mese")
|
||||
|
||||
-- Aliases for corrected pine node names
|
||||
minetest.register_alias("ws_core:pinetree", "ws_core:dead_tree")
|
||||
minetest.register_alias("ws_core:pinewood", "ws_core:wood")
|
||||
|
||||
minetest.register_alias("ws_core:ladder", "ws_core:ladder_wood")
|
||||
minetest.register_alias("ws_core:sign_wall", "ws_core:sign_wall_wood")
|
1185
mods/ws_core/crafting.lua
Normal file
179
mods/ws_core/craftitems.lua
Normal file
@ -0,0 +1,179 @@
|
||||
-- mods/ws_core/craftitems.lua
|
||||
|
||||
local lpp = 14 -- Lines per book's page
|
||||
local function book_on_use(itemstack, user)
|
||||
local player_name = user:get_player_name()
|
||||
local meta = itemstack:get_meta()
|
||||
local title, text, owner = "", "", player_name
|
||||
local page, page_max, lines, string = 1, 1, {}, ""
|
||||
|
||||
-- Backwards compatibility
|
||||
local old_data = minetest.deserialize(itemstack:get_metadata())
|
||||
if old_data then
|
||||
meta:from_table({ fields = old_data })
|
||||
end
|
||||
|
||||
local data = meta:to_table().fields
|
||||
|
||||
if data.owner then
|
||||
title = data.title
|
||||
text = data.text
|
||||
owner = data.owner
|
||||
|
||||
for str in (text .. "\n"):gmatch("([^\n]*)[\n]") do
|
||||
lines[#lines+1] = str
|
||||
end
|
||||
|
||||
if data.page then
|
||||
page = data.page
|
||||
page_max = data.page_max
|
||||
|
||||
for i = ((lpp * page) - lpp) + 1, lpp * page do
|
||||
if not lines[i] then break end
|
||||
string = string .. lines[i] .. "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local formspec
|
||||
if owner == player_name then
|
||||
formspec = "size[8,8]" .. ws_core.gui_bg ..
|
||||
ws_core.gui_bg_img ..
|
||||
"field[0.5,1;7.5,0;title;Title:;" ..
|
||||
minetest.formspec_escape(title) .. "]" ..
|
||||
"textarea[0.5,1.5;7.5,7;text;Contents:;" ..
|
||||
minetest.formspec_escape(text) .. "]" ..
|
||||
"button_exit[2.5,7.5;3,1;save;Save]"
|
||||
else
|
||||
formspec = "size[8,8]" .. ws_core.gui_bg ..
|
||||
ws_core.gui_bg_img ..
|
||||
"label[0.5,0.5;by " .. owner .. "]" ..
|
||||
"tablecolumns[color;text]" ..
|
||||
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
||||
"table[0.4,0;7,0.5;title;#FFFF00," .. minetest.formspec_escape(title) .. "]" ..
|
||||
"textarea[0.5,1.5;7.5,7;;" ..
|
||||
minetest.formspec_escape(string ~= "" and string or text) .. ";]" ..
|
||||
"button[2.4,7.6;0.8,0.8;book_prev;<]" ..
|
||||
"label[3.2,7.7;Page " .. page .. " of " .. page_max .. "]" ..
|
||||
"button[4.9,7.6;0.8,0.8;book_next;>]"
|
||||
end
|
||||
|
||||
minetest.show_formspec(player_name, "ws_core:book", formspec)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local max_text_size = 10000
|
||||
local max_title_size = 80
|
||||
local short_title_size = 35
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "ws_core:book" then return end
|
||||
local inv = player:get_inventory()
|
||||
local stack = player:get_wielded_item()
|
||||
|
||||
if fields.save and fields.title and fields.text
|
||||
and fields.title ~= "" and fields.text ~= "" then
|
||||
local new_stack, data
|
||||
if stack:get_name() ~= "ws_core:book_written" then
|
||||
local count = stack:get_count()
|
||||
if count == 1 then
|
||||
stack:set_name("ws_core:book_written")
|
||||
else
|
||||
stack:set_count(count - 1)
|
||||
new_stack = ItemStack("ws_core:book_written")
|
||||
end
|
||||
else
|
||||
data = stack:get_meta():to_table().fields
|
||||
end
|
||||
|
||||
if data and data.owner and data.owner ~= player:get_player_name() then
|
||||
return
|
||||
end
|
||||
|
||||
if not data then data = {} end
|
||||
data.title = fields.title:sub(1, max_title_size)
|
||||
data.owner = player:get_player_name()
|
||||
local short_title = data.title
|
||||
-- Don't bother triming the title if the trailing dots would make it longer
|
||||
if #short_title > short_title_size + 3 then
|
||||
short_title = short_title:sub(1, short_title_size) .. "..."
|
||||
end
|
||||
data.description = "\""..short_title.."\" by "..data.owner
|
||||
data.text = fields.text:sub(1, max_text_size)
|
||||
data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n")
|
||||
data.page = 1
|
||||
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
|
||||
|
||||
if new_stack then
|
||||
new_stack:get_meta():from_table({ fields = data })
|
||||
if inv:room_for_item("main", new_stack) then
|
||||
inv:add_item("main", new_stack)
|
||||
else
|
||||
minetest.add_item(player:getpos(), new_stack)
|
||||
end
|
||||
else
|
||||
stack:get_meta():from_table({ fields = data })
|
||||
end
|
||||
|
||||
elseif fields.book_next or fields.book_prev then
|
||||
local data = stack:get_meta():to_table().fields
|
||||
if not data or not data.page then
|
||||
return
|
||||
end
|
||||
|
||||
data.page = tonumber(data.page)
|
||||
data.page_max = tonumber(data.page_max)
|
||||
|
||||
if fields.book_next then
|
||||
data.page = data.page + 1
|
||||
if data.page > data.page_max then
|
||||
data.page = 1
|
||||
end
|
||||
else
|
||||
data.page = data.page - 1
|
||||
if data.page == 0 then
|
||||
data.page = data.page_max
|
||||
end
|
||||
end
|
||||
|
||||
stack:get_meta():from_table({fields = data})
|
||||
stack = book_on_use(stack, player)
|
||||
end
|
||||
|
||||
-- Update stack
|
||||
player:set_wielded_item(stack)
|
||||
end)
|
||||
|
||||
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
|
||||
if itemstack:get_name() ~= "ws_core:book_written" then
|
||||
return
|
||||
end
|
||||
|
||||
local original
|
||||
local index
|
||||
for i = 1, player:get_inventory():get_size("craft") do
|
||||
if old_craft_grid[i]:get_name() == "ws_core:book_written" then
|
||||
original = old_craft_grid[i]
|
||||
index = i
|
||||
end
|
||||
end
|
||||
if not original then
|
||||
return
|
||||
end
|
||||
local copymeta = original:get_meta():to_table()
|
||||
-- copy of the book held by player's mouse cursor
|
||||
itemstack:get_meta():from_table(copymeta)
|
||||
-- put the book with metadata back in the craft grid
|
||||
craft_inv:set_stack("craft", index, original)
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("ws_core:coal", {
|
||||
description = "Coal",
|
||||
inventory_image = "ws_coal.png",
|
||||
groups = {coal = 1, flammable = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("ws_core:iron_lump", {
|
||||
description = "Iron Lump",
|
||||
inventory_image = "ws_core_iron_lump.png",
|
||||
})
|
1
mods/ws_core/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
player_api?
|
488
mods/ws_core/functions.lua
Normal file
@ -0,0 +1,488 @@
|
||||
--
|
||||
-- Sounds
|
||||
--
|
||||
|
||||
function ws_core.node_sound_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "", gain = 1.0}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_dug_node", gain = 0.25}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node_hard", gain = 1.0}
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_stone_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_hard_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_hard_footstep", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_dirt_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_dirt_footstep", gain = 0.4}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_dirt_footstep", gain = 1.0}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_sand_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_sand_footstep", gain = 0.12}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_sand_footstep", gain = 0.24}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_gravel_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_gravel_footstep", gain = 0.4}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_gravel_footstep", gain = 1.0}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_wood_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_wood_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_wood_footstep", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_leaves_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_grass_footstep", gain = 0.45}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_grass_footstep", gain = 0.7}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_glass_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_glass_footstep", gain = 0.3}
|
||||
table.dig = table.dig or
|
||||
{name = "ws_core_glass_footstep", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_break_glass", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_metal_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_metal_footstep", gain = 0.4}
|
||||
table.dig = table.dig or
|
||||
{name = "ws_core_dig_metal", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_dug_metal", gain = 0.5}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node_metal", gain = 0.5}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_water_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_water_footstep", gain = 0.2}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ws_core.node_sound_snow_ws_cores(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "ws_core_snow_footstep", gain = 0.2}
|
||||
table.dig = table.dig or
|
||||
{name = "ws_core_snow_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "ws_core_snow_footstep", gain = 0.3}
|
||||
table.place = table.place or
|
||||
{name = "ws_core_place_node", gain = 1.0}
|
||||
ws_core.node_sound_ws_cores(table)
|
||||
return table
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
ws_core.cool_lava = function(pos, node)
|
||||
if node.name == "ws_core:lava_source" then
|
||||
minetest.set_node(pos, {name = "ws_core:obsidian"})
|
||||
else -- Lava flowing
|
||||
minetest.set_node(pos, {name = "ws_core:stone"})
|
||||
end
|
||||
minetest.sound_play("ws_core_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
|
||||
if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"ws_core:lava_source", "ws_core:lava_flowing"},
|
||||
neighbors = {"group:cools_lava", "group:water"},
|
||||
interval = 2,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
action = function(...)
|
||||
ws_core.cool_lava(...)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Optimized helper to put all items in an inventory into a drops list
|
||||
--
|
||||
|
||||
function ws_core.get_inventory_drops(pos, inventory, drops)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local n = #drops
|
||||
for i = 1, inv:get_size(inventory) do
|
||||
local stack = inv:get_stack(inventory, i)
|
||||
if stack:get_count() > 0 then
|
||||
drops[n+1] = stack:to_table()
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
-- Wrapping the functions in ABM action is necessary to make overriding them possible
|
||||
|
||||
function ws_core.grow_cactus(pos, node)
|
||||
if node.param2 >= 4 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "ws_core:cactus" and height < 4 do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "ws_core:cactus"})
|
||||
return true
|
||||
end
|
||||
|
||||
function ws_core.grow_papyrus(pos, node)
|
||||
pos.y = pos.y - 1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name ~= "ws_core:dirt_with_grass" and name ~= "ws_core:dirt" then
|
||||
return
|
||||
end
|
||||
if not minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "ws_core:papyrus" and height < 4 do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "ws_core:papyrus"})
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Grow cactus",
|
||||
nodenames = {"ws_core:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 12,
|
||||
chance = 83,
|
||||
action = function(...)
|
||||
ws_core.grow_cactus(...)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Grow papyrus",
|
||||
nodenames = {"ws_core:papyrus"},
|
||||
neighbors = {"ws_core:dirt", "ws_core:dirt_with_grass"},
|
||||
interval = 14,
|
||||
chance = 71,
|
||||
action = function(...)
|
||||
ws_core.grow_papyrus(...)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Dig upwards
|
||||
--
|
||||
|
||||
function ws_core.dig_up(pos, node, digger)
|
||||
if digger == nil then return end
|
||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local nn = minetest.get_node(np)
|
||||
if nn.name == node.name then
|
||||
minetest.node_dig(np, nn, digger)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Fence registration helper
|
||||
--
|
||||
|
||||
function ws_core.register_fence(name, def)
|
||||
minetest.register_craft({
|
||||
output = name .. " 4",
|
||||
recipe = {
|
||||
{ def.material, 'group:stick', def.material },
|
||||
{ def.material, 'group:stick', def.material },
|
||||
}
|
||||
})
|
||||
|
||||
local fence_texture = "ws_core_fence_overlay.png^" .. def.texture ..
|
||||
"^ws_core_fence_overlay.png^[makealpha:255,126,126"
|
||||
-- Allow almost everything to be overridden
|
||||
local ws_core_fields = {
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
|
||||
-- connect_top =
|
||||
-- connect_bottom =
|
||||
connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
|
||||
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
|
||||
connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
|
||||
{-1/2,-5/16,-1/16,-1/8,-3/16,1/16}},
|
||||
connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2},
|
||||
{-1/16,-5/16,1/8,1/16,-3/16,1/2}},
|
||||
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
|
||||
{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
|
||||
},
|
||||
connects_to = {"group:fence", "group:wood", "group:tree"},
|
||||
inventory_image = fence_texture,
|
||||
wield_image = fence_texture,
|
||||
tiles = {def.texture},
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {},
|
||||
}
|
||||
for k, v in pairs(ws_core_fields) do
|
||||
if def[k] == nil then
|
||||
def[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- Always add to the fence group, even if no group provided
|
||||
def.groups.fence = 1
|
||||
|
||||
def.texture = nil
|
||||
def.material = nil
|
||||
|
||||
minetest.register_node(name, def)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
--
|
||||
|
||||
-- Prevent decay of placed leaves
|
||||
|
||||
|
||||
--
|
||||
-- Convert dirt to something that fits the environment
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Grass spread",
|
||||
nodenames = {"ws_core:dirt"},
|
||||
neighbors = {
|
||||
"air",
|
||||
"group:grass",
|
||||
"group:dry_grass",
|
||||
"ws_core:snow",
|
||||
},
|
||||
interval = 6,
|
||||
chance = 50,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
-- Check for darkness: night, shadow or under a light-blocking node
|
||||
-- Returns if ignore above
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if (minetest.get_node_light(above) or 0) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Look for spreading dirt-type neighbours
|
||||
local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type")
|
||||
if p2 then
|
||||
local n3 = minetest.get_node(p2)
|
||||
minetest.set_node(pos, {name = n3.name})
|
||||
return
|
||||
end
|
||||
|
||||
-- Else, any seeding nodes on top?
|
||||
local name = minetest.get_node(above).name
|
||||
-- Snow check is cheapest, so comes first
|
||||
if name == "ws_core:snow" then
|
||||
minetest.set_node(pos, {name = "ws_core:dirt_with_snow"})
|
||||
-- Most likely case first
|
||||
elseif minetest.get_item_group(name, "grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "ws_core:dirt_with_grass"})
|
||||
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "ws_core:dirt_with_dry_grass"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Grass and dry grass removed in darkness
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Grass covered",
|
||||
nodenames = {"group:spreading_dirt_type"},
|
||||
interval = 8,
|
||||
chance = 50,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
|
||||
nodedef.paramtype == "light") and
|
||||
nodedef.liquidtype == "none") then
|
||||
minetest.set_node(pos, {name = "ws_core:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Moss growth on cobble near water
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Moss growth",
|
||||
nodenames = {"ws_core:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 16,
|
||||
chance = 200,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
if node.name == "ws_core:cobble" then
|
||||
minetest.set_node(pos, {name = "ws_core:mossycobble"})
|
||||
elseif node.name == "stairs:slab_cobble" then
|
||||
minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2})
|
||||
elseif node.name == "stairs:stair_cobble" then
|
||||
minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2})
|
||||
elseif node.name == "walls:cobble" then
|
||||
minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Coral death near air
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ws_core:coral_brown", "ws_core:coral_orange"},
|
||||
neighbors = {"air"},
|
||||
interval = 17,
|
||||
chance = 5,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name = "ws_core:coral_skeleton"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- NOTICE: This method is not an official part of the API yet.
|
||||
-- This method may change in future.
|
||||
--
|
||||
|
||||
function ws_core.can_interact_with_node(player, pos)
|
||||
if player then
|
||||
if minetest.check_player_privs(player, "protection_bypass") then
|
||||
return true
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
if not owner or owner == "" or owner == player:get_player_name() then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Is player wielding the right key?
|
||||
local item = player:get_wielded_item()
|
||||
if item:get_name() == "ws_core:key" then
|
||||
local key_meta = item:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
local key_oldmeta = item:get_metadata()
|
||||
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
||||
return false
|
||||
end
|
||||
|
||||
key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret)
|
||||
item:set_metadata("")
|
||||
end
|
||||
|
||||
return meta:get_string("key_lock_secret") == key_meta:get_string("secret")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
41
mods/ws_core/init.lua
Normal file
@ -0,0 +1,41 @@
|
||||
-- Minetest 0.4 mod: ws_core
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- The API documentation in here was moved into game_api.txt
|
||||
|
||||
-- Definitions made by this mod that other mods can use too
|
||||
ws_core = {}
|
||||
|
||||
ws_core.LIGHT_MAX = 14
|
||||
|
||||
function ws_core.get_hotbar_bg(x,y)
|
||||
local out = ""
|
||||
for i=0,7,1 do
|
||||
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
ws_core.gui_survival_form = "size[8,8.5]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"list[current_player;craft;1.75,0.5;2,2;]"..
|
||||
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
||||
"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_player;craft]"..
|
||||
ws_core.get_hotbar_bg(0,4.25)
|
||||
|
||||
-- Load files
|
||||
local ws_core_path = minetest.get_modpath("ws_core")
|
||||
|
||||
dofile(ws_core_path.."/functions.lua")
|
||||
dofile(ws_core_path.."/nodes.lua")
|
||||
dofile(ws_core_path.."/item_entity.lua")
|
||||
dofile(ws_core_path.."/craftitems.lua")
|
||||
dofile(ws_core_path.."/crafting.lua")
|
||||
dofile(ws_core_path.."/mapgen.lua")
|
||||
dofile(ws_core_path.."/aliases.lua")
|
||||
dofile(ws_core_path.."/legacy.lua")
|
||||
dofile(ws_core_path.."/trees.lua")
|
||||
dofile(ws_core_path.."/tools.lua")
|
74
mods/ws_core/item_entity.lua
Normal file
@ -0,0 +1,74 @@
|
||||
-- mods/ws_core/item_entity.lua
|
||||
|
||||
local builtin_item = minetest.registered_entities["__builtin:item"]
|
||||
|
||||
local item = {
|
||||
set_item = function(self, itemstring)
|
||||
builtin_item.set_item(self, itemstring)
|
||||
|
||||
local stack = ItemStack(itemstring)
|
||||
local itemdef = minetest.registered_items[stack:get_name()]
|
||||
if itemdef and itemdef.groups.flammable ~= 0 then
|
||||
self.flammable = itemdef.groups.flammable
|
||||
end
|
||||
end,
|
||||
|
||||
burn_up = function(self)
|
||||
-- disappear in a smoke puff
|
||||
self.object:remove()
|
||||
local p = self.object:getpos()
|
||||
minetest.sound_play("ws_core_item_smoke", {
|
||||
pos = p,
|
||||
max_hear_distance = 8,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 3,
|
||||
time = 0.1,
|
||||
minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 },
|
||||
maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 },
|
||||
minvel = {x = 0, y = 2.5, z = 0},
|
||||
maxvel = {x = 0, y = 2.5, z = 0},
|
||||
minacc = {x = -0.15, y = -0.02, z = -0.15},
|
||||
maxacc = {x = 0.15, y = -0.01, z = 0.15},
|
||||
minexptime = 4,
|
||||
maxexptime = 6,
|
||||
minsize = 5,
|
||||
maxsize = 5,
|
||||
collisiondetection = true,
|
||||
texture = "ws_core_item_smoke.png"
|
||||
})
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
builtin_item.on_step(self, dtime)
|
||||
|
||||
if self.flammable then
|
||||
-- flammable, check for igniters
|
||||
self.ignite_timer = (self.ignite_timer or 0) + dtime
|
||||
if self.ignite_timer > 10 then
|
||||
self.ignite_timer = 0
|
||||
|
||||
local node = minetest.get_node_or_nil(self.object:getpos())
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
|
||||
-- Immediately burn up flammable items in lava
|
||||
if minetest.get_item_group(node.name, "lava") > 0 then
|
||||
self:burn_up()
|
||||
else
|
||||
-- otherwise there'll be a chance based on its igniter value
|
||||
local burn_chance = self.flammable
|
||||
* minetest.get_item_group(node.name, "igniter")
|
||||
if burn_chance > 0 and math.random(0, burn_chance) ~= 0 then
|
||||
self:burn_up()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- set defined item as new __builtin:item, with the old one as fallback table
|
||||
setmetatable(item, builtin_item)
|
||||
minetest.register_entity(":__builtin:item", item)
|
37
mods/ws_core/legacy.lua
Normal file
@ -0,0 +1,37 @@
|
||||
-- mods/ws_core/legacy.lua
|
||||
|
||||
-- Horrible stuff to support old code registering falling nodes
|
||||
-- Don't use this and never do what this does, it's completely wrong!
|
||||
-- (More specifically, the client and the C++ code doesn't get the group)
|
||||
function ws_core.register_falling_node(nodename, texture)
|
||||
minetest.log("error", debug.traceback())
|
||||
minetest.log('error', "WARNING: ws_core.register_falling_node is deprecated")
|
||||
if minetest.registered_nodes[nodename] then
|
||||
minetest.registered_nodes[nodename].groups.falling_node = 1
|
||||
end
|
||||
end
|
||||
|
||||
function ws_core.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
end
|
||||
|
||||
-- Formspecs
|
||||
ws_core.gui_suvival_form = ws_core.gui_survival_form
|
||||
|
||||
-- Players
|
||||
if minetest.get_modpath("player_api") then
|
||||
ws_core.registered_player_models = player_api.registered_models
|
||||
ws_core.player_register_model = player_api.register_model
|
||||
ws_core.player_attached = player_api.player_attached
|
||||
ws_core.player_get_animation = player_api.get_animation
|
||||
ws_core.player_set_model = player_api.set_model
|
||||
ws_core.player_set_textures = player_api.set_textures
|
||||
ws_core.player_set_animation = player_api.set_animation
|
||||
end
|
||||
|
||||
-- Check for a volume intersecting protection
|
||||
function ws_core.intersects_protection(minp, maxp, player_name, interval)
|
||||
minetest.log("warning", "ws_core.intersects_protection() is " ..
|
||||
"deprecated, use minetest.is_area_protected() instead.")
|
||||
minetest.is_area_protected(minp, maxp, player_name, interval)
|
||||
end
|
154
mods/ws_core/license.txt
Normal file
@ -0,0 +1,154 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2011-2016 Various Minetest developers and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful, 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:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
Licenses of media (textures, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2010-2017:
|
||||
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Cisoun
|
||||
G4JC
|
||||
VanessaE
|
||||
RealBadAngel
|
||||
Calinou
|
||||
MirceaKitsune
|
||||
Jordach
|
||||
PilzAdam
|
||||
jojoa1997
|
||||
InfinityProject
|
||||
Splizard
|
||||
Zeg9
|
||||
paramat
|
||||
BlockMen
|
||||
sofar
|
||||
Neuromancer
|
||||
Gambit
|
||||
asl97
|
||||
KevDoy
|
||||
Mito551
|
||||
GreenXenith
|
||||
kaeza
|
||||
kilbith
|
||||
tobyplowy
|
||||
CloudyProton
|
||||
TumeniNodes
|
||||
Mossmanikin
|
||||
|
||||
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/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution 3.0 Unported (CC BY 3.0)
|
||||
|
||||
Copyright (C) 2009 cmusounddesign
|
||||
Copyright (C) 2010 Tomlija
|
||||
Copyright (C) 2010 lsprice
|
||||
Copyright (C) 2014 sonictechtonic
|
||||
Copyright (C) 2015 yadronoff
|
||||
Copyright (C) 2007 HerbertBoland
|
||||
Copyright (C) 2006 AGFX
|
||||
|
||||
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.
|
||||
|
||||
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/3.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
||||
|
||||
Iwan Gabovitch
|
||||
Ottomaani138
|
||||
Ogrebane
|
||||
blukotek
|
||||
Sevin7
|
||||
Yoyodaman234
|
||||
Ryding
|
||||
|
||||
No Copyright
|
||||
|
||||
The person who associated a work with this deed has dedicated the work to the
|
||||
public domain by waiving all of his or her rights to the work worldwide under
|
||||
copyright law, including all related and neighboring rights, to the extent
|
||||
allowed by law.
|
||||
|
||||
You can copy, modify, distribute and perform the work, even for commercial
|
||||
purposes, all without asking permission. See Other Information below.
|
||||
|
||||
Other Information:
|
||||
|
||||
In no way are the patent or trademark rights of any person affected by CC0, nor
|
||||
are the rights that other persons may have in the work or in how the work is
|
||||
used, such as publicity or privacy rights.
|
||||
|
||||
Unless expressly stated otherwise, the person who associated a work with this
|
||||
deed makes no warranties about the work, and disclaims liability for all uses
|
||||
of the work, to the fullest extent permitted by applicable law.
|
||||
|
||||
When using or citing the work, you should not imply endorsement by the author
|
||||
or the affirmer.
|
||||
|
||||
For more details:
|
||||
https://creativecommons.org/publicdomain/zero/1.0/
|
981
mods/ws_core/mapgen.lua
Normal file
@ -0,0 +1,981 @@
|
||||
--
|
||||
-- Aliases for map generators
|
||||
--
|
||||
|
||||
minetest.register_alias("mapgen_stone", "ws_core:stone")
|
||||
minetest.register_alias("mapgen_dirt", "ws_core:dirt_dry")
|
||||
minetest.register_alias("default:dirt", "ws_core:dirt")
|
||||
minetest.register_alias("mapgen_dirt_with_grass", "ws_core:dirt_dry1")
|
||||
minetest.register_alias("mapgen_sand", "ws_core:sandy_dirt")
|
||||
minetest.register_alias("mapgen_water_source", "ws_core:water_source")
|
||||
minetest.register_alias("mapgen_river_water_source", "ws_core:river_water_source")
|
||||
minetest.register_alias("mapgen_lava_source", "ws_core:lava_source")
|
||||
minetest.register_alias("mapgen_gravel", "ws_core:gravel")
|
||||
minetest.register_alias("mapgen_desert_stone", "ws_core:desert_stone")
|
||||
minetest.register_alias("mapgen_desert_sand", "ws_core:sandy_dirt")
|
||||
minetest.register_alias("mapgen_dirt_with_snow", "ws_core:dirt_dry")
|
||||
minetest.register_alias("mapgen_snowblock", "ws_core:snowblock")
|
||||
minetest.register_alias("mapgen_snow", "ws_core:snow")
|
||||
minetest.register_alias("mapgen_ice", "ws_core:ice")
|
||||
minetest.register_alias("mapgen_sandstone", "ws_core:sandstone")
|
||||
minetest.register_alias("mapgen_jungletree", "ws_core:dead_tree")
|
||||
minetest.register_alias("mapgen_jungleleaves", "air")
|
||||
|
||||
-- Flora
|
||||
|
||||
minetest.register_alias("mapgen_tree", "ws_core:dead_tree")
|
||||
minetest.register_alias("mapgen_apple", "ws_core:air")
|
||||
|
||||
-- Dungeons
|
||||
|
||||
minetest.register_alias("mapgen_cobble", "ws_core:cobble")
|
||||
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
||||
minetest.register_alias("mapgen_mossycobble", "ws_core:mossycobble")
|
||||
minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
|
||||
minetest.register_alias("mapgen_sandstonebrick", "ws_core:sandstonebrick")
|
||||
minetest.register_alias("mapgen_stair_sandstone_block", "stairs:stair_sandstone_block")
|
||||
|
||||
|
||||
--
|
||||
-- Register ores
|
||||
--
|
||||
|
||||
-- Mgv6
|
||||
|
||||
function ws_core.register_mgv6_ores()
|
||||
|
||||
-- Blob ore
|
||||
-- These first to avoid other ores in blobs
|
||||
-- Sand
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "ws_core:sandy_dirt",
|
||||
wherein = {"ws_core:stone"},
|
||||
clust_scarcity = 16 * 16 * 16,
|
||||
clust_size = 5,
|
||||
y_max = 30,
|
||||
y_min = -31,
|
||||
noise_threshold = 0.0,
|
||||
noise_params = {
|
||||
offset = 0.5,
|
||||
scale = 0.2,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = 2316,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
},
|
||||
})
|
||||
|
||||
-- Gravel
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "ws_core:gravel",
|
||||
wherein = {"ws_core:stone"},
|
||||
clust_scarcity = 16 * 16 * 16,
|
||||
clust_size = 5,
|
||||
y_max = 31000,
|
||||
y_min = -31000,
|
||||
noise_threshold = 0.0,
|
||||
noise_params = {
|
||||
offset = 0.5,
|
||||
scale = 0.2,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = 766,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
},
|
||||
})
|
||||
|
||||
-- Scatter ores
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "ws_core:dirt_dry",
|
||||
wherein = {"ws_core:stone"},
|
||||
clust_scarcity = 16 * 16 * 16,
|
||||
clust_size = 5,
|
||||
y_max = 31000,
|
||||
y_min = -31,
|
||||
noise_threshold = 0.0,
|
||||
noise_params = {
|
||||
offset = 0.5,
|
||||
scale = 0.2,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = 17676,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
},
|
||||
})
|
||||
|
||||
-- Coal
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 8 * 8 * 8,
|
||||
clust_num_ores = 9,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 8 * 8 * 8,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
y_max = 64,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 24 * 24 * 24,
|
||||
clust_num_ores = 27,
|
||||
clust_size = 6,
|
||||
y_max = 0,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Iron
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 12,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 7 * 7 * 7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 0,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 24 * 24 * 24,
|
||||
clust_num_ores = 27,
|
||||
clust_size = 6,
|
||||
y_max = -64,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Copper
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 12 * 12 * 12,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -16,
|
||||
y_min = -63,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -64,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Tin
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -32,
|
||||
y_min = -127,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -128,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Gold
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -64,
|
||||
y_min = -255,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Mese crystal
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 14 * 14 * 14,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 18 * 18 * 18,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -64,
|
||||
y_min = -255,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 14 * 14 * 14,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Diamond
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 17 * 17 * 17,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -128,
|
||||
y_min = -255,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Mese block
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 36 * 36 * 36,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 36 * 36 * 36,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -1024,
|
||||
y_min = -31000,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- All mapgens except mgv6
|
||||
|
||||
function ws_core.register_ores()
|
||||
|
||||
-- Stratum ores.
|
||||
-- These obviously first.
|
||||
-- Desert sandstone
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "stratum",
|
||||
ore = "ws_core:desert_sandstone",
|
||||
wherein = {"ws_core:desert_stone"},
|
||||
clust_scarcity = 1,
|
||||
y_max = 46,
|
||||
y_min = 10,
|
||||
noise_params = {
|
||||
offset = 28,
|
||||
scale = 16,
|
||||
spread = {x = 128, y = 128, z = 128},
|
||||
seed = 90122,
|
||||
octaves = 1,
|
||||
},
|
||||
stratum_thickness = 4,
|
||||
biomes = {"desert"},
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "stratum",
|
||||
ore = "ws_core:desert_sandstone",
|
||||
wherein = {"ws_core:desert_stone"},
|
||||
clust_scarcity = 1,
|
||||
y_max = 42,
|
||||
y_min = 6,
|
||||
noise_params = {
|
||||
offset = 24,
|
||||
scale = 16,
|
||||
spread = {x = 128, y = 128, z = 128},
|
||||
seed = 90122,
|
||||
octaves = 1,
|
||||
},
|
||||
stratum_thickness = 2,
|
||||
biomes = {"desert"},
|
||||
})
|
||||
|
||||
-- Sandstone
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "stratum",
|
||||
ore = "ws_core:sandstone",
|
||||
wherein = {"ws_core:desert_stone"},
|
||||
clust_scarcity = 1,
|
||||
y_max = 39,
|
||||
y_min = 3,
|
||||
noise_params = {
|
||||
offset = 21,
|
||||
scale = 16,
|
||||
spread = {x = 128, y = 128, z = 128},
|
||||
seed = 90122,
|
||||
octaves = 1,
|
||||
},
|
||||
stratum_thickness = 2,
|
||||
biomes = {"desert"},
|
||||
})
|
||||
|
||||
-- Blob ore.
|
||||
-- These before scatter ores to avoid other ores in blobs.
|
||||
|
||||
-- Gravel
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "ws_core:gravel",
|
||||
wherein = {"ws_core:stone"},
|
||||
clust_scarcity = 16 * 16 * 16,
|
||||
clust_size = 5,
|
||||
y_max = 31000,
|
||||
y_min = -31000,
|
||||
noise_threshold = 0.0,
|
||||
noise_params = {
|
||||
offset = 0.5,
|
||||
scale = 0.2,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = 766,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
},
|
||||
biomes = {"dirtland", "desert"}
|
||||
})
|
||||
|
||||
-- Scatter ores
|
||||
|
||||
-- Coal
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 8 * 8 * 8,
|
||||
clust_num_ores = 9,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 8 * 8 * 8,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
y_max = 64,
|
||||
y_min = -127,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_coal",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 12 * 12 * 12,
|
||||
clust_num_ores = 30,
|
||||
clust_size = 5,
|
||||
y_max = -128,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Tin
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -64,
|
||||
y_min = -127,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_tin",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -128,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Copper
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 12 * 12 * 12,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -64,
|
||||
y_min = -127,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_copper",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -128,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Iron
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 12,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 7 * 7 * 7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -128,
|
||||
y_min = -255,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_iron",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 12 * 12 * 12,
|
||||
clust_num_ores = 29,
|
||||
clust_size = 5,
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Gold
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -256,
|
||||
y_min = -511,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_gold",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -512,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Mese crystal
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 14 * 14 * 14,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 18 * 18 * 18,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -512,
|
||||
y_min = -1023,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 14 * 14 * 14,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -1024,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Diamond
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 17 * 17 * 17,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -1024,
|
||||
y_min = -2047,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:stone_with_diamond",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_max = -2048,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- Mese block
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 36 * 36 * 36,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = 31000,
|
||||
y_min = 1025,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 36 * 36 * 36,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
y_max = -2048,
|
||||
y_min = -4095,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "ws_core:mese",
|
||||
wherein = "ws_core:stone",
|
||||
clust_scarcity = 28 * 28 * 28,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_max = -4096,
|
||||
y_min = -31000,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Register biomes
|
||||
--
|
||||
|
||||
-- All mapgens except mgv6
|
||||
|
||||
function ws_core.register_biomes(upper_limit)
|
||||
|
||||
-- Grassland
|
||||
|
||||
minetest.register_biome({
|
||||
name = "dirtland",
|
||||
node_top = "ws_core:dirt_dry1",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:dirt_dry",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "ws_core:sandy_dirt",
|
||||
depth_riverbed = 4,
|
||||
y_max = 31000,
|
||||
y_min = -31,
|
||||
heat_point = 50,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "dirtland_dunes",
|
||||
node_top = "ws_core:sandy_dirt",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:sandy_dirt",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "ws_core:sandy_dirt",
|
||||
depth_riverbed = 4,
|
||||
vertical_blend = 1,
|
||||
y_max = 5,
|
||||
y_min = 4,
|
||||
heat_point = 50,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "dirtland_ocean",
|
||||
node_top = "ws_core:sandy_dirt",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:sandy_dirt",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "ws_core:sandy_dirt",
|
||||
depth_riverbed = 2,
|
||||
y_max = 3,
|
||||
y_min = -112,
|
||||
heat_point = 50,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
||||
-- Desert
|
||||
|
||||
minetest.register_biome({
|
||||
name = "desert",
|
||||
node_top = "ws_core:sandy_dirt",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:sandy_dirt",
|
||||
depth_filler = 2,
|
||||
node_stone = "ws_core:sandstone",
|
||||
node_riverbed = "ws_core:sandy_dirt",
|
||||
depth_riverbed = 6,
|
||||
y_max = upper_limit,
|
||||
y_min = 4,
|
||||
heat_point = 92,
|
||||
humidity_point = 16,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "desert_ocean",
|
||||
node_top = "ws_core:sandy_dirt",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:sandy_dirt",
|
||||
depth_filler = 2,
|
||||
node_stone = "ws_core:sandstone",
|
||||
node_riverbed = "ws_core:sandy_dirt",
|
||||
depth_riverbed = 10,
|
||||
vertical_blend = 1,
|
||||
y_max = 3,
|
||||
y_min = -112,
|
||||
heat_point = 92,
|
||||
humidity_point = 16,
|
||||
})
|
||||
end
|
||||
|
||||
-- Biomes for floatlands
|
||||
|
||||
-- TODO Temporary simple biomes to be replaced by special floatland biomes later.
|
||||
|
||||
function ws_core.register_floatland_biomes(floatland_level, shadow_limit)
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_dirtland",
|
||||
node_top = "ws_core:dirt_dry",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:dirt_dry",
|
||||
depth_filler = 2,
|
||||
y_max = 31000,
|
||||
y_min = floatland_level + 2,
|
||||
heat_point = 50,
|
||||
humidity_point = 25,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_coniferous_forest",
|
||||
node_top = "ws_core:dirt_dry",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:dirt_dry",
|
||||
depth_filler = 2,
|
||||
y_max = 31000,
|
||||
y_min = floatland_level + 2,
|
||||
heat_point = 50,
|
||||
humidity_point = 75,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_ocean",
|
||||
node_top = "ws_core:sandy_dirt",
|
||||
depth_top = 1,
|
||||
node_filler = "ws_core:sandy_dirt",
|
||||
depth_filler = 2,
|
||||
y_max = floatland_level + 1,
|
||||
y_min = shadow_limit,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Register decorations
|
||||
--
|
||||
|
||||
-- Mgv6
|
||||
|
||||
function ws_core.register_mgv6_decorations()
|
||||
-- Dry shrubs
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dry_shrub",
|
||||
deco_type = "simple",
|
||||
place_on = {"ws_core:sandy_dirt"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 0.035,
|
||||
spread = {x = 100, y = 100, z = 100},
|
||||
seed = 329,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
y_max = 30,
|
||||
y_min = 1,
|
||||
decoration = "ws_core:dry_shrub",
|
||||
param2 = 4,
|
||||
})
|
||||
end
|
||||
|
||||
function ws_core.register_decorations()
|
||||
-- Dry shrub
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dry_shrub",
|
||||
deco_type = "simple",
|
||||
place_on = {"ws_core:sandy_dirt",
|
||||
"ws_core:sandy_dirt"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 0.02,
|
||||
spread = {x = 200, y = 200, z = 200},
|
||||
seed = 329,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
biomes = {"desert"},
|
||||
y_max = 31000,
|
||||
y_min = 2,
|
||||
decoration = "ws_core:dry_shrub",
|
||||
param2 = 4,
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- Detect mapgen, flags and parameters to select functions
|
||||
--
|
||||
|
||||
-- Get setting or ws_core
|
||||
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or
|
||||
"mountains, ridges, nofloatlands, caverns"
|
||||
local captures_float = string.match(mgv7_spflags, "floatlands")
|
||||
local captures_nofloat = string.match(mgv7_spflags, "nofloatlands")
|
||||
|
||||
-- Get setting or ws_core
|
||||
-- Make global for mods to use to register floatland biomes
|
||||
ws_core.mgv7_floatland_level =
|
||||
minetest.get_mapgen_setting("mgv7_floatland_level") or 1280
|
||||
ws_core.mgv7_shadow_limit =
|
||||
minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024
|
||||
|
||||
minetest.clear_registered_biomes()
|
||||
minetest.clear_registered_ores()
|
||||
minetest.clear_registered_decorations()
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
if mg_name == "v6" then
|
||||
ws_core.register_mgv6_ores()
|
||||
ws_core.register_mgv6_decorations()
|
||||
-- Need to check for 'nofloatlands' because that contains
|
||||
-- 'floatlands' which makes the second condition true.
|
||||
elseif mg_name == "v7" and
|
||||
captures_float == "floatlands" and
|
||||
captures_nofloat ~= "nofloatlands" then
|
||||
-- Mgv7 with floatlands and floatland biomes
|
||||
ws_core.register_biomes(ws_core.mgv7_shadow_limit - 1)
|
||||
ws_core.register_floatland_biomes(
|
||||
ws_core.mgv7_floatland_level, ws_core.mgv7_shadow_limit)
|
||||
ws_core.register_ores()
|
||||
ws_core.register_decorations()
|
||||
else
|
||||
ws_core.register_biomes(31000)
|
||||
ws_core.register_ores()
|
||||
ws_core.register_decorations()
|
||||
end
|
1168
mods/ws_core/mp2.txt
Normal file
170
mods/ws_core/nodes.lua
Normal file
@ -0,0 +1,170 @@
|
||||
minetest.register_node("ws_core:dirt_dry", {
|
||||
description = "Dry Dirt",
|
||||
tiles = {"ws_dirt_dry.png",
|
||||
{name = "ws_dirt_dry.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:dirt_dry1", {
|
||||
description = "Dry Dirt (top)",
|
||||
tiles = {"ws_dirt_dry.png",
|
||||
{name = "ws_dirt_dry.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1},
|
||||
drop= "ws_core:dirt_dry",
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:sandy_dirt", {
|
||||
description = "Sandy Dirt",
|
||||
tiles = {"ws_sandy_dirt.png",
|
||||
{name = "ws_sandy_dirt.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:stone_with_coal", {
|
||||
description = "Coal Ore",
|
||||
tiles = {"ws_stone.png^ws_mineral_coal.png"},
|
||||
groups = {cracky = 3},
|
||||
drop = 'ws_core:coal',
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:stone_with_coal_dense", {
|
||||
description = "Dense Coal Ore",
|
||||
tiles = {"ws_stone.png^ws_coal_ore.png"},
|
||||
groups = {cracky = 3},
|
||||
drop = 'ws_core:coal 3',
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"ws_stone.png"},
|
||||
groups = {cracky = 3, stone = 1},
|
||||
drop = 'ws_core:cobble',
|
||||
legacy_mineral = true,
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:stone_block", {
|
||||
description = "Stone Block",
|
||||
tiles = {"ws_stone_block.png"},
|
||||
groups = {cracky = 3, stone = 1},
|
||||
legacy_mineral = true,
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:cobble", {
|
||||
description = "Cobblestone",
|
||||
tiles = {"ws_cobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:dead_tree", {
|
||||
description = "Dead Log",
|
||||
tiles = {"ws_dead_tree_top.png", "ws_dead_tree_top.png", "ws_dead_tree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
|
||||
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:wood", {
|
||||
description = "Wooden Planks",
|
||||
paramtype2 = "facedir",
|
||||
place_param2 = 0,
|
||||
tiles = {"ws_wood.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:water_source", {
|
||||
description = "Water Source",
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "ws_water_source.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "ws_water_source.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
damage_per_second = 5,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "ws_core:water_flowing",
|
||||
liquid_alternative_source = "ws_core:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, cools_lava = 1},
|
||||
sounds = ws_core.node_sound_water_ws_cores(),
|
||||
})
|
||||
|
||||
minetest.register_node("ws_core:water_flowing", {
|
||||
description = "Flowing Water",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"ws_core_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "ws_water_flowing.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "ws_water_flowing.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
damage_per_second = 5,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "ws_core:water_flowing",
|
||||
liquid_alternative_source = "ws_core:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, not_in_creative_inventory = 1,
|
||||
cools_lava = 1},
|
||||
sounds = ws_core.node_sound_water_ws_cores(),
|
||||
})
|
BIN
mods/ws_core/schematics.zip
Normal file
BIN
mods/ws_core/schematics/dead_fallen.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree1.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree2.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree3.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree4.mts
Normal file
BIN
mods/ws_core/schematics/dead_tree_fallen.mts
Normal file
BIN
mods/ws_core/textures/crack_anylength.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
mods/ws_core/textures/gui_formbg.png
Normal file
After Width: | Height: | Size: 971 B |
BIN
mods/ws_core/textures/gui_hb_bg.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
mods/ws_core/textures/heart.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
mods/ws_core/textures/wieldhand.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
mods/ws_core/textures/ws_coal.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
mods/ws_core/textures/ws_cobble.png
Normal file
After Width: | Height: | Size: 827 B |
BIN
mods/ws_core/textures/ws_dead_tree.png
Normal file
After Width: | Height: | Size: 666 B |
BIN
mods/ws_core/textures/ws_dead_tree_top.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
mods/ws_core/textures/ws_dirt.png
Normal file
After Width: | Height: | Size: 750 B |
BIN
mods/ws_core/textures/ws_dirt_dry.png
Normal file
After Width: | Height: | Size: 792 B |
BIN
mods/ws_core/textures/ws_dry_dirt.png
Normal file
After Width: | Height: | Size: 745 B |
BIN
mods/ws_core/textures/ws_mineral_coal.png
Normal file
After Width: | Height: | Size: 435 B |
BIN
mods/ws_core/textures/ws_rocky_dirt.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
mods/ws_core/textures/ws_sandy_dirt.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
mods/ws_core/textures/ws_stone.png
Normal file
After Width: | Height: | Size: 772 B |
BIN
mods/ws_core/textures/ws_stone_block.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
mods/ws_core/textures/ws_water_flowing.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
mods/ws_core/textures/ws_water_source.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
mods/ws_core/textures/ws_wood.png
Normal file
After Width: | Height: | Size: 218 B |
15
mods/ws_core/tools.lua
Normal file
@ -0,0 +1,15 @@
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
||||
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
||||
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
|
||||
},
|
||||
damage_groups = {fleshy=1},
|
||||
}
|
||||
})
|
189
mods/ws_core/trees.lua
Normal file
@ -0,0 +1,189 @@
|
||||
--
|
||||
-- dead_tree
|
||||
--
|
||||
local modname = "ws_core"
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
-- internationalization boilerplate
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-- dead_tree
|
||||
local function grow_new_ws_core_tree(pos)
|
||||
if not default.can_grow(pos) then
|
||||
-- try a bit later again
|
||||
minetest.get_node_timer(pos):start(math.random(240, 600))
|
||||
return
|
||||
end
|
||||
|
||||
minetest.place_schematic({x = pos.x-2, y = pos.y, z = pos.z+2}, modpath.."/schematics/dead_tree.mts", "0", nil, true)
|
||||
end
|
||||
--
|
||||
-- Decoration
|
||||
--
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dead_tree",
|
||||
deco_type = "schematic",
|
||||
place_on = {"ws_core:dirt_dry1"},
|
||||
sidelen = 2,
|
||||
noise_params = {
|
||||
offset = 0.0005,
|
||||
scale = 0.00004,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"grassland"},
|
||||
y_min = 2,
|
||||
y_max = 80,
|
||||
schematic = modpath.."/schematics/dead_tree.mts",
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dead_tree1",
|
||||
deco_type = "schematic",
|
||||
place_on = {"ws_core:dirt_dry1"},
|
||||
sidelen = 2,
|
||||
noise_params = {
|
||||
offset = 0.0005,
|
||||
scale = 0.00004,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"grassland"},
|
||||
y_min = 2,
|
||||
y_max = 80,
|
||||
schematic = modpath.."/schematics/dead_tree1.mts",
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dead_tree2",
|
||||
deco_type = "schematic",
|
||||
place_on = {"ws_core:dirt_dry1"},
|
||||
sidelen = 2,
|
||||
noise_params = {
|
||||
offset = 0.0005,
|
||||
scale = 0.00004,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"grassland"},
|
||||
y_min = 2,
|
||||
y_max = 80,
|
||||
schematic = modpath.."/schematics/dead_tree2.mts",
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dead_tree3",
|
||||
deco_type = "schematic",
|
||||
place_on = {"ws_core:dirt_dry1"},
|
||||
sidelen = 2,
|
||||
noise_params = {
|
||||
offset = 0.0005,
|
||||
scale = 0.00004,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"grassland"},
|
||||
y_min = 2,
|
||||
y_max = 80,
|
||||
schematic = modpath.."/schematics/dead_tree3.mts",
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "ws_core:dead_tree_fallen",
|
||||
deco_type = "schematic",
|
||||
place_on = {"ws_core:dirt_dry1"},
|
||||
sidelen = 2,
|
||||
noise_params = {
|
||||
offset = 0.0005,
|
||||
scale = 0.00004,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"grassland"},
|
||||
y_min = 2,
|
||||
y_max = 80,
|
||||
schematic = modpath.."/schematics/dead_tree_fallen.mts",
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
rotation = "random",
|
||||
})
|
||||
--
|
||||
-- Nodes
|
||||
--
|
||||
|
||||
minetest.register_node("ws_core:log", {
|
||||
description = S("Dead Log"),
|
||||
tiles = {
|
||||
"ws_dead_tree_top.png",
|
||||
"ws_dead_tree_top.png",
|
||||
"ws_dead_tree.png"
|
||||
},
|
||||
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
|
||||
paramtype2 = "facedir",
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
||||
-- dead_tree wood
|
||||
minetest.register_node("ws_core:wood", {
|
||||
description = S("Dead Wood"),
|
||||
tiles = {"ws_wood.png"},
|
||||
is_ground_content = false,
|
||||
groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
|
||||
})
|
||||
|
||||
--
|
||||
-- Craftitems
|
||||
--
|
||||
|
||||
--
|
||||
-- Recipes
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ws_core:wood 4",
|
||||
recipe = {{"ws_core:trunk"}}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "ws_core:trunk",
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "ws_core:wood",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
--Stairs
|
||||
|
||||
if minetest.get_modpath("stairs") ~= nil then
|
||||
stairs.register_stair_and_slab(
|
||||
"dead_tree_trunk",
|
||||
"ws_core:trunk",
|
||||
{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||
{"dead_tree_wood.png"},
|
||||
S("Clementine Tree Stair"),
|
||||
S("Clementine Tree Slab"),
|
||||
default.node_sound_wood_defaults()
|
||||
)
|
||||
end
|