limit mob names to 64 chars, update mount lib to new 0.4.15 functions

master
TenPlus1 2017-03-02 20:41:45 +00:00
parent 8d8779da2f
commit 18d42f2285
2 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -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