Compare commits

..

2 Commits

Author SHA1 Message Date
loosewheel
9519eae026 Add files via upload 2022-01-20 17:58:09 +10:00
loosewheel
5caa7b6408 Add files via upload 2022-01-08 20:03:32 +10:00
4 changed files with 27 additions and 12 deletions

View File

@@ -87,3 +87,11 @@ v0.1.14
v0.1.15 v0.1.15
* Fixed bug call to clear_map in fan on_blast. * Fixed bug call to clear_map in fan on_blast.
* Added pistons. * Added pistons.
v0.1.16
* Fixed piston interaction with non-walkable nodes.
v0.1.17
* Fixed unintended global variable in pistons.lua.

View File

@@ -1,4 +1,4 @@
local version = "0.1.15" local version = "0.1.17"
local mod_storage = minetest.get_mod_storage () local mod_storage = minetest.get_mod_storage ()

View File

@@ -52,7 +52,7 @@ local function push_entities (pos, vec)
if tnode.name == "air" then if tnode.name == "air" then
can_move = true can_move = true
else else
tdef = utils.find_item_def (tnode.name) local tdef = utils.find_item_def (tnode.name)
can_move = tdef and not tdef.walkable can_move = tdef and not tdef.walkable
end end
@@ -94,7 +94,9 @@ local function push_nodes (pos, extent)
return false return false
end end
if tnode.name == "air" then local tdef = utils.find_item_def (tnode.name)
if tnode.name == "air" or (tdef and not tdef.walkable) then
count = i - 1 count = i - 1
break break
end end
@@ -150,8 +152,10 @@ local function pull_node (pos, extent)
local vec = direction_vector (node) local vec = direction_vector (node)
local cpos = vector.add (pos, vector.multiply (vec, extent)) local cpos = vector.add (pos, vector.multiply (vec, extent))
local cnode = utils.get_far_node (cpos) local cnode = utils.get_far_node (cpos)
local cdef = cnode and utils.find_item_def (cnode.name)
if cnode and cnode.name ~= "air" and cdef and cdef.walkable then
if cnode and cnode ~= "air" then
local cmeta = minetest.get_meta (cpos) local cmeta = minetest.get_meta (cpos)
if cmeta then if cmeta then
@@ -182,8 +186,11 @@ local function place_blank (pos, extent)
local vec = direction_vector (node) local vec = direction_vector (node)
local blank_pos = vector.add (pos, vector.multiply (vec, extent)) local blank_pos = vector.add (pos, vector.multiply (vec, extent))
local blank_node = utils.get_far_node (blank_pos) local blank_node = utils.get_far_node (blank_pos)
local blank_def = blank_node and utils.find_item_def (blank_node.name)
if blank_node and blank_node.name == "air" or
(blank_def and not blank_def.walkable) then
if blank_node and blank_node.name == "air" then
minetest.set_node (blank_pos, minetest.set_node (blank_pos,
{ {
name = "lwcomponents:piston_blank_"..tostring (extent), name = "lwcomponents:piston_blank_"..tostring (extent),
@@ -680,7 +687,7 @@ minetest.register_node("lwcomponents:piston_blank_2", {
minetest.register_node("lwcomponents:piston", { minetest.register_node("lwcomponents:piston", {
description = S("Piston"), description = S("Double Piston"),
tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png", tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png",
"lwcomponents_piston_right.png", "lwcomponents_piston_left.png", "lwcomponents_piston_right.png", "lwcomponents_piston_left.png",
"lwcomponents_piston_base.png", "lwcomponents_piston_pusher.png" }, "lwcomponents_piston_base.png", "lwcomponents_piston_pusher.png" },
@@ -710,7 +717,7 @@ minetest.register_node("lwcomponents:piston", {
minetest.register_node("lwcomponents:piston_1", { minetest.register_node("lwcomponents:piston_1", {
description = S("Piston"), description = S("Double Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_normal_1.obj", mesh = "piston_normal_1.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -757,7 +764,7 @@ minetest.register_node("lwcomponents:piston_1", {
minetest.register_node("lwcomponents:piston_2", { minetest.register_node("lwcomponents:piston_2", {
description = S("Piston"), description = S("Double Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_normal_2.obj", mesh = "piston_normal_2.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -804,7 +811,7 @@ minetest.register_node("lwcomponents:piston_2", {
minetest.register_node("lwcomponents:piston_sticky", { minetest.register_node("lwcomponents:piston_sticky", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png", tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png",
"lwcomponents_piston_right.png", "lwcomponents_piston_left.png", "lwcomponents_piston_right.png", "lwcomponents_piston_left.png",
"lwcomponents_piston_base.png", "lwcomponents_piston_pusher_sticky.png" }, "lwcomponents_piston_base.png", "lwcomponents_piston_pusher_sticky.png" },
@@ -834,7 +841,7 @@ minetest.register_node("lwcomponents:piston_sticky", {
minetest.register_node("lwcomponents:piston_sticky_1", { minetest.register_node("lwcomponents:piston_sticky_1", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_sticky_1.obj", mesh = "piston_sticky_1.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -881,7 +888,7 @@ minetest.register_node("lwcomponents:piston_sticky_1", {
minetest.register_node("lwcomponents:piston_sticky_2", { minetest.register_node("lwcomponents:piston_sticky_2", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_sticky_2.obj", mesh = "piston_sticky_2.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },

View File

@@ -13,7 +13,7 @@ CC BY-SA 3.0
Version Version
======= =======
0.1.15 0.1.17
Minetest Version Minetest Version