master #4

Merged
AliasAlreadyTaken merged 8 commits from master into yl_stable 2025-04-04 09:44:38 +02:00
Showing only changes of commit 65e1e684d3 - Show all commits

View File

@ -27,35 +27,51 @@ local function create_shared_environment(player_name)
end, end,
my_pos = function() my_pos = function()
local me = core.get_player_by_name(player_name) local me = core.get_player_by_name(player_name)
local pos = vector.zero() -- FIXME use last command position local pos = vector.zero() -- FIXME use last command position?
if me:is_player() then if me and me:is_player() then
pos = me:get_pos() pos = me:get_pos()
end end
return pos return pos
end, end,
point = function() point = function()
local me = core.get_player_by_name(player_name) local me = core.get_player_by_name(player_name)
local pointed_thing = util.raycast_crosshair(me, 200, true, false) if me then
if pointed_thing then local pointed_thing = util.raycast_crosshair(me, 200, true, false)
return pointed_thing.intersection_point if pointed_thing then
return pointed_thing.intersection_point
end
return me:get_pos()
end end
return me:get_pos()
end, end,
this_obj = function() this_obj = function()
local me = core.get_player_by_name(player_name) local me = core.get_player_by_name(player_name)
local pointed_thing = util.raycast_crosshair_to_object(me, 200) if me then
if pointed_thing then local pointed_thing = util.raycast_crosshair_to_object(me, 200)
return pointed_thing.ref if pointed_thing then
return pointed_thing.ref
end
end end
return nil return nil
end, end,
this_node_pos = function() above = function()
local me = core.get_player_by_name(player_name) local me = core.get_player_by_name(player_name)
local pointed_thing = util.raycast_crosshair(me, 200, false, false) if me then
if pointed_thing then local pointed_thing = util.raycast_crosshair(me, 200, false, false)
return pointed_thing.under if pointed_thing then
return pointed_thing.above
end
end end
return vector.round(me:get_pos()) return nil
end,
under = function()
local me = core.get_player_by_name(player_name)
if me then
local pointed_thing = util.raycast_crosshair(me, 200, false, false)
if pointed_thing then
return pointed_thing.under
end
end
return nil
end, end,
help = function() help = function()
local msg = [[ local msg = [[
@ -65,7 +81,8 @@ my_pos -- your position
here -- your position where command was executed at (does not change) here -- your position where command was executed at (does not change)
point -- the exact pos you're pointing with the crosshair point -- the exact pos you're pointing with the crosshair
this_obj -- the obj you're pointing at with the crosshair or nil this_obj -- the obj you're pointing at with the crosshair or nil
this_node_pos -- the node position you're pointing at above -- same as pointed_thing.above of the node you're pointing at or nil
under -- same as pointed_thing.under of the node you're pointing at or nil
global -- actual global environment (same as _G) global -- actual global environment (same as _G)
# Functions: # Functions: