mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-09 02:50:20 +02:00
Add protection testing to the Piston and Movestones.
This commit is contained in:
@ -80,7 +80,7 @@ local piston_on = function(pos, node)
|
||||
local dir = piston_get_direction(pistonspec.dir, node)
|
||||
local np = vector.add(pos, dir)
|
||||
local maxpush = mesecon.setting("piston_max_push", 15)
|
||||
local success, stack, oldstack = mesecon.mvps_push(np, dir, maxpush)
|
||||
local success, stack, oldstack = mesecon.mvps_push(pos, np, dir, maxpush)
|
||||
if success then
|
||||
minetest.set_node(pos, {param2 = node.param2, name = pistonspec.onname})
|
||||
minetest.set_node(np, {param2 = node.param2, name = pistonspec.pusher})
|
||||
@ -103,7 +103,7 @@ local piston_off = function(pos, node)
|
||||
local maxpull = mesecon.setting("piston_max_pull", 15)
|
||||
local dir = piston_get_direction(pistonspec.dir, node)
|
||||
local pullpos = vector.add(pos, vector.multiply(dir, 2))
|
||||
local stack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), maxpull)
|
||||
local stack = mesecon.mvps_pull_single(pos, pullpos, vector.multiply(dir, -1), maxpull)
|
||||
mesecon.mvps_process_stack(pos, dir, stack)
|
||||
end
|
||||
end
|
||||
@ -112,6 +112,9 @@ local piston_orientate = function(pos, placer)
|
||||
-- not placed by player
|
||||
if not placer then return end
|
||||
|
||||
minetest.get_meta(pos):set_string("owner", placer:get_player_name())
|
||||
minetest.get_meta(pos):set_string("infotext", "Piston (owned by "..placer:get_player_name()..")")
|
||||
|
||||
-- placer pitch in degrees
|
||||
local pitch = placer:get_look_pitch() * (180 / math.pi)
|
||||
|
||||
|
Reference in New Issue
Block a user