mirror of
https://github.com/APercy/automobiles_pck
synced 2025-07-18 04:38:53 +02:00
added mouse cntrol to the buggy
This commit is contained in:
parent
84dad3d238
commit
422d861454
@ -13,14 +13,25 @@ function buggy.getCarFromPlayer(player)
|
||||
end
|
||||
|
||||
function buggy.driver_formspec(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local vehicle_obj = buggy.getCarFromPlayer(player)
|
||||
if vehicle_obj == nil then
|
||||
return
|
||||
end
|
||||
local ent = vehicle_obj:get_luaentity()
|
||||
|
||||
local yaw = "false"
|
||||
if ent._yaw_by_mouse then yaw = "true" end
|
||||
|
||||
local basic_form = table.concat({
|
||||
"formspec_version[3]",
|
||||
"size[6,6]",
|
||||
"size[6,7]",
|
||||
}, "")
|
||||
|
||||
basic_form = basic_form.."button[1,1.0;4,1;go_out;Go Offboard]"
|
||||
basic_form = basic_form.."button[1,2.5;4,1;top;Close/Open Rag]"
|
||||
basic_form = basic_form.."button[1,4.0;4,1;lights;Lights]"
|
||||
basic_form = basic_form.."checkbox[1,5.5;yaw;Direction by mouse;"..yaw.."]"
|
||||
|
||||
minetest.show_formspec(name, "buggy:driver_main", basic_form)
|
||||
end
|
||||
@ -55,6 +66,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
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
|
||||
end
|
||||
end
|
||||
minetest.close_formspec(name, "buggy:driver_main")
|
||||
|
Loading…
Reference in New Issue
Block a user