Tablet implementation
This commit is contained in:
parent
08d490429d
commit
64f1a31167
2
.gitignore
vendored
2
.gitignore
vendored
@ -40,3 +40,5 @@ luac.out
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
|
i18n.py
|
||||||
|
|
||||||
|
2
init.lua
2
init.lua
@ -9,6 +9,7 @@ dofile(minetest.get_modpath("surface_effect") .. "/function.lua")
|
|||||||
dofile(minetest.get_modpath("surface_effect") .. "/nodes.lua")
|
dofile(minetest.get_modpath("surface_effect") .. "/nodes.lua")
|
||||||
dofile(minetest.get_modpath("surface_effect") .. "/craft.lua")
|
dofile(minetest.get_modpath("surface_effect") .. "/craft.lua")
|
||||||
dofile(minetest.get_modpath("surface_effect") .. "/register_abm.lua")
|
dofile(minetest.get_modpath("surface_effect") .. "/register_abm.lua")
|
||||||
|
dofile(minetest.get_modpath("surface_effect") .. "/tablet.lua")
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
-- every 5 seconds
|
-- every 5 seconds
|
||||||
@ -28,6 +29,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
surface_effect.technicDetectUranium(player)
|
surface_effect.technicDetectUranium(player)
|
||||||
|
|
||||||
local pos = object:get_pos()
|
local pos = object:get_pos()
|
||||||
|
|
||||||
su.rediationDomage(player, pos)
|
su.rediationDomage(player, pos)
|
||||||
--minetest.chat_send_all(dump(areas:getAreasAtPos(pos)))
|
--minetest.chat_send_all(dump(areas:getAreasAtPos(pos)))
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
# textdomain: surface_effect
|
# textdomain: surface_effect
|
||||||
Attention! High levels of radiation.=Внимание! Высокий уровень радиации.
|
|
||||||
Chemical protection status: @1%=Состояние химзащиты: @1%
|
Chemical protection status: @1%=Состояние химзащиты: @1%
|
||||||
|
Attention! High levels of radiation.=Внимание! Высокий уровень радиации.
|
||||||
#nodes lua
|
#nodes lua
|
||||||
Irradiated Earth=Облученная земля
|
Irradiated Earth=Облученная земля
|
||||||
Dosimeter (inserted into the charging slot)=Дозиметр (вставляется в слот для зарядки)
|
Dosimeter (inserted into the charging slot)=Дозиметр (вставляется в слот для зарядки)
|
||||||
|
Software version: @1=Версия ПО: @1
|
||||||
|
Air temperature: @1=Температура воздуха: @1
|
||||||
|
Tablet=Планшет
|
||||||
|
Not charged, the device needs to be charged=Не заряжается, устройство необходимо зарядить
|
||||||
|
9
locale/template.txt
Normal file
9
locale/template.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# textdomain: surface_effect
|
||||||
|
Chemical protection status: @1%=
|
||||||
|
Attention! High levels of radiation.=
|
||||||
|
Irradiated Earth=
|
||||||
|
Dosimeter (inserted into the charging slot)=
|
||||||
|
Software version: @1=
|
||||||
|
Air temperature: @1=
|
||||||
|
Tablet=
|
||||||
|
No charge, device needs to be charged=
|
59
tablet.lua
Normal file
59
tablet.lua
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
local S = minetest.get_translator("surface_effect")
|
||||||
|
|
||||||
|
local winsize = "size[15,10]"
|
||||||
|
local bgimage = "image[0,0;15,10;surface_effect_tablet_bg.png]"
|
||||||
|
surface_effect.display = {}
|
||||||
|
local version = "0.0.1"
|
||||||
|
|
||||||
|
function surface_effect.display.main(player)
|
||||||
|
local pos = player:get_pos()
|
||||||
|
local info_biome = minetest.get_biome_data(pos)
|
||||||
|
--minetest.log(dump(info_biome))
|
||||||
|
local formspec = {
|
||||||
|
"formspec_version[4]",
|
||||||
|
winsize,
|
||||||
|
bgimage,
|
||||||
|
"style[label;textcolor=green;size=2]",
|
||||||
|
"label[0.5,0.5;"..S("Software version: @1", version).."]",
|
||||||
|
"label[0.5,1.0;"..S("Air temperature: @1", math.floor(info_biome.heat)).."]",
|
||||||
|
--"style[weather;textcolor=black;size=2]",
|
||||||
|
--"image_button[0.5,0.5;1.5,1.5;surface_effect_weather_btn.png;weather;Weather]"
|
||||||
|
}
|
||||||
|
|
||||||
|
return table.concat(formspec, "")
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_tool("surface_effect:tablet", {
|
||||||
|
description = S("Tablet"),
|
||||||
|
inventory_image = "surface_effect_tablet.png",
|
||||||
|
wear_represents = "technic_RE_charge",
|
||||||
|
groups = {not_in_creative_inventory = 0},
|
||||||
|
on_use = function(stack, player, pointed)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local meta = stack:get_meta()
|
||||||
|
local charge = meta:get_int("technic:charge")
|
||||||
|
if charge == -1 then
|
||||||
|
minetest.chat_send_player(name, S("No charge, device needs to be charged"))
|
||||||
|
end
|
||||||
|
charge = charge - 1
|
||||||
|
|
||||||
|
if charge < 0 then
|
||||||
|
technic.set_RE_wear(stack, 0, 65535)
|
||||||
|
meta:set_int("technic:charge", -1)
|
||||||
|
minetest.chat_send_player(name, S("Not charged, the device needs to be charged"))
|
||||||
|
end
|
||||||
|
|
||||||
|
if charge > 0 then
|
||||||
|
technic.set_RE_wear(stack, charge, 65535)
|
||||||
|
meta:set_int("technic:charge", charge)
|
||||||
|
minetest.show_formspec(name, "surface_effect:display_main", surface_effect.display.main(player))
|
||||||
|
--stack:set_stack()
|
||||||
|
end
|
||||||
|
minetest.log(dump(charge))
|
||||||
|
return stack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("technic") then
|
||||||
|
technic.register_power_tool("surface_effect:tablet", 65535)
|
||||||
|
end
|
BIN
textures/surface_effect_tablet.png
Normal file
BIN
textures/surface_effect_tablet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
BIN
textures/surface_effect_tablet_bg.png
Normal file
BIN
textures/surface_effect_tablet_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
textures/surface_effect_weather_btn.png
Normal file
BIN
textures/surface_effect_weather_btn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
x
Reference in New Issue
Block a user