- Fix teleportation: now it teleports player to side of the gate player was lookin...
authorRealBadAngel <mk@realbadangel.pl>
Wed, 17 Jul 2013 18:28:42 +0000 (20:28 +0200)
committerRealBadAngel <mk@realbadangel.pl>
Wed, 17 Jul 2013 18:28:42 +0000 (20:28 +0200)
- Teleportation handles now player look yaw.
- Fix to a bug in gates formspec.

stargate/gate_defs.lua
stargate/stargate_gui.lua

index caca8ca35f36bed23a91282f41ecd8bbf42c32eb..374a05567428fd966320155cde764652fd81b474 100644 (file)
@@ -500,16 +500,23 @@ minetest.register_abm({
                                end
                                if player_name~=owner and gate["type"]=="private" then return end
                                local dir1=gate["destination_dir"]
+                               local dest_angle
                                if dir1 == 0 then
-                                       pos1.z=pos1.z+2
+                                       pos1.z = pos1.z-2
+                                       dest_angle = 180
                                elseif dir1 == 1 then
-                                       pos1.x=pos1.x+2
+                                       pos1.x = pos1.x-2
+                                       dest_angle = 90
                                elseif dir1 == 2 then
-                                       pos1.z=pos1.z-2
+                                       pos1.z=pos1.z+2
+                                       dest_angle = 0
                                elseif dir1 == 3 then
-                                       pos1.x=pos1.x-2
+                                       pos1.x = pos1.x+2
+                                       dest_angle = -90
                                end
+                               print(dump(dir1))
                                object:moveto(pos1,false)
+                               object:set_look_yaw(math.rad(dest_angle))
                                minetest.sound_play("enterEventHorizon", {pos = pos, gain = 1.0,loop = false, max_hear_distance = 72,})
                        end
                end
index 9046e537d1dac5f97022d7c4027f350e62d25489..f96d48afd622c532bd8eb3ba185c92bba453d5d0 100644 (file)
@@ -181,7 +181,7 @@ stargate.get_formspec = function(player_name,page)
        local temp_gate=stargate_network["players"][player_name]["temp_gate"]
        local formspec = "size[14,10]"
        --background
-       formspec = formspec .."background[-0.19,-0.2,;14.38,10.55;ui_form_bg.png]"
+       formspec = formspec .."background[-0.19,-0.2;14.38,10.55;ui_form_bg.png]"
        formspec = formspec.."label[0,0.0;Stargate DHD]"
        formspec = formspec.."label[0,.5;Position: ("..temp_gate["pos"].x..","..temp_gate["pos"].y..","..temp_gate["pos"].z..")]"
        formspec = formspec.."image_button[3.5,.6;.6,.6;toggle_icon.png;toggle_type;]"