Add files via upload

This commit is contained in:
Gerold55 2019-03-11 22:45:57 -04:00 committed by GitHub
parent 9b518ec6a4
commit 69fc282ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 378 additions and 136 deletions

15
mods/bucket/README.txt Normal file
View File

@ -0,0 +1,15 @@
Minetest mod: wooden bucket
===========================
See license.txt for license information.
Authors of source code
----------------------
Hume2 <teratux.mail@gmail.com> (LGPL 2.1)
Kahrl <kahrl@gmx.net> (LGPL 2.1)
celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
Various Minetest developers and contributors (LGPL 2.1)
Authors of media (textures)
---------------------------
Hume2 <teratux.mail@gmail.com> (CC BY-SA 3.0)
ElementW (CC BY-SA 3.0)

1
mods/bucket/depends.txt Normal file
View File

@ -0,0 +1 @@
ws_core

215
mods/bucket/init.lua Normal file
View File

@ -0,0 +1,215 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'group:wood', '', 'group:wood'},
{'', 'group:wood', ''},
}
})
if minetest.registered_items["farming:bowl"] then
minetest.register_craft({
output = 'farming:bowl 4',
recipe = {'bucket:bucket_empty'},
type = 'shapeless',
})
end
if minetest.registered_items["ethereal:bowl"] then
minetest.register_craft({
output = 'ethereal:bowl 4',
recipe = {'bucket:bucket_empty'},
type = 'shapeless',
})
end
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_empty",
burntime = 22,
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a wooden bucket")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- name = text description of the bucket item
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
-- source neighbour, even if defined as 'liquid_renewable = false'.
-- Needed to avoid creating holes in sloping rivers.
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
groups, force_renew)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
force_renew = force_renew,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
not (user and user:is_player() and
user:get_player_control().sneak) then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack)
end
local lpos
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
lpos = pointed_thing.under
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
lpos = pointed_thing.above
node = minetest.get_node_or_nil(lpos)
local above_ndef = node and minetest.registered_nodes[node.name]
if not above_ndef or not above_ndef.buildable_to then
-- do not remove the bucket with the liquid
return itemstack
end
end
if check_protection(lpos, user
and user:get_player_name()
or "", "place "..source) then
return
end
minetest.set_node(lpos, {name = source})
return ItemStack("bucket:bucket_empty")
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Wooden Bucket",
inventory_image = "bucket_wooden.png",
stack_max = 99,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
return user:get_wielded_item()
elseif pointed_thing.type ~= "node" then
-- do nothing if it's neither object nor node
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count()
if liquiddef ~= nil
and liquiddef.itemname ~= nil
and node.name == liquiddef.source then
if check_protection(pointed_thing.under,
user:get_player_name(),
"take ".. node.name) then
return
end
-- default set to return filled bucket
local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket
if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname)
else
local pos = user:get_pos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end
-- force_renew requires a source neighbour
local source_neighbor = false
if liquiddef.force_renew then
source_neighbor =
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
end
if not (source_neighbor and liquiddef.force_renew) then
minetest.add_node(pointed_thing.under, {name = "air"})
end
return ItemStack(giving_back)
else
-- non-liquid nodes will have their on_punch triggered
local node_def = minetest.registered_nodes[node.name]
if node_def then
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
end
return user:get_wielded_item()
end
end,
})
bucket.register_liquid(
"ws_core:water_source",
"ws_core:water_flowing",
"bucket:bucket_water",
"bucket_wooden_water.png",
"Water Bucket",
{water_bucket = 1}
)
-- River water source is 'liquid_renewable = false' to avoid horizontal spread
-- of water sources in sloping rivers that can cause water to overflow
-- riverbanks and cause floods.
-- River water source is instead made renewable by the 'force renew' option
-- used here.

53
mods/bucket/license.txt Normal file
View File

@ -0,0 +1,53 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2019 Hume2 <teratux.mail@gmail.com>
Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
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)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2019 Hume2 <teratux.mail@gmail.com>
Copyright (C) 2015-2016 ElementW
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/

1
mods/bucket/mod.conf Normal file
View File

@ -0,0 +1 @@
name = bucket

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

View File

@ -167,7 +167,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.slab = 1 new_groups.slab = 1
minetest.register_node(":ws_core:slab_" .. subname, { minetest.register_node(":stairs:slab_" .. subname, {
description = description, description = description,
drawtype = "nodebox", drawtype = "nodebox",
tiles = slab_images, tiles = slab_images,
@ -187,7 +187,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local creative_enabled = (creative and creative.is_enabled_for local creative_enabled = (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) and creative.is_enabled_for(player_name))
if under and under.name:find("^ws_core:slab_") then if under and under.name:find("^stairs:slab_") then
-- place slab using under node orientation -- place slab using under node orientation
local dir = minetest.dir_to_facedir(vector.subtract( local dir = minetest.dir_to_facedir(vector.subtract(
pointed_thing.above, pointed_thing.under), true) pointed_thing.above, pointed_thing.under), true)
@ -216,15 +216,15 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
-- for replace ABM -- for replace ABM
if replace then if replace then
minetest.register_node(":ws_core:slab_" .. subname .. "upside_down", { minetest.register_node(":stairs:slab_" .. subname .. "upside_down", {
replace_name = "ws_core:slab_".. subname, replace_name = "stairs:slab_".. subname,
groups = {slabs_replace = 1}, groups = {slabs_replace = 1},
}) })
end end
if recipeitem then if recipeitem then
minetest.register_craft({ minetest.register_craft({
output = 'ws_core:slab_' .. subname .. ' 6', output = 'stairs:slab_' .. subname .. ' 6',
recipe = { recipe = {
{recipeitem, recipeitem, recipeitem}, {recipeitem, recipeitem, recipeitem},
}, },
@ -234,8 +234,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
minetest.register_craft({ minetest.register_craft({
output = recipeitem, output = recipeitem,
recipe = { recipe = {
{'ws_core:slab_' .. subname}, {'stairs:slab_' .. subname},
{'ws_core:slab_' .. subname}, {'stairs:slab_' .. subname},
}, },
}) })
@ -248,7 +248,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
if baseburntime > 0 then if baseburntime > 0 then
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = 'ws_core:slab_' .. subname, recipe = 'stairs:slab_' .. subname,
burntime = math.floor(baseburntime * 0.5), burntime = math.floor(baseburntime * 0.5),
}) })
end end
@ -257,7 +257,7 @@ end
-- Optionally replace old "upside_down" nodes with new param2 versions. -- Optionally replace old "upside_down" nodes with new param2 versions.
-- Disabled by ws_core. -- Disabled by default.
if replace then if replace then
minetest.register_abm({ minetest.register_abm({
@ -280,9 +280,9 @@ end
-- Register inner stair -- Register inner stair
-- Node will be called ws_core:stair_inner_<subname> -- Node will be called stairs:stair_inner_<subname>
function ws_core.register_stair_inner(subname, recipeitem, groups, images, function stairs.register_stair_inner(subname, recipeitem, groups, images,
description, sounds, worldaligntex) description, sounds, worldaligntex)
-- Set backface culling and world-aligned textures -- Set backface culling and world-aligned textures
local stair_images = {} local stair_images = {}
@ -307,7 +307,7 @@ function ws_core.register_stair_inner(subname, recipeitem, groups, images,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.stair = 1 new_groups.stair = 1
minetest.register_node(":ws_core:stair_inner_" .. subname, { minetest.register_node(":stairs:stair_inner_" .. subname, {
description = "Inner " .. description, description = "Inner " .. description,
drawtype = "nodebox", drawtype = "nodebox",
tiles = stair_images, tiles = stair_images,
@ -335,7 +335,7 @@ function ws_core.register_stair_inner(subname, recipeitem, groups, images,
if recipeitem then if recipeitem then
minetest.register_craft({ minetest.register_craft({
output = 'ws_core:stair_inner_' .. subname .. ' 7', output = 'stairs:stair_inner_' .. subname .. ' 7',
recipe = { recipe = {
{"", recipeitem, ""}, {"", recipeitem, ""},
{recipeitem, "", recipeitem}, {recipeitem, "", recipeitem},
@ -352,7 +352,7 @@ function ws_core.register_stair_inner(subname, recipeitem, groups, images,
if baseburntime > 0 then if baseburntime > 0 then
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = 'ws_core:stair_inner_' .. subname, recipe = 'stairs:stair_inner_' .. subname,
burntime = math.floor(baseburntime * 0.875), burntime = math.floor(baseburntime * 0.875),
}) })
end end
@ -361,9 +361,9 @@ end
-- Register outer stair -- Register outer stair
-- Node will be called ws_core:stair_outer_<subname> -- Node will be called stairs:stair_outer_<subname>
function ws_core.register_stair_outer(subname, recipeitem, groups, images, function stairs.register_stair_outer(subname, recipeitem, groups, images,
description, sounds, worldaligntex) description, sounds, worldaligntex)
-- Set backface culling and world-aligned textures -- Set backface culling and world-aligned textures
local stair_images = {} local stair_images = {}
@ -388,7 +388,7 @@ function ws_core.register_stair_outer(subname, recipeitem, groups, images,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.stair = 1 new_groups.stair = 1
minetest.register_node(":ws_core:stair_outer_" .. subname, { minetest.register_node(":stairs:stair_outer_" .. subname, {
description = "Outer " .. description, description = "Outer " .. description,
drawtype = "nodebox", drawtype = "nodebox",
tiles = stair_images, tiles = stair_images,
@ -415,7 +415,7 @@ function ws_core.register_stair_outer(subname, recipeitem, groups, images,
if recipeitem then if recipeitem then
minetest.register_craft({ minetest.register_craft({
output = 'ws_core:stair_outer_' .. subname .. ' 6', output = 'stairs:stair_outer_' .. subname .. ' 6',
recipe = { recipe = {
{"", recipeitem, ""}, {"", recipeitem, ""},
{recipeitem, recipeitem, recipeitem}, {recipeitem, recipeitem, recipeitem},
@ -431,7 +431,7 @@ function ws_core.register_stair_outer(subname, recipeitem, groups, images,
if baseburntime > 0 then if baseburntime > 0 then
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = 'ws_core:stair_outer_' .. subname, recipe = 'stairs:stair_outer_' .. subname,
burntime = math.floor(baseburntime * 0.625), burntime = math.floor(baseburntime * 0.625),
}) })
end end
@ -440,142 +440,39 @@ end
-- Stair/slab registration function. -- Stair/slab registration function.
-- Nodes will be called ws_core:{stair,slab}_<subname> -- Nodes will be called stairs:{stair,slab}_<subname>
function ws_core.register_stair_and_slab(subname, recipeitem, groups, images, function stairs.register_stair_and_slab(subname, recipeitem, groups, images,
desc_stair, desc_slab, sounds, worldaligntex) desc_stair, desc_slab, sounds, worldaligntex)
ws_core.register_stair(subname, recipeitem, groups, images, desc_stair, stairs.register_stair(subname, recipeitem, groups, images, desc_stair,
sounds, worldaligntex) sounds, worldaligntex)
ws_core.register_stair_inner(subname, recipeitem, groups, images, desc_stair, stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair,
sounds, worldaligntex) sounds, worldaligntex)
ws_core.register_stair_outer(subname, recipeitem, groups, images, desc_stair, stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair,
sounds, worldaligntex) sounds, worldaligntex)
ws_core.register_slab(subname, recipeitem, groups, images, desc_slab, stairs.register_slab(subname, recipeitem, groups, images, desc_slab,
sounds, worldaligntex) sounds, worldaligntex)
end end
-- Register ws_core ws_core and slabs -- Register default stairs and slabs
ws_core.register_stair_and_slab( stairs.register_stair_and_slab(
"wood", "wood",
"ws_core:wood", "ws_core:wood",
{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
{"ws_wood.png"}, {"ws_wood.png"},
"Wooden Stair", "Oak Stair",
"Wooden Slab", "Oak Slab",
false false
) )
stairs.register_stair_and_slab(
ws_core.register_stair_and_slab(
"cobble", "cobble",
"default:cobble", "ws_core:cobble",
{cracky = 3}, {cracky = 3},
{"default_cobble.png"}, {"ws_cobble.png"},
"Cobblestone Stair", "Cobblestone Stair",
"Cobblestone Slab", "Cobblestone Slab",
default.node_sound_stone_defaults(),
true true
)
ws_core.register_stair_and_slab(
"mossycobble",
"ws_core:mossycobble",
{cracky = 3},
{"ws_mossycobble.png"},
"Mossy Cobblestone Stair",
"Mossy Cobblestone Slab",
true
)
ws_core.register_stair_and_slab(
"stonebrick",
"ws_core:stonebrick",
{cracky = 2},
{"ws_stone_brick.png"},
"Stone Brick Stair",
"Stone Brick Slab",
false
)
ws_core.register_stair_and_slab(
"stone_block",
"ws_core:stone_block",
{cracky = 2},
{"ws_stone_block.png"},
"Stone Block Stair",
"Stone Block Slab",
true
)
ws_core.register_stair_and_slab(
"sandstone",
"default:sandstone",
{crumbly = 1, cracky = 3},
{"default_sandstone.png"},
"Sandstone Stair",
"Sandstone Slab",
true
)
ws_core.register_stair_and_slab(
"sandstonebrick",
"default:sandstonebrick",
{cracky = 2},
{"default_sandstone_brick.png"},
"Sandstone Brick Stair",
"Sandstone Brick Slab",
false
)
ws_core.register_stair_and_slab(
"sandstone_block",
"default:sandstone_block",
{cracky = 2},
{"default_sandstone_block.png"},
"Sandstone Block Stair",
"Sandstone Block Slab",
true
)
ws_core.register_stair_and_slab(
"desert_sandstone_block",
"default:desert_sandstone_block",
{cracky = 2},
{"default_desert_sandstone_block.png"},
"Desert Sandstone Block Stair",
"Desert Sandstone Block Slab",
default.node_sound_stone_defaults(),
true
)
ws_core.register_stair_and_slab(
"obsidian",
"ws_core:obsidian",
{cracky = 1, level = 2},
{"ws_obsidian.png"},
"Obsidian Stair",
"Obsidian Slab",
true
)
ws_core.register_stair_and_slab(
"obsidian_block",
"ws_core:obsidian_block",
{cracky = 1, level = 2},
{"ws_obsidian_block.png"},
"Obsidian Block Stair",
"Obsidian Block Slab",
true
)
ws_core.register_stair_and_slab(
"brick",
"ws_core:brick",
{cracky = 3},
{"ws_brick.png"},
"Brick Stair",
"Brick Slab",
false
) )

60
mods/stairs/test.txt Normal file
View File

@ -0,0 +1,60 @@
stairs.register_stair_and_slab(
"mossycobble",
"ws_core:mossycobble",
{cracky = 3},
{"ws_mossycobble.png"},
"Mossy Cobblestone Stair",
"Mossy Cobblestone Slab",
true
)
stairs.register_stair_and_slab(
"stonebrick",
"default:stonebrick",
{cracky = 2},
{"default_stone_brick.png"},
"Stone Brick Stair",
"Stone Brick Slab",
false
)
stairs.register_stair_and_slab(
"sandstone",
"default:sandstone",
{crumbly = 1, cracky = 3},
{"default_sandstone.png"},
"Sandstone Stair",
"Sandstone Slab",
true
)
stairs.register_stair_and_slab(
"sandstonebrick",
"default:sandstonebrick",
{cracky = 2},
{"default_sandstone_brick.png"},
"Sandstone Brick Stair",
"Sandstone Brick Slab",
false
)
stairs.register_stair_and_slab(
"sandstone_block",
"default:sandstone_block",
{cracky = 2},
{"default_sandstone_block.png"},
"Sandstone Block Stair",
"Sandstone Block Slab",
true
)
stairs.register_stair_and_slab(
"brick",
"default:brick",
{cracky = 3},
{"default_brick.png"},
"Brick Stair",
"Brick Slab",
false
)

View File

@ -175,5 +175,5 @@ minetest.register_craftitem("ws_core:coal", {
minetest.register_craftitem("ws_core:iron_lump", { minetest.register_craftitem("ws_core:iron_lump", {
description = "Iron Lump", description = "Iron Lump",
inventory_image = "ws_core_iron_lump.png", inventory_image = "ws_iron_lump.png",
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B