Vitaliy
2018-07-21 d1b54a573c6287ea1d63b9c3f979c39058b1331a
technic/radiation.lua
@@ -54,8 +54,15 @@
   ["default:lava_source"] = 17,
   ["default:mese"] = 21,
   ["default:mossycobble"] = 15,
   ["default:nyancat"] = 1000,
   ["default:nyancat_rainbow"] = 1000,
   ["default:tinblock"] = 37,
   ["pbj_pup:pbj_pup"] = 10000,
   ["pbj_pup:pbj_pup_candies"] = 10000,
   ["gloopblocks:rainbow_block_diagonal"] = 5000,
   ["gloopblocks:rainbow_block_horizontal"] = 10000,
   ["default:nyancat"] = 10000,
   ["default:nyancat_rainbow"] = 10000,
   ["nyancat:nyancat"] = 10000,
   ["nyancat:nyancat_rainbow"] = 10000,
   ["default:obsidian"] = 18,
   ["default:obsidian_glass"] = 18,
   ["default:sand"] = 10,
@@ -70,6 +77,7 @@
   ["default:stone_with_gold"] = 34,
   ["default:stone_with_iron"] = 20,
   ["default:stone_with_mese"] = 17,
   ["default:stone_with_tin"] = 19,
   ["default:stonebrick"] = 17,
   ["default:water_flowing"] = 2.8,
   ["default:water_source"] = 5.6,
@@ -135,10 +143,8 @@
   ["moreblocks:wood_tile_up"] = 1.7,
   ["moreores:mineral_mithril"] = 18,
   ["moreores:mineral_silver"] = 21,
   ["moreores:mineral_tin"] = 19,
   ["moreores:mithril_block"] = 26,
   ["moreores:silver_block"] = 53,
   ["moreores:tin_block"] = 37,
   ["snow:snow_brick"] = 2.8,
   ["technic:brass_block"] = 43,
   ["technic:carbon_steel_block"] = 40,
@@ -242,6 +248,7 @@
local rad_dmg_cutoff = 0.2
local radiated_players = {}
local armor_enabled = technic.config:get_bool("enable_radiation_protection")
local entity_damage = technic.config:get_bool("enable_entity_radiation_damage")
local longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage")
@@ -303,15 +310,21 @@
local function dmg_object(pos, object, strength)
   local obj_pos = vector.add(object:getpos(), calculate_object_center(object))
   local mul = calculate_damage_multiplier(object)
   if mul == 0 then
      return
   local mul
   if armor_enabled or entity_damage then
      -- we need to check may the object be damaged even if armor is disabled
      mul = calculate_damage_multiplier(object)
      if mul == 0 then
         return
      end
   end
   local dmg = calculate_base_damage(pos, obj_pos, strength)
   if not dmg then
      return
   end
   dmg = dmg * mul
   if armor_enabled then
      dmg = dmg * mul
   end
   apply_fractional_damage(object, dmg)
   if longterm_damage and object:is_player() then
      local pn = object:get_player_name()
@@ -331,8 +344,9 @@
   end
end
if minetest.setting_getbool("enable_damage") then
if minetest.settings:get_bool("enable_damage") then
   minetest.register_abm({
      label = "Radiation damage",
      nodenames = {"group:radioactive"},
      interval = 1,
      chance = 1,
@@ -370,7 +384,7 @@
   minetest.register_node("technic:corium_"..state, {
      description = S(state == "source" and "Corium Source" or "Flowing Corium"),
      drawtype = (state == "source" and "liquid" or "flowingliquid"),
      [state == "source" and "tiles" or "special_tiles"] = {{
      tiles = {{
         name = "technic_corium_"..state.."_animated.png",
         animation = {
            type = "vertical_frames",
@@ -379,6 +393,28 @@
            length = 3.0,
         },
      }},
      special_tiles = {
         {
            name = "technic_corium_"..state.."_animated.png",
            backface_culling = false,
            animation = {
               type = "vertical_frames",
               aspect_w = 16,
               aspect_h = 16,
               length = 3.0,
            },
         },
         {
            name = "technic_corium_"..state.."_animated.png",
            backface_culling = true,
            animation = {
               type = "vertical_frames",
               aspect_w = 16,
               aspect_h = 16,
               length = 3.0,
            },
         },
      },
      paramtype = "light",
      paramtype2 = (state == "flowing" and "flowingliquid" or nil),
      light_source = (state == "source" and 8 or 5),
@@ -425,6 +461,7 @@
})
minetest.register_abm({
   label = "Corium: boil-off water (sources)",
   nodenames = {"group:water"},
   neighbors = {"technic:corium_source"},
   interval = 1,
@@ -435,6 +472,7 @@
})
minetest.register_abm({
   label = "Corium: boil-off water (flowing)",
   nodenames = {"technic:corium_flowing"},
   neighbors = {"group:water"},
   interval = 1,
@@ -445,6 +483,7 @@
})
minetest.register_abm({
   label = "Corium: become chernobylite",
   nodenames = {"technic:corium_flowing"},
   interval = 5,
   chance = (griefing and 10 or 1),
@@ -455,6 +494,7 @@
if griefing then
   minetest.register_abm({
      label = "Corium: griefing",
      nodenames = {"technic:corium_source", "technic:corium_flowing"},
      interval = 4,
      chance = 4,