mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-26 09:03:46 +01:00
Straight ahead tubes can be placed my means of the "sneak" button
This commit is contained in:
parent
6aaf32e18a
commit
2437f3ae09
@ -1,6 +1,18 @@
|
||||
# Release Notes of the ModPack TechPack [techpack]
|
||||
|
||||
|
||||
|
||||
## V1.16.1 (2018-09-21)
|
||||
|
||||
|
||||
### Additions
|
||||
- Straight ahead tubes can be placed my means of the "sneak" button
|
||||
|
||||
### Fixes
|
||||
- Minor tube placing bug fixed
|
||||
|
||||
|
||||
|
||||
## V1.16 (2018-09-20)
|
||||
|
||||
### Changes
|
||||
|
@ -217,7 +217,7 @@ end
|
||||
function smartline.formspecNotes(meta)
|
||||
local running = meta:get_int("state") == tubelib.RUNNING
|
||||
local cmnd = running and "stop;Stop" or "start;Start"
|
||||
local notes = meta:get_string("notes")
|
||||
local notes = meta:get_string("notes") or ""
|
||||
if notes == "" then notes = "<space for your notes>" end
|
||||
notes = minetest.formspec_escape(notes)
|
||||
return SIZE..
|
||||
|
@ -58,6 +58,7 @@ end
|
||||
|
||||
-- Convertion of 'dir' (view from the outside to inside and vs)
|
||||
local Turn180Deg = {3,4,1,2,6,5}
|
||||
local Turn90Deg = {2,3,4,5,6,1}
|
||||
|
||||
local Dir2Offset = {
|
||||
{x=0, y=0, z=1},
|
||||
@ -227,10 +228,12 @@ local function update_next_tube(dir, pos)
|
||||
local conn1 = is_connected(pos, dir1) or is_known_node(pos, dir1)
|
||||
local conn2 = is_connected(pos, dir2) or is_known_node(pos, dir2)
|
||||
-- already connected or no tube arround?
|
||||
if conn1 == conn2 then
|
||||
if (conn1 and conn2) or (not dir1 and not dir2) then
|
||||
return
|
||||
end
|
||||
if conn1 then
|
||||
elseif not conn1 and not conn2 then
|
||||
dir1 = Turn90Deg[dir1]
|
||||
dir2 = Turn180Deg[dir1]
|
||||
elseif conn1 then
|
||||
dir2 = Turn180Deg[dir]
|
||||
else
|
||||
dir1 = Turn180Deg[dir]
|
||||
@ -267,7 +270,7 @@ local function update_tube(pos, dir)
|
||||
swap_node(pos, node_num, param2)
|
||||
end
|
||||
|
||||
function tubelib.update_tubes(pos, dir)
|
||||
function tubelib.update_tubes(pos, dir, straight_ahead)
|
||||
-- Update all tubes arround the currently placed tube
|
||||
update_next_tube(1, {x=pos.x , y=pos.y , z=pos.z+1})
|
||||
update_next_tube(2, {x=pos.x+1, y=pos.y , z=pos.z })
|
||||
@ -275,8 +278,10 @@ function tubelib.update_tubes(pos, dir)
|
||||
update_next_tube(4, {x=pos.x-1, y=pos.y , z=pos.z })
|
||||
update_next_tube(5, {x=pos.x , y=pos.y-1, z=pos.z })
|
||||
update_next_tube(6, {x=pos.x , y=pos.y+1, z=pos.z })
|
||||
if not straight_ahead then
|
||||
-- Update the placed tube
|
||||
update_tube(pos, dir)
|
||||
end
|
||||
return tubelib.delete_meta_data(pos, minetest.get_node(pos)) < MAX_TUBE_LENGTH
|
||||
end
|
||||
|
||||
|
@ -174,14 +174,15 @@ for idx,pos in ipairs(DirCorrections) do
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local res
|
||||
local pitch = placer:get_look_pitch()
|
||||
local straight_ahead = placer:get_player_control().sneak
|
||||
if pitch > 1 then
|
||||
res = tubelib.update_tubes(pos, 6)
|
||||
res = tubelib.update_tubes(pos, 6, straight_ahead)
|
||||
elseif pitch < -1 then
|
||||
res = tubelib.update_tubes(pos, 5)
|
||||
res = tubelib.update_tubes(pos, 5, straight_ahead)
|
||||
else
|
||||
local dir = placer:get_look_dir()
|
||||
local facedir = minetest.dir_to_facedir(dir)
|
||||
res = tubelib.update_tubes(pos, facedir + 1)
|
||||
res = tubelib.update_tubes(pos, facedir + 1, straight_ahead)
|
||||
end
|
||||
if res == false then
|
||||
tubelib.delete_meta_data(pos, minetest.get_node(pos))
|
||||
|
Loading…
Reference in New Issue
Block a user