more mods

This commit is contained in:
tangent committed 2026-09-12 07:03:41 -06:00
1 parent cc0fa41e3b
commit bac6ac94a3
1742 files changed
+115814 -1

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
## Roadster
This mod adds a roadster automobile to Minetest.
## Licenses
- Code: see [LICENSE](/LICENSE)
- Media: see [license_media.txt](/license_media.txt)
## Screenshot
![roadster](/automobiles_roadster/screenshot.jpg)
+71
View File
@@ -0,0 +1,71 @@
--
-- constants
--
roadster={}
roadster.LONGIT_DRAG_FACTOR = 0.16*0.16
roadster.LATER_DRAG_FACTOR = 30.0
roadster.gravity = automobiles_lib.gravity
roadster.max_speed = 12
roadster.max_acc_factor = 5
roadster.S = nil
if(minetest.get_translator ~= nil) then
roadster.S = minetest.get_translator(minetest.get_current_modname())
else
roadster.S = function ( s ) return s end
end
local S = roadster.S
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "custom_physics.lua")
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "control.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_roadster") .. DIR_DELIM .. "roadster_forms.lua")
dofile(minetest.get_modpath("automobiles_roadster") .. DIR_DELIM .. "roadster_entities.lua")
dofile(minetest.get_modpath("automobiles_roadster") .. DIR_DELIM .. "roadster_crafts.lua")
-- --minetest.add_entity(e_pos, "automobiles_roadster:target")
minetest.register_node("automobiles_roadster:display_target", {
tiles = {"automobiles_red.png"},
use_texture_alpha = "true",
walkable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-.05,-.05,-.05, .05,.05,.05},
},
},
selection_box = {
type = "regular",
},
paramtype = "light",
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "",
})
minetest.register_entity("automobiles_roadster:target", {
physical = false,
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "wielditem",
-- wielditem seems to be scaled to 1.5 times original node size
visual_size = {x = 0.67, y = 0.67},
textures = {"automobiles_roadster:display_target"},
timer = 0,
glow = 10,
on_step = function(self, dtime)
self.timer = self.timer + dtime
-- remove after set number of seconds
if self.timer > 1 then
self.object:remove()
end
end,
})
@@ -0,0 +1,9 @@
# textdomain: automobiles_roadster
### roadster_crafts.lua ###
Roadster Body=Roadster Karrosserie
Roadster Wheel=Roadster Rad
Roadster=Roadster
Go Offboard=Aussteigen
Close/Open Ragtop=Öffne/Schließe Sonnendach
Lights=Lichter
Direction by mouse=Lenken mit Maus
@@ -0,0 +1,9 @@
# textdomain: automobiles_roadster
### roadster_crafts.lua ###
Roadster Body=Korpo de Roadster
Roadster Wheel=Rado de Roadster
Roadster=Roadster
Go Offboard=
Close/Open Ragtop=
Lights=
Direction by mouse=
@@ -0,0 +1,9 @@
# textdomain: automobiles_roadster
### roadster_crafts.lua ###
Roadster Body=
Roadster Wheel=
Roadster=
Go Offboard=
Close/Open Ragtop=
Lights=
Direction by mouse=
+5
View File
@@ -0,0 +1,5 @@
name=automobiles_roadster
title=Roadster
description=A roadster automobile
author=apercy
depends=automobiles_lib
@@ -0,0 +1,81 @@
local S = roadster.S
--
-- items
--
-- body
minetest.register_craftitem("automobiles_roadster:roadster_body",{
description = S("Roadster Body"),
inventory_image = "roadster_body.png",
})
-- wheel
minetest.register_craftitem("automobiles_roadster:wheel",{
description = S("Roadster Wheel"),
inventory_image = "roadster_wheel.png",
})
-- roadster
minetest.register_tool("automobiles_roadster:roadster", {
description = S("Roadster"),
inventory_image = "automobiles_roadster.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_roadster:roadster", 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
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("Roadster"))
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_roadster:roadster",
recipe = {
{"automobiles_roadster:wheel", "automobiles_lib:engine", "automobiles_roadster:wheel"},
{"automobiles_roadster:wheel","automobiles_roadster:roadster_body", "automobiles_roadster:wheel"},
}
})
minetest.register_craft({
output = "automobiles_roadster:roadster_body",
recipe = {
{"default:glass" ,"","default:steel_ingot"},
{"default:steel_ingot","default:steelblock","default:steel_ingot"},
{"group:wood","group:wood", "group:wood"},
}
})
minetest.register_craft({
output = "automobiles_roadster:wheel",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"default:stick","group:wood", "default:stick"},
{"group:wood", "default:stick", "group:wood"},
}
})
end
@@ -0,0 +1,311 @@
--
-- entity
--
minetest.register_entity('automobiles_roadster: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_roadster_front_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_roadster:rear_suspension',{
initial_properties = {
physical = true,
collide_with_objects=true,
pointable=false,
visual = "mesh",
mesh = "automobiles_roadster_rear_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_roadster:lights',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
glow = 15,
visual = "mesh",
mesh = "automobiles_roadster_lights.b3d",
textures = {"automobiles_roadster_lights.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_roadster:wheel',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
visual = "mesh",
mesh = "automobiles_roadster_wheel.b3d",
backface_culling = false,
textures = {"automobiles_black.png", "automobiles_wood2.png", "automobiles_roadster_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_roadster:top1',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
visual = "mesh",
mesh = "automobiles_roadster_top1.b3d",
backface_culling = false,
textures = {"automobiles_metal.png", "automobiles_black.png", "automobiles_alpha.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_roadster:top2',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
visual = "mesh",
mesh = "automobiles_roadster_top2.b3d",
backface_culling = false,
textures = {"automobiles_metal.png", "automobiles_black.png", "automobiles_alpha.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_roadster:steering',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
visual = "mesh",
mesh = "automobiles_roadster_steering.b3d",
textures = {"automobiles_metal.png", "automobiles_wood2.png", "automobiles_metal.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_roadster:pointer',{
initial_properties = {
physical = false,
collide_with_objects=false,
pointable=false,
visual = "mesh",
mesh = "automobiles_pointer.b3d",
visual_size = {x = 1, y = 1, z = 1},
textures = {"automobiles_white.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_roadster:roadster", {
initial_properties = {
physical = true,
collide_with_objects = true,
collisionbox = {-0.1, -0.5, -0.1, 0.1, 1, 0.1},
selectionbox = {-1.5, 0.0, -1.5, 1.5, 2, 1.5},
stepheight = 0.6 + automobiles_lib.extra_stepheight,
visual = "mesh",
mesh = "automobiles_roadster.b3d",
textures = {
"automobiles_metal2.png", --parabrisa movel
"automobiles_glass.png", --vidro do parabrisa movel
"automobiles_painting.png", --portas
"automobiles_black.png", --portas interno
"automobiles_wood.png", --assoalho
"automobiles_black.png", --bancos
"automobiles_painting.png", --pintura
"automobiles_black.png", --chassis
"automobiles_metal2.png", --carcaça farol
"automobiles_black.png", --grade do radiador
"automobiles_black.png", --forração interna
"automobiles_metal.png", --lente do farol
"automobiles_wood.png", --parede de fogo
"automobiles_roadster_fuel.png", --combustivel
"automobiles_metal2.png", --parabrisa fixo
"automobiles_glass.png", --vidro do parabrisa fixo
"automobiles_black.png", --paralamas
"automobiles_metal2.png", --carenagem do radiador
"automobiles_painting.png", --tanque de combustivel
},
},
textures = {},
driver_name = nil,
sound_handle = nil,
owner = "",
static_save = true,
infotext = "A very nice roadster!",
hp = 50,
buoyancy = 2,
physics = automobiles_lib.physics,
lastvelocity = vector.new(),
time_total = 0,
_passenger = nil,
_color = "#0063b0",
_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,
_inv = nil,
_inv_id = "",
_change_color = automobiles_lib.paint,
_intensity = 4,
_trunk_slots = 8,
_engine_sound = "roadster_engine",
_max_fuel = 10,
_formspec_function = roadster.driver_formspec,
_destroy_function = roadster.destroy,
_vehicle_name = "Roadster",
_drive_wheel_pos = {x=-4.25,y=12,z=14},
_drive_wheel_angle = 70,
_steering_ent = 'automobiles_roadster:steering',
_rag_extended_ent = 'automobiles_roadster:top1',
_rag_retracted_ent = 'automobiles_roadster:top2',
_windshield_pos = {x=0, z=15.8317, y=15.0394},
_windshield_ext_rotation = {x=145, y=0, z=0},
_seat_pos = {{x=-4.25,y=7.12,z=9.5},{x=4.25,y=7.12,z=9.5}},
_front_suspension_ent = 'automobiles_roadster:front_suspension',
_front_suspension_pos = {x=0,y=0,z=24.22},
_front_wheel_ent = 'automobiles_roadster:wheel',
_front_wheel_xpos = 10.26,
_front_wheel_frames = {x = 1, y = 24},
_rear_suspension_ent = 'automobiles_roadster:rear_suspension',
_rear_suspension_pos = {x=0,y=0,z=0},
_rear_wheel_ent = 'automobiles_roadster:wheel',
_rear_wheel_xpos = 10.26,
_rear_wheel_frames = {x = 1, y = 24},
_wheel_compensation = 0.5,
_fuel_gauge_pos = {x=0,y=8.04,z=17.84},
_gauge_pointer_ent = 'automobiles_roadster:pointer',
_front_lights = 'automobiles_roadster:lights',
_horn_sound = 'roadster_horn',
_LONGIT_DRAG_FACTOR = 0.16*0.16,
_LATER_DRAG_FACTOR = 20.0,
_max_acc_factor = 5,
_max_speed = 12,
_min_later_speed = 5,
_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,
})
@@ -0,0 +1,79 @@
local S = roadster.S
function roadster.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, "roadster:driver_main", basic_form)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "roadster: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, "roadster:driver_main")
end
end)
Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB