mirror of
https://github.com/APercy/ap_airship.git
synced 2025-03-14 23:41:21 +00:00
fixes and priv to anchor added
This commit is contained in:
parent
9c2b1a84cc
commit
232f5df95f
3 changed files with 16 additions and 4 deletions
10
entities.lua
10
entities.lua
|
@ -106,7 +106,7 @@ local function right_click_controls(self, clicker)
|
|||
if ship_self.owner == "" then
|
||||
ship_self.owner = name
|
||||
end
|
||||
|
||||
local can_bypass = minetest.check_player_privs(clicker, {protection_bypass=true})
|
||||
if ship_self.driver_name ~= nil and ship_self.driver_name ~= "" then
|
||||
--shows pilot formspec
|
||||
if name == ship_self.driver_name then
|
||||
|
@ -556,6 +556,12 @@ minetest.register_entity("ap_airship:airship", {
|
|||
accel.y = accel_y
|
||||
|
||||
newpitch = velocity.y * math.rad(1.5) * (longit_speed/3)
|
||||
|
||||
local noded = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-4.5}))
|
||||
if (noded and noded.drawtype ~= 'airlike') or self.isonground then
|
||||
newpitch = 0
|
||||
end
|
||||
|
||||
self.object:set_acceleration(accel)
|
||||
self.object:set_rotation({x=newpitch,y=newyaw,z=newroll})
|
||||
|
||||
|
@ -567,7 +573,7 @@ minetest.register_entity("ap_airship:airship", {
|
|||
self.object:set_bone_position("timao", {x=0,y=-22.562,z=176.018}, {x=0,y=0,z=self._rudder_angle*8})
|
||||
self.object:set_bone_position("compass_axis", {x=0,y=-21.8,z=178.757}, {x=0, y=S_angle, z=0})
|
||||
|
||||
local noded = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-3.7}))
|
||||
noded = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-3.7}))
|
||||
if (noded and noded.drawtype ~= 'airlike') or self.isonground then
|
||||
self.object:set_bone_position("door", {x=0,y=-13.1266,z=54.1922}, {x=-18,y=0,z=0})
|
||||
else
|
||||
|
|
|
@ -229,8 +229,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.anchor == "true" then
|
||||
local max_speed_anchor = 0.6
|
||||
if ent._longit_speed then
|
||||
local is_admin = minetest.check_player_privs(player, {server=true}) --force stop by admins
|
||||
if (math.abs(ent._longit_speed) < max_speed_anchor and ent.isonground) or is_admin then
|
||||
local can_anchor = minetest.check_player_privs(player, {ap_airship_anchor=true}) --force stop
|
||||
if (math.abs(ent._longit_speed) < max_speed_anchor and ent.isonground) or can_anchor then
|
||||
ent.anchored = true
|
||||
ent.object:set_acceleration(vector.new())
|
||||
ent.object:set_velocity(vector.new())
|
||||
|
|
6
init.lua
6
init.lua
|
@ -100,6 +100,12 @@ function ap_airship.minmax(v,m)
|
|||
return math.min(math.abs(v),m)*ap_airship.sign(v)
|
||||
end
|
||||
|
||||
|
||||
minetest.register_privilege("ap_airship_anchor", {
|
||||
description = "The player can anchor the airship anywhere in any speed",
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
-----------
|
||||
-- items
|
||||
-----------
|
||||
|
|
Loading…
Add table
Reference in a new issue