Добавлена радиоактивная земля и переделана система эффекта надетого костюма
This commit is contained in:
parent
4f04d05b9b
commit
b2e595777a
42
function.lua
42
function.lua
@ -39,10 +39,10 @@ surface_effect.setHud = function(player)
|
||||
|
||||
if type(surface_effect.nplayer[name]) == 'nil' then
|
||||
surface_effect.nplayer[name] = {
|
||||
id = false,
|
||||
radiation_damage = "OFF",
|
||||
id_varning_text = false,
|
||||
logo = 'off',
|
||||
id_mask = false,
|
||||
}
|
||||
|
||||
minetest.log("action", "Load nplayer: " .. surface_effect.dump(surface_effect.nplayer))
|
||||
@ -69,7 +69,6 @@ surface_effect.radiaton_off = function(player)
|
||||
local name = player:get_player_name()
|
||||
|
||||
if surface_effect.nplayer[name]["radiation_damage"] == "ON" then
|
||||
player:hud_remove(surface_effect.nplayer[name]['id'])
|
||||
player:hud_remove(surface_effect.nplayer[name]['id_varning_text'])
|
||||
surface_effect.nplayer[name]["radiation_damage"] = "OFF"
|
||||
surface_effect.nplayer[name]["id_varning_text"] = nil
|
||||
@ -107,6 +106,32 @@ surface_effect.technic_forcefield_radiation_protection = function(pos, player)
|
||||
end
|
||||
end
|
||||
|
||||
surface_effect.mask = function(player)
|
||||
local name = player:get_player_name()
|
||||
|
||||
if surface_effect.checkHazmat(player) == true and surface_effect.nplayer[name]["id_mask"] == false then
|
||||
local id = player:hud_add({
|
||||
name = "Radiation effect",
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 0.5},
|
||||
scale = {
|
||||
x = -100,
|
||||
y = -110
|
||||
},
|
||||
z_index = -100,
|
||||
text = "surface_effect_mask.png"
|
||||
})
|
||||
|
||||
surface_effect.nplayer[name]["id_mask"] = id
|
||||
|
||||
elseif surface_effect.nplayer[name]["id_mask"] ~= false and surface_effect.checkHazmat(player) == false then
|
||||
player:hud_remove(surface_effect.nplayer[name]['id_mask'])
|
||||
surface_effect.nplayer[name]["id_mask"] = false
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
su.rediationDomage = function (player, pos)
|
||||
local name = player:get_player_name()
|
||||
|
||||
@ -127,17 +152,6 @@ su.rediationDomage = function (player, pos)
|
||||
effect = function(player)
|
||||
|
||||
if surface_effect.nplayer[name]['radiation_damage'] == "OFF" then
|
||||
local id = player:hud_add({
|
||||
name = "Radiation effect",
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 0.5},
|
||||
scale = {
|
||||
x = -100,
|
||||
y = -110
|
||||
},
|
||||
text = "surface_effect_rad.png"
|
||||
})
|
||||
|
||||
local idtext = player:hud_add({
|
||||
name = "Attention! Radiation ",
|
||||
hud_elem_type = "text",
|
||||
@ -157,8 +171,6 @@ su.rediationDomage = function (player, pos)
|
||||
-- player has left the game
|
||||
end
|
||||
end, player:get_player_name(), id)
|
||||
|
||||
surface_effect.nplayer[name]['id'] = id
|
||||
surface_effect.nplayer[name]["radiation_damage"] = "ON"
|
||||
surface_effect.nplayer[name]["id_varning_text"] = idtext
|
||||
end
|
||||
|
32
init.lua
32
init.lua
@ -5,6 +5,7 @@ surface_effect = {
|
||||
local timer = 0
|
||||
|
||||
dofile(minetest.get_modpath("surface_effect") .. "/function.lua")
|
||||
dofile(minetest.get_modpath("surface_effect") .. "/nodes.lua")
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
-- every 5 seconds
|
||||
@ -13,8 +14,9 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
timer = os.time() + 10
|
||||
|
||||
|
||||
for k, player in ipairs(minetest.get_connected_players()) do
|
||||
surface_effect.mask(player)
|
||||
|
||||
local name = player:get_player_name()
|
||||
local object = minetest.env:get_player_by_name(name)
|
||||
surface_effect.setHud(player)
|
||||
@ -48,6 +50,7 @@ minetest.register_on_joinplayer(function(player, last_login)
|
||||
|
||||
local name = player:get_player_name()
|
||||
local pos = player:get_pos()
|
||||
surface_effect.mask(player)
|
||||
|
||||
surface_effect.nplayer[name]['logo'] = 'off'
|
||||
end )
|
||||
@ -99,3 +102,30 @@ for akey, v in ipairs(mobs_monster) do
|
||||
minetest.add_item(pos, 'bonemeal:bone 5')
|
||||
end
|
||||
end
|
||||
|
||||
local on_radiation_damage = function(player, damage, pos)
|
||||
local radiation_multiplier = player:get_armor_groups().radiation
|
||||
if radiation_multiplier then
|
||||
damage = damage * radiation_multiplier / 100
|
||||
end
|
||||
damage = math.floor(damage)
|
||||
if damage > 0 then
|
||||
minetest.log("action", player:get_player_name() .. " takes " .. tostring(damage) .. " damage from mese radiation damage at " .. minetest.pos_to_string(pos))
|
||||
player:set_hp(player:get_hp() - damage)
|
||||
minetest.sound_play({name = "radiant_damage_geiger", gain = math.min(1, damage/10)}, {to_player=player:get_player_name()})
|
||||
end
|
||||
end
|
||||
|
||||
radiant_damage.register_radiant_damage("radioactive_earth", {
|
||||
interval = 1,
|
||||
range = 3,
|
||||
--inverse_square_falloff = true,
|
||||
emitted_by = {["surface_effect:radioactive_earth"] = 0.5},
|
||||
attenuated_by = {['air'] = 0.4, ['default:grass_1'] = 0.5},
|
||||
default_attenuation = 1,
|
||||
on_damage = on_radiation_damage,
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
surface_effect.mask(player)
|
||||
end)
|
@ -1,2 +1,5 @@
|
||||
# textdomain: surface_effect
|
||||
Attention! High levels of radiation.=Внимание! Высокий уровень радиации.
|
||||
Attention! High levels of radiation.=Внимание! Высокий уровень радиации.
|
||||
|
||||
#nodes lua
|
||||
Irradiated Earth=Облученная земля
|
28
nodes.lua
Normal file
28
nodes.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local S = minetest.get_translator("surface_effect")
|
||||
|
||||
minetest.register_node("surface_effect:radioactive_earth", {
|
||||
description = S("Irradiated Earth"),
|
||||
tiles = {
|
||||
"surface_effect_radioactive_earth_up.png",
|
||||
"surface_effect_radioactive_eartha_front.png",
|
||||
"surface_effect_radioactive_eartha_front.png",
|
||||
"surface_effect_radioactive_eartha_front.png",
|
||||
"surface_effect_radioactive_eartha_front.png",
|
||||
"surface_effect_radioactive_eartha_front.png",
|
||||
},
|
||||
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_grass_footstep", gain = 0.25},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos)
|
||||
if pos.y > -10 and pos.y < 1500 then
|
||||
minetest.env:add_node(pos, {name="surface_effect:radioactive_earth"})
|
||||
end
|
||||
end,
|
||||
})
|
BIN
textures/surface_effect_mask.png
Normal file
BIN
textures/surface_effect_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
textures/surface_effect_radioactive_earth_up.png
Normal file
BIN
textures/surface_effect_radioactive_earth_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
textures/surface_effect_radioactive_eartha_down.png
Normal file
BIN
textures/surface_effect_radioactive_eartha_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
textures/surface_effect_radioactive_eartha_front.png
Normal file
BIN
textures/surface_effect_radioactive_eartha_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Loading…
Reference in New Issue
Block a user