Update balloon.lua, sum_airship.b3d, and sum_airship_boat.b3d

This commit is contained in:
Sumyjkl 2023-01-11 13:37:49 +11:00
parent 6aa952e2de
commit 3a1e84e2ca
2 changed files with 10 additions and 26 deletions

View file

@ -16,18 +16,9 @@ local ship = {
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.2, 0.5},
hp_max = 3,
visual = "mesh",
mesh = "sum_airship.b3d",
backface_culling = false,
textures = {
"sum_airship_canvas.png", -- balloon
"sum_wood_ash_planks.png", -- cradle
"sum_wood_oak_plank.png", -- lining
"sum_wood_oak_plank.png", -- strut
"sum_wood_oak_plank.png", -- strut
"sum_airship_canvas.png", -- burner
"sum_wood_oak_plank.png", -- small strut
"sum_wood_oak_plank.png", -- small strut
},
mesh = "sum_airship.b3d",
textures = {"sum_airship_texture.png"},
on_rightclick = me.on_rightclick,
on_activate = me.on_activate,
get_staticdata = me.get_staticdata,
@ -36,7 +27,7 @@ local ship = {
_driver = nil,
_removed = false,
_flags = {},
_itemstring = "sum_airship:balloon_item",
_itemstring = "sum_airship:boat",
}
function me.on_activate(self, staticdata, dtime_s)
@ -113,8 +104,8 @@ end
-- this system ensures collision kind of works with balloons.
-- does not include entity to entity collisions
local balloon = {}
balloon.offset = 4.5
balloon.length = 3
balloon.offset = 6
balloon.length = 3.5
balloon.height = 2.5
local balloon_nodes = {}
balloon_nodes[0] = { -- top
@ -152,13 +143,6 @@ function me.get_balloon_collide(self)
local o = self.object:get_pos()
for _, check in pairs(balloon_nodes) do
local n = minetest.get_node(vector.add(check.p, o))
-- minetest.add_particle({
-- pos = vector.add(o, check.p),
-- velocity = vector.new(0, 1, 0),
-- expirationtime = math.random(0.5, 2),
-- size = math.random(0.1, 4),
-- texture = "sum_wood_ash_planks.png",
-- })
if n and minetest.registered_nodes[n.name]
and minetest.registered_nodes[n.name].walkable then
force = vector.add(force, check.dir)
@ -246,11 +230,11 @@ function me.on_step(self, dtime, moveresult)
end
minetest.register_entity("sum_airship:balloon_ENTITY", ship)
minetest.register_entity("sum_airship:boat", ship)
minetest.register_craftitem("sum_airship:balloon_item", {
description = "Hot air balloon",
inventory_image = "sum_airship_item.png",
minetest.register_craftitem("sum_airship:boat", {
description = "Airship",
inventory_image = "sum_airship.png",
groups = { vehicle = 1, airship = 1, transport = 1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
@ -263,7 +247,7 @@ minetest.register_craftitem("sum_airship:balloon_item", {
end
end
local pos = vector.offset(pointed_thing.above, 0, 0.5, 0)
local self = minetest.add_entity(pos, "sum_airship:balloon_ENTITY"):get_luaentity()
local self = minetest.add_entity(pos, "sum_airship:boat"):get_luaentity()
if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item()
end