mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 02:00:21 +01:00
limit mob names to 64 chars, update mount lib to new 0.4.15 functions
This commit is contained in:
parent
8d8779da2f
commit
18d42f2285
7
api.lua
7
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (24th February 2017)
|
-- Mobs Api (2nd March 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -3383,6 +3383,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
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
|
-- update nametag
|
||||||
mob_obj[name].nametag = fields.name
|
mob_obj[name].nametag = fields.name
|
||||||
|
|
||||||
|
14
mount.lua
14
mount.lua
@ -141,7 +141,8 @@ function mobs.attach(entity, player)
|
|||||||
default.player_set_animation(player, "sit" , 30)
|
default.player_set_animation(player, "sit" , 30)
|
||||||
end)
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -196,10 +197,8 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||||||
entity.v = entity.v - entity.accel / 10
|
entity.v = entity.v - entity.accel / 10
|
||||||
end
|
end
|
||||||
|
|
||||||
--entity.object:setyaw(entity.driver:get_look_yaw() - rot_steer)
|
|
||||||
-- entity.object:setyaw(entity.driver:get_look_horizontal())-- - rot_steer)
|
|
||||||
|
|
||||||
-- fix mob rotation
|
-- fix mob rotation
|
||||||
|
-- entity.object:setyaw(entity.driver:get_look_yaw() - entity.rotate)
|
||||||
entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate)
|
entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate)
|
||||||
|
|
||||||
if can_fly then
|
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 ctrl = entity.driver:get_player_control()
|
||||||
local velo = entity.object:getvelocity()
|
local velo = entity.object:getvelocity()
|
||||||
local dir = entity.driver:get_look_dir()
|
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
|
local rot_steer, rot_view = math.pi / 2, 0
|
||||||
|
|
||||||
if entity.player_rotation.y == 90 then
|
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()
|
local ent = obj:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
ent.switch = 1 -- for mob specific arrows
|
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 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:setyaw(yaw + math.pi / 2)
|
||||||
obj:setvelocity(vec)
|
obj:setvelocity(vec)
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user