summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-03-02 20:41:45 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2017-03-02 20:41:45 +0000
commit18d42f2285512b62bf81ca180538e0511bad448b (patch)
tree296afb4fb45eef1792f9cab5db02d4f1617f8c62
parent8d8779da2f0d361f45878ea4404a58db04e00b85 (diff)
limit mob names to 64 chars, update mount lib to new 0.4.15 functions
-rw-r--r--api.lua7
-rw-r--r--mount.lua14
2 files changed, 14 insertions, 7 deletions
diff --git a/api.lua b/api.lua
index d8e3624..4403b76 100644
--- a/api.lua
+++ b/api.lua
@@ -1,5 +1,5 @@
--- Mobs Api (24th February 2017)
+-- Mobs Api (2nd March 2017)
mobs = {}
mobs.mod = "redo"
@@ -3383,6 +3383,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
+ -- limit name entered to 64 characters long
+ if string.len(fields.name) > 64 then
+ fields.name = string.sub(fields.name, 1, 64)
+ end
+
-- update nametag
mob_obj[name].nametag = fields.name
diff --git a/mount.lua b/mount.lua
index 0b08613..84874ef 100644
--- a/mount.lua
+++ b/mount.lua
@@ -141,7 +141,8 @@ function mobs.attach(entity, player)
default.player_set_animation(player, "sit" , 30)
end)
- player:set_look_yaw(entity.object:getyaw() - rot_view)
+ --player:set_look_yaw(entity.object:getyaw() - rot_view)
+ player:set_look_horizontal(entity.object:getyaw() - rot_view)
end
@@ -196,10 +197,8 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
entity.v = entity.v - entity.accel / 10
end
- --entity.object:setyaw(entity.driver:get_look_yaw() - rot_steer)
--- entity.object:setyaw(entity.driver:get_look_horizontal())-- - rot_steer)
-
-- fix mob rotation
+-- entity.object:setyaw(entity.driver:get_look_yaw() - entity.rotate)
entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate)
if can_fly then
@@ -376,7 +375,8 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
local ctrl = entity.driver:get_player_control()
local velo = entity.object:getvelocity()
local dir = entity.driver:get_look_dir()
- local yaw = entity.driver:get_look_yaw()
+-- local yaw = entity.driver:get_look_yaw()
+ local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands
local rot_steer, rot_view = math.pi / 2, 0
if entity.player_rotation.y == 90 then
@@ -415,8 +415,10 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
local ent = obj:get_luaentity()
if ent then
ent.switch = 1 -- for mob specific arrows
+ ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding
local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6}
- local yaw = entity.driver:get_look_yaw()
+-- local yaw = entity.driver:get_look_yaw()
+ local yaw = entity.driver:get_look_horizontal()
obj:setyaw(yaw + math.pi / 2)
obj:setvelocity(vec)
else