forked from APercy/ju52
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.lua
35 lines (29 loc) · 1.4 KB
/
forms.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function ju52.paint_formspec(name)
local basic_form = table.concat({
"formspec_version[3]",
"size[4.0, 4.2]",
},"")
basic_form = basic_form.."image_button[0.5,0.5;3,1;ju52_p_lufthansa.png;lufthansa;Lufthansa;false;true;]"
basic_form = basic_form.."image_button[0.5,1.6;3,1;ju52_p_lufthansa.png;lufthansa2;Lufthansa 2;false;true;]"
basic_form = basic_form.."image_button[0.5,2.7;3,1;ju52_p_luftwaffe.png;luftwaffe;Luftwaffe;false;true;]"
--basic_form = basic_form.."image_button[1,4.3;3,1;ju52_white.png^[multiply:#2b2b2b;black;Black;false;true;]"
minetest.show_formspec(name, "ju52:paint", basic_form)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "ju52:paint" then
local name = player:get_player_name()
local plane_obj = airutils.getPlaneFromPlayer(player)
if plane_obj == nil then
minetest.close_formspec(name, "ju52:paint")
return
end
local ent = plane_obj:get_luaentity()
if ent then
if fields.lufthansa then ent._skin = "ju52_skin_lufthansa.png" end
if fields.lufthansa2 then ent._skin = "ju52_skin_lufthansa2.png" end
if fields.luftwaffe then ent._skin = "ju52_skin_luftwaffe.png" end
airutils.param_paint(ent, "#FFFFFF", "#FFFFFF")
end
minetest.close_formspec(name, "ju52:paint")
end
end)