mirror of
https://codeberg.org/SumianVoice/sum_airship.git
synced 2025-03-22 15:42:21 +00:00
Update balloon.lua, sum_airship.b3d, and sum_airship_boat.b3d
This commit is contained in:
parent
6aa952e2de
commit
3a1e84e2ca
2 changed files with 10 additions and 26 deletions
36
balloon.lua
36
balloon.lua
|
@ -16,18 +16,9 @@ local ship = {
|
||||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.2, 0.5},
|
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.2, 0.5},
|
||||||
hp_max = 3,
|
hp_max = 3,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "sum_airship.b3d",
|
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
textures = {
|
mesh = "sum_airship.b3d",
|
||||||
"sum_airship_canvas.png", -- balloon
|
textures = {"sum_airship_texture.png"},
|
||||||
"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
|
|
||||||
},
|
|
||||||
on_rightclick = me.on_rightclick,
|
on_rightclick = me.on_rightclick,
|
||||||
on_activate = me.on_activate,
|
on_activate = me.on_activate,
|
||||||
get_staticdata = me.get_staticdata,
|
get_staticdata = me.get_staticdata,
|
||||||
|
@ -36,7 +27,7 @@ local ship = {
|
||||||
_driver = nil,
|
_driver = nil,
|
||||||
_removed = false,
|
_removed = false,
|
||||||
_flags = {},
|
_flags = {},
|
||||||
_itemstring = "sum_airship:balloon_item",
|
_itemstring = "sum_airship:boat",
|
||||||
}
|
}
|
||||||
|
|
||||||
function me.on_activate(self, staticdata, dtime_s)
|
function me.on_activate(self, staticdata, dtime_s)
|
||||||
|
@ -113,8 +104,8 @@ end
|
||||||
-- this system ensures collision kind of works with balloons.
|
-- this system ensures collision kind of works with balloons.
|
||||||
-- does not include entity to entity collisions
|
-- does not include entity to entity collisions
|
||||||
local balloon = {}
|
local balloon = {}
|
||||||
balloon.offset = 4.5
|
balloon.offset = 6
|
||||||
balloon.length = 3
|
balloon.length = 3.5
|
||||||
balloon.height = 2.5
|
balloon.height = 2.5
|
||||||
local balloon_nodes = {}
|
local balloon_nodes = {}
|
||||||
balloon_nodes[0] = { -- top
|
balloon_nodes[0] = { -- top
|
||||||
|
@ -152,13 +143,6 @@ function me.get_balloon_collide(self)
|
||||||
local o = self.object:get_pos()
|
local o = self.object:get_pos()
|
||||||
for _, check in pairs(balloon_nodes) do
|
for _, check in pairs(balloon_nodes) do
|
||||||
local n = minetest.get_node(vector.add(check.p, o))
|
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]
|
if n and minetest.registered_nodes[n.name]
|
||||||
and minetest.registered_nodes[n.name].walkable then
|
and minetest.registered_nodes[n.name].walkable then
|
||||||
force = vector.add(force, check.dir)
|
force = vector.add(force, check.dir)
|
||||||
|
@ -246,11 +230,11 @@ function me.on_step(self, dtime, moveresult)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_entity("sum_airship:balloon_ENTITY", ship)
|
minetest.register_entity("sum_airship:boat", ship)
|
||||||
|
|
||||||
minetest.register_craftitem("sum_airship:balloon_item", {
|
minetest.register_craftitem("sum_airship:boat", {
|
||||||
description = "Hot air balloon",
|
description = "Airship",
|
||||||
inventory_image = "sum_airship_item.png",
|
inventory_image = "sum_airship.png",
|
||||||
groups = { vehicle = 1, airship = 1, transport = 1},
|
groups = { vehicle = 1, airship = 1, transport = 1},
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
|
@ -263,7 +247,7 @@ minetest.register_craftitem("sum_airship:balloon_item", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pos = vector.offset(pointed_thing.above, 0, 0.5, 0)
|
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
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue