more mods
@@ -0,0 +1,10 @@
|
||||
## Beetle
|
||||
|
||||
This mod adds a beetle automobile to Minetest.
|
||||
|
||||
## Licenses
|
||||
- Code: see [LICENSE](/LICENSE)
|
||||
- Media: Model made by myself; licence CC0
|
||||
|
||||
## Screenshot
|
||||

|
||||
@@ -0,0 +1,151 @@
|
||||
local S = auto_beetle.S
|
||||
|
||||
--
|
||||
-- items
|
||||
--
|
||||
|
||||
-- body
|
||||
minetest.register_craftitem("automobiles_beetle:beetle_body",{
|
||||
description = S("Beetle Body"),
|
||||
inventory_image = "beetle_body.png",
|
||||
})
|
||||
|
||||
-- beetle
|
||||
minetest.register_tool("automobiles_beetle:beetle", {
|
||||
description = "Beetle",
|
||||
inventory_image = "automobiles_beetle.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 1,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_meta = itemstack:get_meta()
|
||||
local staticdata = stack_meta:get_string("staticdata")
|
||||
|
||||
local pointed_pos = pointed_thing.above
|
||||
--pointed_pos.y=pointed_pos.y+0.2
|
||||
local car = minetest.add_entity(pointed_pos, "automobiles_beetle:beetle", staticdata)
|
||||
if car and placer then
|
||||
local ent = car:get_luaentity()
|
||||
local owner = placer:get_player_name()
|
||||
if ent then
|
||||
ent.owner = owner
|
||||
ent.hp = 50 --reset hp
|
||||
--minetest.chat_send_all("owner: " .. ent.owner)
|
||||
car:set_yaw(placer:get_look_horizontal())
|
||||
itemstack:take_item()
|
||||
ent.object:set_acceleration({x=0,y=-automobiles_lib.gravity,z=0})
|
||||
automobiles_lib.setText(ent, S("Beetle"))
|
||||
automobiles_lib.create_inventory(ent, ent._trunk_slots, owner)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
-- beetle
|
||||
minetest.register_tool("automobiles_beetle:beetle_conv", {
|
||||
description = "Beetle",
|
||||
inventory_image = "automobiles_beetle_conv.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 1,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_meta = itemstack:get_meta()
|
||||
local staticdata = stack_meta:get_string("staticdata")
|
||||
|
||||
local pointed_pos = pointed_thing.above
|
||||
--pointed_pos.y=pointed_pos.y+0.2
|
||||
local car = minetest.add_entity(pointed_pos, "automobiles_beetle:beetle_conv", staticdata)
|
||||
if car and placer then
|
||||
local ent = car:get_luaentity()
|
||||
local owner = placer:get_player_name()
|
||||
if ent then
|
||||
ent.owner = owner
|
||||
ent.hp = 50 --reset hp
|
||||
--minetest.chat_send_all("owner: " .. ent.owner)
|
||||
car:set_yaw(placer:get_look_horizontal())
|
||||
itemstack:take_item()
|
||||
ent.object:set_acceleration({x=0,y=-automobiles_lib.gravity,z=0})
|
||||
automobiles_lib.setText(ent, S("Beetle"))
|
||||
automobiles_lib.create_inventory(ent, ent._trunk_slots, owner)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- crafting
|
||||
--
|
||||
if minetest.get_modpath("default") then
|
||||
minetest.register_craft({
|
||||
output = "automobiles_beetle:beetle",
|
||||
recipe = {
|
||||
{"automobiles_lib:wheel", "automobiles_lib:engine", "automobiles_lib:wheel"},
|
||||
{"automobiles_lib:wheel","automobiles_beetle:beetle_body", "automobiles_lib:wheel"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "automobiles_beetle:beetle_conv",
|
||||
recipe = {
|
||||
{"wool:white","wool:black","wool:black"},
|
||||
{"automobiles_lib:wheel", "automobiles_lib:engine", "automobiles_lib:wheel"},
|
||||
{"automobiles_lib:wheel","automobiles_beetle:beetle_body", "automobiles_lib:wheel"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "automobiles_beetle:beetle_body",
|
||||
recipe = {
|
||||
{"default:glass" ,"default:steel_ingot","default:glass"},
|
||||
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
|
||||
{"default:steelblock","default:steelblock", "default:steelblock"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- beetle
|
||||
minetest.register_tool("automobiles_beetle:rc_beetle", {
|
||||
description = "R/C Beetle",
|
||||
inventory_image = "automobiles_beetle.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 1,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_meta = itemstack:get_meta()
|
||||
local staticdata = stack_meta:get_string("staticdata")
|
||||
|
||||
local pointed_pos = pointed_thing.above
|
||||
--pointed_pos.y=pointed_pos.y+0.2
|
||||
local car = minetest.add_entity(pointed_pos, "automobiles_beetle:rc_beetle", staticdata)
|
||||
if car and placer then
|
||||
local ent = car:get_luaentity()
|
||||
local owner = placer:get_player_name()
|
||||
if ent then
|
||||
ent.owner = owner
|
||||
ent.hp = 1 --reset hp
|
||||
--minetest.chat_send_all("owner: " .. ent.owner)
|
||||
car:set_yaw(placer:get_look_horizontal())
|
||||
itemstack:take_item()
|
||||
ent.object:set_acceleration({x=0,y=-automobiles_lib.gravity,z=0})
|
||||
automobiles_lib.setText(ent, S("R/C Beetle"))
|
||||
automobiles_lib.create_inventory(ent, ent._trunk_slots, owner)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,502 @@
|
||||
-- destroy the beetle
|
||||
function auto_beetle.destroy(self, puncher)
|
||||
automobiles_lib.remove_light(self)
|
||||
if self.sound_handle then
|
||||
minetest.sound_stop(self.sound_handle)
|
||||
self.sound_handle = nil
|
||||
end
|
||||
|
||||
if self.driver_name then
|
||||
-- detach the driver first (puncher must be driver)
|
||||
if puncher then
|
||||
puncher:set_detach()
|
||||
puncher:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
if minetest.global_exists("player_api") then
|
||||
player_api.player_attached[self.driver_name] = nil
|
||||
-- player should stand again
|
||||
player_api.set_animation(puncher, "stand")
|
||||
end
|
||||
end
|
||||
self.driver_name = nil
|
||||
end
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
if self.front_suspension then self.front_suspension:remove() end
|
||||
if self.lf_wheel then self.lf_wheel:remove() end
|
||||
if self.rf_wheel then self.rf_wheel:remove() end
|
||||
if self.rear_suspension then self.rear_suspension:remove() end
|
||||
if self.lr_wheel then self.lr_wheel:remove() end
|
||||
if self.rr_wheel then self.rr_wheel:remove() end
|
||||
if self.fuel_gauge then self.fuel_gauge:remove() end
|
||||
if self.lights then self.lights:remove() end
|
||||
if self.r_lights then self.r_lights:remove() end
|
||||
if self.reverse_lights then self.reverse_lights:remove() end
|
||||
if self.turn_l_light then self.turn_l_light:remove() end
|
||||
if self.turn_r_light then self.turn_r_light:remove() end
|
||||
if self.back_seat then self.back_seat:remove() end
|
||||
|
||||
automobiles_lib.seats_destroy(self)
|
||||
|
||||
automobiles_lib.destroy_inventory(self)
|
||||
self.object:remove()
|
||||
|
||||
pos.y=pos.y+2
|
||||
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:engine')
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:wheel')
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:wheel')
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:wheel')
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:wheel')
|
||||
end
|
||||
--
|
||||
-- entity
|
||||
--
|
||||
|
||||
minetest.register_entity('automobiles_beetle:wheel',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_anim_wheel.b3d",
|
||||
backface_culling = false,
|
||||
textures = {"automobiles_black.png", "automobiles_metal.png", "beetle_wheel.png"},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:front_suspension',{
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects=true,
|
||||
collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5},
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "automobiles_buggy_f_suspension.b3d",
|
||||
textures = {"automobiles_black.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
--[[on_step = function(self, dtime, moveresult)
|
||||
minetest.chat_send_all(dump(moveresult))
|
||||
end,]]--
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:rear_suspension',{
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects=true,
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "automobiles_buggy_r_suspension.b3d",
|
||||
textures = {"automobiles_black.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:f_lights',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_f_lights.b3d",
|
||||
textures = {"automobiles_grey.png"},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:r_lights',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_pos_lights.b3d",
|
||||
textures = {"automobiles_rear_lights_off.png"},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:turn_left_light',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_turn_l_light.b3d",
|
||||
textures = {"automobiles_rear_lights.png", "automobiles_turn.png", },
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:turn_right_light',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_turn_r_light.b3d",
|
||||
textures = {"automobiles_rear_lights.png", "automobiles_turn.png", },
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:reverse_lights',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_reverse_lights.b3d",
|
||||
textures = {"automobiles_grey.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:top',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_top.b3d",
|
||||
backface_culling = false,
|
||||
textures = {"automobiles_white.png", "automobiles_black.png", "beetle_glasses.png"},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_beetle:top_retracted',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_top_retracted.b3d",
|
||||
backface_culling = false,
|
||||
textures = {"automobiles_black.png"},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
function auto_beetle.paint(self, colstr)
|
||||
local l_textures = self.initial_properties.textures
|
||||
self._color = colstr
|
||||
|
||||
--paint details
|
||||
local target_texture = "beetle_painting.png"
|
||||
local accessorie_texture = "beetle_paint_interior.png"
|
||||
for _, texture in ipairs(l_textures) do
|
||||
local indx = texture:find(target_texture)
|
||||
if indx then
|
||||
l_textures[_] = "("..target_texture.."^[multiply:"..colstr..")^("..target_texture.."^[multiply:#BBBBBB^[mask:beetle_details.png)" --here changes the main color
|
||||
end
|
||||
local indx = texture:find(accessorie_texture)
|
||||
if indx then
|
||||
l_textures[_] = accessorie_texture.."^[multiply:".. colstr --here changes the main color
|
||||
end
|
||||
end
|
||||
self.object:set_properties({textures=l_textures})
|
||||
end
|
||||
|
||||
function auto_beetle.set_paint(self, puncher, itmstck)
|
||||
local is_admin = false
|
||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
if not (self.owner == puncher:get_player_name() or is_admin == true) then
|
||||
return
|
||||
end
|
||||
|
||||
local item_name = ""
|
||||
if itmstck then item_name = itmstck:get_name() end
|
||||
|
||||
if item_name == "bike:painter" then
|
||||
--painting with bike painter
|
||||
local meta = itmstck:get_meta()
|
||||
local colstr = meta:get_string("paint_color")
|
||||
auto_beetle.paint(self, colstr)
|
||||
return true
|
||||
else
|
||||
--painting with dyes
|
||||
local split = string.split(item_name, ":")
|
||||
local color, indx, _
|
||||
if split[1] then _,indx = split[1]:find('dye') end
|
||||
if indx then
|
||||
--lets paint!!!!
|
||||
local color = split[2] --(item_name:sub(indx+1)):gsub(":", "")
|
||||
local colstr = automobiles_lib.colors[color]
|
||||
--minetest.chat_send_all(color ..' '.. dump(colstr))
|
||||
if colstr then
|
||||
auto_beetle.paint(self, colstr)
|
||||
itmstck:set_count(itmstck:get_count()-1)
|
||||
puncher:set_wielded_item(itmstck)
|
||||
return true
|
||||
end
|
||||
-- end painting
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
auto_beetle.car_properties1 = {
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
collisionbox = {-0.1, -0.2, -0.1, 0.1, 1.8, 0.1},
|
||||
selectionbox = {-2.0, 0.0, -2.0, 2.0, 2, 2.0},
|
||||
stepheight = 0.65 + automobiles_lib.extra_stepheight,
|
||||
visual = "mesh",
|
||||
mesh = "beetle_body.b3d",
|
||||
backface_culling = false,
|
||||
textures = {
|
||||
"automobiles_black.png", --bancos
|
||||
"automobiles_black.png", --banco traseiro
|
||||
"beetle_painting.png", --pintura carroceria
|
||||
"automobiles_black.png", --chassis
|
||||
"automobiles_metal.png", "automobiles_black.png", --escapamento
|
||||
"automobiles_metal.png", --detalhes metal
|
||||
"automobiles_black.png", "automobiles_metal.png", --estribos
|
||||
"beetle_glasses.png", --vidros
|
||||
"beetle_interior.png", --assoalho e forros
|
||||
"beetle_paint_interior.png", --painel
|
||||
"automobiles_metal.png", --para-choques
|
||||
"beetle_painting.png", --para-lamas
|
||||
"automobiles_metal.png", "automobiles_black.png", --volante
|
||||
"beetle_painting.png", --portas
|
||||
"automobiles_black.png", --forro portas
|
||||
"automobiles_metal.png", --metais portas
|
||||
"beetle_glasses.png", --vidros portas
|
||||
},
|
||||
},
|
||||
textures = {},
|
||||
driver_name = nil,
|
||||
sound_handle = nil,
|
||||
owner = "",
|
||||
static_save = true,
|
||||
infotext = "A very nice Beetle!",
|
||||
hp = 50,
|
||||
buoyancy = 2,
|
||||
physics = automobiles_lib.physics,
|
||||
lastvelocity = vector.new(),
|
||||
time_total = 0,
|
||||
_passenger = nil,
|
||||
_color = "#FFFFFF",
|
||||
_steering_angle = 0,
|
||||
_engine_running = false,
|
||||
_last_checkpoint = "",
|
||||
_total_laps = -1,
|
||||
_race_id = "",
|
||||
_energy = 1,
|
||||
_last_time_collision_snd = 0,
|
||||
_last_time_drift_snd = 0,
|
||||
_last_time_command = 0,
|
||||
_roll = math.rad(0),
|
||||
_pitch = 0,
|
||||
_longit_speed = 0,
|
||||
_show_rag = true,
|
||||
_show_lights = false,
|
||||
_light_old_pos = nil,
|
||||
_last_ground_check = 0,
|
||||
_last_light_move = 0,
|
||||
_last_engine_sound_update = 0,
|
||||
_turn_light_timer = 0,
|
||||
_inv = nil,
|
||||
_inv_id = "",
|
||||
_change_color = automobiles_lib.paint,
|
||||
_intensity = 4,
|
||||
_car_gravity = -automobiles_lib.gravity,
|
||||
_is_flying = 0,
|
||||
_trunk_slots = 12,
|
||||
_engine_sound = "beetle_engine",
|
||||
_base_pitch = 0.7,
|
||||
_max_fuel = 10,
|
||||
|
||||
_vehicle_name = "Beetle",
|
||||
_drive_wheel_pos = {x=-4.42, y=7.00, z=21},
|
||||
_drive_wheel_angle = 12,
|
||||
_seat_pos = {{x=-4.0,y=2,z=13.8},{x=4.0,y=2,z=13.8}, {x=-3.5,y=2,z=5},{x=3.5,y=2,z=5}},
|
||||
|
||||
_front_suspension_ent = 'automobiles_beetle:front_suspension',
|
||||
_front_suspension_pos = {x=0,y=1.8,z=27.6},
|
||||
_front_wheel_ent = 'automobiles_beetle:wheel',
|
||||
_front_wheel_xpos = 8.5,
|
||||
_front_wheel_frames = {x = 1, y = 24},
|
||||
_rear_suspension_ent = 'automobiles_beetle:rear_suspension',
|
||||
_rear_suspension_pos = {x=0,y=1.8,z=0},
|
||||
_rear_wheel_ent = 'automobiles_beetle:wheel',
|
||||
_rear_wheel_xpos = 8.5,
|
||||
_rear_wheel_frames = {x = 1, y = 24},
|
||||
_wheel_compensation = 0.9,
|
||||
|
||||
_fuel_gauge_pos = {x=-4.42,y=8.70,z=20.2},
|
||||
_front_lights = 'automobiles_beetle:f_lights',
|
||||
_rear_lights = 'automobiles_beetle:r_lights',
|
||||
_reverse_lights = 'automobiles_beetle:reverse_lights',
|
||||
_turn_left_lights = 'automobiles_beetle:turn_left_light',
|
||||
_turn_right_lights = 'automobiles_beetle:turn_right_light',
|
||||
_textures_turn_lights_off = {"automobiles_rear_lights.png", "automobiles_turn.png", },
|
||||
_textures_turn_lights_on = {"automobiles_rear_lights_full.png", "automobiles_turn_on.png", },
|
||||
|
||||
_change_color = auto_beetle.paint,
|
||||
_painting_function = auto_beetle.set_paint,
|
||||
_painting_load = auto_beetle.paint,
|
||||
_transmission_state = 1,
|
||||
|
||||
_horn_sound = 'beetle_horn',
|
||||
|
||||
_LONGIT_DRAG_FACTOR = 0.12*0.12,
|
||||
_LATER_DRAG_FACTOR = 6.0,
|
||||
_max_acc_factor = 5,
|
||||
_max_speed = 14,
|
||||
_min_later_speed = 3,
|
||||
_consumption_divisor = 60000,
|
||||
|
||||
|
||||
get_staticdata = automobiles_lib.get_staticdata,
|
||||
|
||||
on_deactivate = function(self)
|
||||
automobiles_lib.save_inventory(self)
|
||||
end,
|
||||
|
||||
on_activate = automobiles_lib.on_activate,
|
||||
|
||||
on_step = automobiles_lib.on_step,
|
||||
|
||||
on_punch = automobiles_lib.on_punch,
|
||||
on_rightclick = automobiles_lib.on_rightclick,
|
||||
}
|
||||
|
||||
minetest.register_entity("automobiles_beetle:beetle", auto_beetle.car_properties1)
|
||||
|
||||
|
||||
auto_beetle.car_properties2 = automobiles_lib.properties_copy(auto_beetle.car_properties1)
|
||||
auto_beetle.car_properties2._vehicle_name = "Convertible Beetle"
|
||||
auto_beetle.car_properties2.initial_properties = automobiles_lib.properties_copy(auto_beetle.car_properties1.initial_properties)
|
||||
auto_beetle.car_properties2.initial_properties.mesh = "beetle_body_convertible.b3d"
|
||||
auto_beetle.car_properties2.initial_properties.textures = automobiles_lib.properties_copy(auto_beetle.car_properties1.initial_properties.textures)
|
||||
auto_beetle.car_properties2._color = "#FFB82D"
|
||||
auto_beetle.car_properties2._formspec_function = auto_beetle.driver_formspec
|
||||
auto_beetle.car_properties2._rag_extended_ent = 'automobiles_beetle:top'
|
||||
auto_beetle.car_properties2._rag_retracted_ent = 'automobiles_beetle:top_retracted'
|
||||
auto_beetle.car_properties2._show_rag = true
|
||||
|
||||
minetest.register_entity("automobiles_beetle:beetle_conv", auto_beetle.car_properties2)
|
||||
|
||||
|
||||
auto_beetle.car_properties3 = automobiles_lib.properties_copy(auto_beetle.car_properties1)
|
||||
auto_beetle.car_properties3.initial_properties = automobiles_lib.properties_copy(auto_beetle.car_properties1.initial_properties)
|
||||
auto_beetle.car_properties3._vehicle_scale = 0.1
|
||||
auto_beetle.car_properties3._vehicle_power_scale = 0.12
|
||||
auto_beetle.car_properties3._ground_friction = 0.5
|
||||
auto_beetle.car_properties3.initial_properties.collisionbox = {-0.01, -0.02, -0.01, 0.01, 0.18, 0.01}
|
||||
auto_beetle.car_properties3.initial_properties.selectionbox = {-0.2, 0.0, -0.2, 0.2, 0.2, 0.2}
|
||||
auto_beetle.car_properties3._color = "#992222"
|
||||
|
||||
minetest.register_entity("automobiles_beetle:rc_beetle", auto_beetle.car_properties3)
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
local S = auto_beetle.S
|
||||
|
||||
function auto_beetle.driver_formspec(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local vehicle_obj = automobiles_lib.getCarFromPlayer(player)
|
||||
if vehicle_obj == nil then
|
||||
return
|
||||
end
|
||||
local ent = vehicle_obj:get_luaentity()
|
||||
|
||||
local yaw = "false"
|
||||
local one_hand = "false"
|
||||
if ent._yaw_by_mouse then yaw = "true" end
|
||||
if ent._one_hand then one_hand = "true" end
|
||||
|
||||
local basic_form = table.concat({
|
||||
"formspec_version[3]",
|
||||
"size[6,7]",
|
||||
}, "")
|
||||
|
||||
basic_form = basic_form.."button[1,1.0;4,1;go_out;" .. S("Go Offboard") .. "]"
|
||||
basic_form = basic_form.."button[1,2.5;4,1;top;" .. S("Close/Open Ragtop") .. "]"
|
||||
basic_form = basic_form.."button[1,4.0;4,1;lights;" .. S("Lights") .. "]"
|
||||
basic_form = basic_form.."checkbox[1,5.5;yaw;" .. S("Direction by mouse") .. ";"..yaw.."]"
|
||||
basic_form = basic_form.."checkbox[1,6.2;one_hand;" .. S("One Hand Driving\n(open menu using AUX)") .. ";"..one_hand.."]"
|
||||
|
||||
minetest.show_formspec(name, "auto_beetle:driver_main", basic_form)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "auto_beetle:driver_main" then
|
||||
local name = player:get_player_name()
|
||||
local car_obj = automobiles_lib.getCarFromPlayer(player)
|
||||
if car_obj then
|
||||
local ent = car_obj:get_luaentity()
|
||||
if ent then
|
||||
if fields.top then
|
||||
if ent._show_rag == true then
|
||||
ent._show_rag = false
|
||||
else
|
||||
ent._show_rag = true
|
||||
end
|
||||
end
|
||||
if fields.go_out then
|
||||
|
||||
if ent._passenger then --any pax?
|
||||
local pax_obj = minetest.get_player_by_name(ent._passenger)
|
||||
automobiles_lib.dettach_pax(ent, pax_obj)
|
||||
end
|
||||
|
||||
automobiles_lib.dettach_driver(ent, player)
|
||||
end
|
||||
if fields.lights then
|
||||
if ent._show_lights == true then
|
||||
ent._show_lights = false
|
||||
else
|
||||
ent._show_lights = true
|
||||
end
|
||||
end
|
||||
if fields.yaw then
|
||||
if ent._yaw_by_mouse == true then
|
||||
ent._yaw_by_mouse = false
|
||||
else
|
||||
ent._yaw_by_mouse = true
|
||||
end
|
||||
end
|
||||
if fields.one_hand then
|
||||
if ent._one_hand == true then
|
||||
ent._one_hand = false
|
||||
else
|
||||
ent._one_hand = true
|
||||
core.chat_send_player(name,core.colorize('#00ff00', S(" >>> Use AUX or key \"E\" to open the menu")))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.close_formspec(name, "auto_beetle:driver_main")
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,27 @@
|
||||
--
|
||||
-- constants
|
||||
--
|
||||
auto_beetle={}
|
||||
auto_beetle.gravity = automobiles_lib.gravity
|
||||
|
||||
auto_beetle.S = nil
|
||||
|
||||
if(minetest.get_translator ~= nil) then
|
||||
auto_beetle.S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
else
|
||||
auto_beetle.S = function ( s ) return s end
|
||||
|
||||
end
|
||||
|
||||
local S = auto_beetle.S
|
||||
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "custom_physics.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "fuel_management.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "ground_detection.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "control.lua")
|
||||
dofile(minetest.get_modpath("automobiles_beetle") .. DIR_DELIM .. "forms.lua")
|
||||
dofile(minetest.get_modpath("automobiles_beetle") .. DIR_DELIM .. "entities.lua")
|
||||
dofile(minetest.get_modpath("automobiles_beetle") .. DIR_DELIM .. "crafts.lua")
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# textdomain: automobiles_beetle
|
||||
Beetle Body=Käfer Karroserie
|
||||
Beetle=Käfer
|
||||
@@ -0,0 +1,3 @@
|
||||
# textdomain: automobiles_beetle
|
||||
Beetle Body=
|
||||
Beetle=
|
||||
@@ -0,0 +1,5 @@
|
||||
name=automobiles_beetle
|
||||
title=Beetle
|
||||
description=The old classic Beetle for Minetest
|
||||
author=apercy
|
||||
depends=automobiles_lib
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 9.0 KiB |