mirror of
https://codeberg.org/SumianVoice/sum_airship.git
synced 2025-03-15 04:11:23 +00:00
allow any coal / charcoal to be used as fuel, don't do weird stuff on water
This commit is contained in:
parent
9adbfaa517
commit
20a324d7c8
1 changed files with 13 additions and 7 deletions
20
init.lua
20
init.lua
|
@ -257,7 +257,8 @@ minetest.register_on_respawnplayer(detach_object)
|
|||
function boat.on_rightclick(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
local item_name = item:get_name()
|
||||
if clicker and item_name == "mcl_core:coal_lump" or item_name == "mcl_core:charcoal_lump" then
|
||||
if clicker and (string.find(item_name, ":coal_lump")
|
||||
or string.find(item_name, ":charcoal_lump")) then
|
||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
|
@ -353,9 +354,10 @@ function boat.on_step(self, dtime, moveresult)
|
|||
self._v = get_v(self.object:get_velocity()) * get_sign(self._v)
|
||||
local v_factor = 1
|
||||
local v_slowdown = 0.1
|
||||
local v = self.object:get_velocity()
|
||||
local p = self.object:get_pos()
|
||||
local on_water = false
|
||||
local in_water = minetest.get_item_group(minetest.get_node(p).name, "liquid") ~= 0
|
||||
local on_water = (minetest.get_item_group(minetest.get_node(vector.offset(p, 0, -0.2, 0)).name, "liquid") ~= 0 and not in_water)
|
||||
local node_below = minetest.get_node(vector.offset(p, 0, -0.3, 0)).name
|
||||
local is_on_floor = minetest.registered_nodes[node_below].walkable
|
||||
|
||||
|
@ -463,7 +465,7 @@ function boat.on_step(self, dtime, moveresult)
|
|||
self.object:set_rotation(vector.new(anim, yaw, anim))
|
||||
|
||||
local vel = vector.new(0, 0, 0)
|
||||
if not in_water then
|
||||
if true then
|
||||
local speed = sum_airship.speed_mult
|
||||
if self._fuel > 0 then
|
||||
self._fuel = self._fuel - dtime
|
||||
|
@ -472,10 +474,15 @@ function boat.on_step(self, dtime, moveresult)
|
|||
dir = vector.multiply(yaw_dir, forward)
|
||||
dir.y = climb
|
||||
vel = vector.multiply(dir, speed)
|
||||
elseif in_water then
|
||||
if not self._driver then
|
||||
vel.y = vel.y - 0.6
|
||||
end
|
||||
end
|
||||
if in_water then
|
||||
vel = {x=0, y=5, z=0}
|
||||
else
|
||||
vel = {x=0, y=-0.6, z=0}
|
||||
elseif on_water and not self._driver then
|
||||
vel = {x=0, y=0, z=0}
|
||||
v = {x=0, y=0, z=0}
|
||||
end
|
||||
|
||||
local wind_vel = vector.new(0,0,0)
|
||||
|
@ -486,7 +493,6 @@ function boat.on_step(self, dtime, moveresult)
|
|||
end
|
||||
end
|
||||
|
||||
local v = self.object:get_velocity()
|
||||
local slowdown = 0.983
|
||||
if forward == 0 then
|
||||
slowdown = 0.97
|
||||
|
|
Loading…
Add table
Reference in a new issue