diff --git a/.gitignore b/.gitignore index 20ab12d..4e504f6 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ luac.out .idea *.iml +i18n.py + diff --git a/init.lua b/init.lua index 358806f..6dd0c0b 100644 --- a/init.lua +++ b/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") .. "/craft.lua") dofile(minetest.get_modpath("surface_effect") .. "/register_abm.lua") +dofile(minetest.get_modpath("surface_effect") .. "/tablet.lua") minetest.register_globalstep(function(dtime) -- every 5 seconds @@ -28,6 +29,7 @@ minetest.register_globalstep(function(dtime) surface_effect.technicDetectUranium(player) local pos = object:get_pos() + su.rediationDomage(player, pos) --minetest.chat_send_all(dump(areas:getAreasAtPos(pos))) end diff --git a/locale/surface_effect.ru.tr b/locale/surface_effect.ru.tr index 51f40c8..33de1a8 100644 --- a/locale/surface_effect.ru.tr +++ b/locale/surface_effect.ru.tr @@ -1,7 +1,10 @@ # textdomain: surface_effect -Attention! High levels of radiation.=Внимание! Высокий уровень радиации. Chemical protection status: @1%=Состояние химзащиты: @1% - +Attention! High levels of radiation.=Внимание! Высокий уровень радиации. #nodes lua Irradiated Earth=Облученная земля -Dosimeter (inserted into the charging slot)=Дозиметр (вставляется в слот для зарядки) \ No newline at end of file +Dosimeter (inserted into the charging slot)=Дозиметр (вставляется в слот для зарядки) +Software version: @1=Версия ПО: @1 +Air temperature: @1=Температура воздуха: @1 +Tablet=Планшет +Not charged, the device needs to be charged=Не заряжается, устройство необходимо зарядить diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..4ee0696 --- /dev/null +++ b/locale/template.txt @@ -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= diff --git a/tablet.lua b/tablet.lua new file mode 100644 index 0000000..aae4e99 --- /dev/null +++ b/tablet.lua @@ -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 \ No newline at end of file diff --git a/textures/surface_effect_tablet.png b/textures/surface_effect_tablet.png new file mode 100644 index 0000000..04ad19c Binary files /dev/null and b/textures/surface_effect_tablet.png differ diff --git a/textures/surface_effect_tablet_bg.png b/textures/surface_effect_tablet_bg.png new file mode 100644 index 0000000..3f9fb4b Binary files /dev/null and b/textures/surface_effect_tablet_bg.png differ diff --git a/textures/surface_effect_weather_btn.png b/textures/surface_effect_weather_btn.png new file mode 100644 index 0000000..63610cd Binary files /dev/null and b/textures/surface_effect_weather_btn.png differ