Lightcycle and api changes
This commit is contained in:
parent
9622d356bd
commit
40b2d8ccb6
31
api.lua
31
api.lua
@ -135,6 +135,11 @@ function vehicles.object_drive(entity, dtime, def)
|
|||||||
local driving_sound = def.driving_sound or nil
|
local driving_sound = def.driving_sound or nil
|
||||||
local sound_duration = def.sound_duration or 5
|
local sound_duration = def.sound_duration or 5
|
||||||
local extra_yaw = def.extra_yaw or 0
|
local extra_yaw = def.extra_yaw or 0
|
||||||
|
local death_node = def.death_node or nil
|
||||||
|
local destroy_node = def.destroy_node or nil
|
||||||
|
local place_node = def.place_node or nil
|
||||||
|
local place_chance = def.place_chance or 1
|
||||||
|
local place_trigger = def.place_trigger or nil
|
||||||
|
|
||||||
local moving_anim = def.moving_anim
|
local moving_anim = def.moving_anim
|
||||||
local stand_anim = def.stand_anim
|
local stand_anim = def.stand_anim
|
||||||
@ -197,6 +202,32 @@ function vehicles.object_drive(entity, dtime, def)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--death_node
|
||||||
|
if death_node ~= nil and node == death_node then
|
||||||
|
if entity.driver then
|
||||||
|
vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1})
|
||||||
|
end
|
||||||
|
vehicles.explodinate(entity, 5)
|
||||||
|
entity.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--place node
|
||||||
|
if place_node ~= nil and node == "air" or place_node ~= nil and node == "default:snow" or place_node ~= nil and minetest.get_item_group(node, "flora") ~= 0 then
|
||||||
|
if place_trigger == nil and math.random(1, place_chance) == 1 then
|
||||||
|
minetest.set_node(pos, {name=place_node})
|
||||||
|
end
|
||||||
|
if place_trigger ~= nil and ctrl.sneak then
|
||||||
|
minetest.set_node(pos, {name=place_node})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--destroy node
|
||||||
|
if destroy_node ~= nil and node == destroy_node then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
--lava explode
|
||||||
if node == "default:lava_source" or node == "default:lava_flowing" then
|
if node == "default:lava_source" or node == "default:lava_flowing" then
|
||||||
if entity.driver then
|
if entity.driver then
|
||||||
vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1})
|
vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1})
|
||||||
|
126
init.lua
126
init.lua
@ -1324,6 +1324,82 @@ minetest.register_entity("vehicles:pooshe2", {
|
|||||||
|
|
||||||
vehicles.register_spawner("vehicles:pooshe2", S("Pooshe (yellow)"), "vehicles_pooshe_inv2.png")
|
vehicles.register_spawner("vehicles:pooshe2", S("Pooshe (yellow)"), "vehicles_pooshe_inv2.png")
|
||||||
|
|
||||||
|
minetest.register_entity("vehicles:lightcycle", {
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "lightcycle.b3d",
|
||||||
|
textures = {"vehicles_lightcycle.png"},
|
||||||
|
velocity = 15,
|
||||||
|
acceleration = -5,
|
||||||
|
stepheight = step,
|
||||||
|
hp_max = 200,
|
||||||
|
physical = true,
|
||||||
|
collisionbox = {-1, 0, -1, 1.3, 1, 1},
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if self.driver and clicker == self.driver then
|
||||||
|
vehicles.object_detach(self, clicker, {x=1, y=0, z=1})
|
||||||
|
elseif not self.driver then
|
||||||
|
vehicles.object_attach(self, clicker, {x=0, y=5, z=4}, false, {x=0, y=2, z=4})
|
||||||
|
self.sound_ready = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_activate = function(self)
|
||||||
|
self.nitro = true
|
||||||
|
end,
|
||||||
|
on_punch = vehicles.on_punch,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
return vehicles.on_step(self, dtime, {
|
||||||
|
speed = 22,
|
||||||
|
decell = 0.85,
|
||||||
|
boost = true,
|
||||||
|
boost_duration = 4,
|
||||||
|
boost_effect = "vehicles_nitro.png",
|
||||||
|
place_node = "vehicles:light_barrier",
|
||||||
|
place_trigger = true,
|
||||||
|
death_node = "vehicles:light_barrier2",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vehicles.register_spawner("vehicles:lightcycle", S("Lightcycle"), "vehicles_lightcycle_inv.png")
|
||||||
|
|
||||||
|
minetest.register_entity("vehicles:lightcycle2", {
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "lightcycle.b3d",
|
||||||
|
textures = {"vehicles_lightcycle2.png"},
|
||||||
|
velocity = 15,
|
||||||
|
acceleration = -5,
|
||||||
|
stepheight = step,
|
||||||
|
hp_max = 200,
|
||||||
|
physical = true,
|
||||||
|
collisionbox = {-1, 0, -1, 1.3, 1, 1},
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if self.driver and clicker == self.driver then
|
||||||
|
vehicles.object_detach(self, clicker, {x=1, y=0, z=1})
|
||||||
|
elseif not self.driver then
|
||||||
|
vehicles.object_attach(self, clicker, {x=0, y=5, z=4}, false, {x=0, y=2, z=4})
|
||||||
|
self.sound_ready = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_activate = function(self)
|
||||||
|
self.nitro = true
|
||||||
|
end,
|
||||||
|
on_punch = vehicles.on_punch,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
return vehicles.on_step(self, dtime, {
|
||||||
|
speed = 22,
|
||||||
|
decell = 0.85,
|
||||||
|
boost = true,
|
||||||
|
boost_duration = 4,
|
||||||
|
boost_effect = "vehicles_nitro.png",
|
||||||
|
place_node = "vehicles:light_barrier2",
|
||||||
|
place_trigger = true,
|
||||||
|
death_node = "vehicles:light_barrier",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vehicles.register_spawner("vehicles:lightcycle2", S("Lightcycle 2"), "vehicles_lightcycle_inv2.png")
|
||||||
|
|
||||||
minetest.register_entity("vehicles:boat", {
|
minetest.register_entity("vehicles:boat", {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "boat.b3d",
|
mesh = "boat.b3d",
|
||||||
@ -2287,6 +2363,56 @@ minetest.register_node("vehicles:tyres", {
|
|||||||
},
|
},
|
||||||
groups = {cracky=1, falling_node=1},
|
groups = {cracky=1, falling_node=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("vehicles:light_barrier", {
|
||||||
|
description = S("Light Barrier"),
|
||||||
|
tiles = {"vehicles_lightblock.png",},
|
||||||
|
use_texture_alpha = true,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
light_source = 9,
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=3,dig_immediate=3,not_in_creative_inventory=1},
|
||||||
|
on_construct = function(pos, node)
|
||||||
|
minetest.after(4, function()
|
||||||
|
if pos ~= nil then
|
||||||
|
minetest:remove_node(pos)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("vehicles:light_barrier2", {
|
||||||
|
description = S("Light Barrier 2"),
|
||||||
|
tiles = {"vehicles_lightblock2.png",},
|
||||||
|
use_texture_alpha = true,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
light_source = 9,
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=3,dig_immediate=3,not_in_creative_inventory=1},
|
||||||
|
on_construct = function(pos, node)
|
||||||
|
minetest.after(4, function()
|
||||||
|
if pos ~= nil then
|
||||||
|
minetest:remove_node(pos)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"vehicles:light_barrier", "vehicles:light_barrier2"},
|
||||||
|
interval = 4,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
end--if minetest.setting_get("vehicles_nodes") then
|
end--if minetest.setting_get("vehicles_nodes") then
|
||||||
|
|
||||||
end--if enable_built_in then
|
end--if enable_built_in then
|
||||||
|
BIN
models/lightcycle.b3d
Normal file
BIN
models/lightcycle.b3d
Normal file
Binary file not shown.
13
readme.txt
13
readme.txt
@ -17,6 +17,9 @@ It is also possible for vehicles to jump or hover for a small amount of time. Cu
|
|||||||
Boats and watercraft:
|
Boats and watercraft:
|
||||||
The speed boat can be used on water, but if it is driven onto land it will stop completely. If you are lucky you can move back into water, but be careful because this does not always work.
|
The speed boat can be used on water, but if it is driven onto land it will stop completely. If you are lucky you can move back into water, but be careful because this does not always work.
|
||||||
|
|
||||||
|
The Lightcycles:
|
||||||
|
The Lightcycles can place light barriers when 'sneak' is pressed. If the barrier from one type hits the other type, the vehicle will explode
|
||||||
|
|
||||||
Other things:
|
Other things:
|
||||||
Vehicles will explode if they touch lava, so be careful.
|
Vehicles will explode if they touch lava, so be careful.
|
||||||
Don't drive cars or planes etc. into water! they will sink.
|
Don't drive cars or planes etc. into water! they will sink.
|
||||||
@ -88,4 +91,14 @@ extra_yaw: use this if the model has incorrect rotation. It will rotate the mode
|
|||||||
|
|
||||||
moving_anim/stand_anim/jump_anim/shoot_anim/shoot_anim2: animations for actions. Can be set individually. (default is nil)
|
moving_anim/stand_anim/jump_anim/shoot_anim/shoot_anim2: animations for actions. Can be set individually. (default is nil)
|
||||||
|
|
||||||
|
place_node: name of the node that is placed by the vehicle (default is nil)
|
||||||
|
|
||||||
|
place_chance: nodes are placed when a random number between place_chance and 1 is equal to 1 (default is 1)
|
||||||
|
|
||||||
|
place_trigger: if true the vehicle will place the node defined by place_node when 'sneak' is pressed. (default is false)
|
||||||
|
|
||||||
|
death_node: name of the node that will make the vehicle explode, default is nil
|
||||||
|
|
||||||
|
destroy_node: name of the node that is destroyed if it toughes the vehicle, default is nil
|
||||||
|
|
||||||
|
|
||||||
|
BIN
textures/vehicles_lightblock.png
Normal file
BIN
textures/vehicles_lightblock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 B |
BIN
textures/vehicles_lightblock2.png
Normal file
BIN
textures/vehicles_lightblock2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 157 B |
BIN
textures/vehicles_lightcycle.png
Normal file
BIN
textures/vehicles_lightcycle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 428 B |
BIN
textures/vehicles_lightcycle2.png
Normal file
BIN
textures/vehicles_lightcycle2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 449 B |
BIN
textures/vehicles_lightcycle_inv.png
Normal file
BIN
textures/vehicles_lightcycle_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 302 B |
BIN
textures/vehicles_lightcycle_inv2.png
Normal file
BIN
textures/vehicles_lightcycle_inv2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 319 B |
Loading…
x
Reference in New Issue
Block a user