Compare commits
5 Commits
a3b7ea70f1
...
44713f7c86
Author | SHA1 | Date |
---|---|---|
Piezo_ | 44713f7c86 | |
Piezo_ | 839bae5862 | |
Piezo_ | 13b1b2705d | |
SpaghettiToastBook | b807715238 | |
SpaghettiToastBook | 9f2aef914d |
|
@ -14,4 +14,7 @@ Changes by Piezo_:
|
|||
Added permissions "msp_admin", which allows full control and access to all portals, and "msp_unlimited", which bypasses the portal cap.
|
||||
Portals and all associated nodes are now fully protection-aware.
|
||||
Reorganized/Split up files
|
||||
Position and rotation relative to the portal are now maintained, making travel feel smoother.
|
||||
Position and rotation relative to the portal are now maintained, making travel feel smoother.
|
||||
|
||||
Changes by SpaghettiToastBook:
|
||||
Added meseportals.can_connect
|
|
@ -69,6 +69,12 @@ meseportals.searchportals = function(pos, player_name, isAdmin)
|
|||
|
||||
end
|
||||
|
||||
-- Mods can override this to restict portal connections.
|
||||
-- Admins ignore this.
|
||||
meseportals.can_connect = function(src_portal, dest_portal)
|
||||
return dest_portal["destination"] == nil, "Destination portal is busy."
|
||||
end
|
||||
|
||||
--show formspec to player
|
||||
meseportals.portalFormspecHandler = function(pos, _, clicker, _)
|
||||
if (meseportals.findPortal(pos) ~= nil) then
|
||||
|
@ -412,7 +418,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
|
||||
if meseportals.findPortal(current_portal["destination"]) then
|
||||
local dest_portal = meseportals.findPortal(current_portal["destination"])
|
||||
if dest_portal["destination"] == nil or isAdmin then
|
||||
local can_connect, fail_reason = meseportals.can_connect(table.copy(current_portal), table.copy(dest_portal))
|
||||
if can_connect or isAdmin then
|
||||
dest_portal.admin_lock = current_portal.admin_lock
|
||||
-- Connecting to a portal, its locked state becomes the same as this portal.
|
||||
if dest_portal["destination"] then --Admin can interrupt any existing connection
|
||||
|
@ -425,7 +432,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
meseportals.activatePortal (dest_portal.pos)
|
||||
current_portal["time"] = meseportals.close_after
|
||||
else
|
||||
minetest.chat_send_player(player_name, "Connection failed: Portal is busy.")
|
||||
if fail_reason then
|
||||
minetest.chat_send_player(player_name, "Connection failed: " .. fail_reason)
|
||||
else
|
||||
minetest.chat_send_player(player_name, "Connection failed.")
|
||||
end
|
||||
|
||||
meseportals.deactivatePortal (current_portal["pos"])
|
||||
end
|
||||
else
|
||||
|
|
|
@ -134,7 +134,6 @@ minetest.register_globalstep(function(dtime)
|
|||
pos1.x = pos1.x+1.25
|
||||
pos1.z = pos1.z - hdiff
|
||||
end
|
||||
object:set_pos(pos1)
|
||||
local vel = object:get_velocity() or object:get_player_velocity()
|
||||
vel.x = -vel.x
|
||||
local magnitude = math.sqrt((vel.x*vel.x) + (vel.z*vel.z))
|
||||
|
@ -149,16 +148,26 @@ minetest.register_globalstep(function(dtime)
|
|||
direction = direction + math.pi + ((dir1 - dir) * -(math.pi/2))
|
||||
vel.x = magnitude * -math.sin(direction)
|
||||
vel.z = magnitude * math.cos(direction)
|
||||
local moved = false
|
||||
if object:is_player() then
|
||||
--player:set_player_velocity(vel) -- TODO: Bother the devs more about this
|
||||
object:set_look_horizontal(dest_angle)
|
||||
minetest.sound_play("meseportal_warp", {to_player=object:get_player_name(), gain=0.6, max_hear_distance=15})
|
||||
else
|
||||
object:set_velocity(vel)
|
||||
object:set_yaw(dest_angle)
|
||||
object:set_pos(pos1)
|
||||
if vector.equals(vector.round(object:get_pos()), vector.round(pos1)) then moved = true end
|
||||
elseif object:get_properties().physical == true then
|
||||
object:set_pos(pos1)
|
||||
moved = true
|
||||
end
|
||||
if moved then
|
||||
if object:is_player() then
|
||||
--player:set_player_velocity(vel) -- TODO: Bother the devs more about this
|
||||
object:set_look_horizontal(dest_angle)
|
||||
minetest.sound_play("meseportal_warp", {to_player=object:get_player_name(), gain=0.6, max_hear_distance=15})
|
||||
else
|
||||
object:set_velocity(vel)
|
||||
object:set_yaw(dest_angle)
|
||||
end
|
||||
minetest.sound_play("meseportal_warp", {pos = pos, gain=0.6, max_hear_distance=15})
|
||||
minetest.sound_play("meseportal_warp", {pos = pos1, gain=0.6, max_hear_distance=15})
|
||||
end
|
||||
minetest.sound_play("meseportal_warp", {pos = pos, gain=0.6, max_hear_distance=15})
|
||||
minetest.sound_play("meseportal_warp", {pos = pos1, gain=0.6, max_hear_distance=15})
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -14,7 +14,7 @@ minetest.register_node("meseportals:portal_collider",{
|
|||
drawtype = "airlike",
|
||||
on_blast = function() end,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1,fragile=2},
|
||||
groups = {not_in_creative_inventory=1,immovable=2},
|
||||
sunlight_propagates = true,
|
||||
can_dig = false,
|
||||
paramtype = "light",
|
||||
|
@ -167,8 +167,8 @@ local msp_selection_box = {
|
|||
fixed={{-2.5,-1.5,-0.2,2.5,3.5,0.2},},
|
||||
}
|
||||
|
||||
local msp_groups = {cracky=2,not_in_creative_inventory=1,fragile=2}
|
||||
local msp_groups1 = {cracky=2,fragile=2}
|
||||
local msp_groups = {cracky=2,not_in_creative_inventory=1,immovable=2}
|
||||
local msp_groups1 = {cracky=2,immovabl=2}
|
||||
|
||||
|
||||
local old_pttfp = minetest.pointed_thing_to_face_pos
|
||||
|
@ -299,6 +299,7 @@ local basecheck = { --f = face (x or z axis)
|
|||
{x=0, z=-2, f=2},
|
||||
}
|
||||
minetest.is_protected = function(pos, player, ...) --Protect the bottom of the portal
|
||||
if not pos then return end
|
||||
local pos1 = vector.new(pos.x, pos.y + 1, pos.z) --Allocate
|
||||
local portal
|
||||
for _,pos2 in pairs(basecheck) do
|
||||
|
|
Loading…
Reference in New Issue