Skip to content

Commit

Permalink
Damage System: add damage types for damaging nodes; add tooltipd sedc…
Browse files Browse the repository at this point in the history
…ription. Closes #1628
  • Loading branch information
alek13 committed Sep 8, 2024
1 parent 654f932 commit a4113ee
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 19 deletions.
1 change: 1 addition & 0 deletions mods/lord/Blocks/campfire/campfire.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ minetest.register_node('campfire:campfire_active', {
paramtype = 'none',
light_source = 13,
damage_per_second = 3,
damage_groups = { fire = true, },
drop = "campfire:campfire",
-- sounds = default.node_sound_stone_defaults(),
selection_box = {
Expand Down
2 changes: 1 addition & 1 deletion mods/lord/Blocks/lottother/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ minetest.register_node("lottother:blue_flame", {
walkable = false,
buildable_to = true,
damage_per_second = 4,

damage_groups = { fire = true, },
after_place_node = function(pos, placer)
-- Removed in new MTG/fire : issue 479
--fire.on_flame_add_at(pos)
Expand Down
1 change: 1 addition & 0 deletions mods/lord/Entities/bees/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ local S = minetest.get_translator("bees")
}
},
damage_per_second = 1,
damage_groups = { poison = true, },
walkable = false,
buildable_to = true,
pointable = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ bendy_dig=bendy

# Damages
$dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 in @3 sec @4
(@1/sec)=(@1/сек)
@1/sec=@1/sec
Punch Speed: @1=Punch Speed: @1
fleshy_dmg=fleshy
fire_dmg=fire
poison_dmg=poison
soulful_dmg=soulful

# Defense:
Expand All @@ -54,8 +56,8 @@ armor_shield=fleshly
@1@2 to satiety=@1@2 to satiety

# copy from `tt_base` (`node_info`)
contact damage=Contact damage
contact healing=Contact healing
damage on contact=damage on contact
healing on contact=healing on contact
drowning damage=drowning damage
bouncy (@1%)=bouncy (@1%)
slippery=slippery
Expand Down
10 changes: 6 additions & 4 deletions mods/lord/Player/Help/lord_tooltips/locale/lord_tooltips.ru.tr
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ bendy_dig=гнущиеся

# Damages:
$dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 в @3 сек @4
(@1/sec)=(@1/сек)
@1/sec=@1/сек
Punch Speed: @1=Скорость удара: @1
fleshy_dmg=телесный
fire_dmg=огненный
poison_dmg=отравляющий
soulful_dmg=душ

# Defense:
Expand All @@ -54,9 +56,9 @@ armor_shield=телесная
@1@2 to satiety=@1@2 к сытости

# copy from `tt_base` (`node_info`)
contact damage=урон при контакте
contact healing=Исцеление при контакте
drowning damage=урон при падении
damage on contact=урон при контакте
healing on contact=исцеление при контакте
drowning damage=урон при утоплении
bouncy (@1%)=упругий (@1%)
slippery=Скользкий
climbable=можно карабкаться
Expand Down
8 changes: 5 additions & 3 deletions mods/lord/Player/Help/lord_tooltips/locale/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ bendy_dig=

# Damages
$dmg-item-tpl$ @1: @2 in @3 sec @4=@1: @2 in @3 sec @4
(@1/sec)=(@1/sec)
@1/sec=
Punch Speed: @1=
fleshy_dmg=
fire_dmg=
poison_dmg=
soulful_dmg=

# Defense:
Expand All @@ -54,8 +56,8 @@ armor_shield=
@1@2 to satiety=

# copy from `tt_base` (`node_info`)
contact damage=
contact healing=
damage on contact=
healing on contact=
drowning damage=
bouncy (@1%)=
slippery=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local S = minetest.get_translator(minetest.get_current_modname())



tt.COLOR_DANGER = '#f84'
tt.COLOR_DANGER = '#f64'


return {
Expand All @@ -23,18 +23,26 @@ return {

-- Health-related node facts
if definition.damage_per_second then
if definition.damage_per_second > 0 then
local amount = definition.damage_per_second
if amount > 0 then
local damage_groups = definition.damage_groups or (
definition.tool_capabilities
and (definition.tool_capabilities.damage_groups or {})
or {}
)
local damage_type = damage.Type.get_from_groups(damage_groups)
damage_type = damage_type and colorize('#bbb', S(damage_type..'_dmg') .. ' ') or ''

list_items[#list_items + 1] =
colorize(tt.COLOR_DANGER, S('contact damage')) .. ': ' .. S('@1/sec', definition.damage_per_second)
elseif definition.damage_per_second < 0 then
damage_type .. colorize(tt.COLOR_DANGER, S('damage on contact')) .. ': ' .. S('@1/sec', amount)
elseif amount < 0 then
list_items[#list_items + 1] =
colorize(tt.COLOR_GOOD, S('contact healing')) .. ': ' .. S(
'@1/sec', math.abs(definition.damage_per_second)
)
colorize(tt.COLOR_GOOD, S('contact healing')) .. ': ' .. S('@1/sec', -amount)
end
end
if definition.drowning and definition.drowning ~= 0 then
list_items[#list_items + 1] = colorize(tt.COLOR_DANGER, S('drowning damage')) .. ': ' .. definition.drowning
list_items[#list_items + 1] = colorize(tt.COLOR_DANGER, S('drowning damage')) .. ': ' ..
S('@1/sec', definition.drowning)
end
local tmp = minetest.get_item_group(item_string, 'fall_damage_add_percent')
if tmp > 0 then
Expand Down
5 changes: 5 additions & 0 deletions mods/lord/World/Generation/lottmapgen/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ minetest.register_node("lottmapgen:blacksource", {
liquid_alternative_source = "lottmapgen:blacksource",
liquid_viscosity = 1,
damage_per_second = 1,
damage_groups = { poison = true, },
post_effect_color = { a = 192, r = 140, g = 140, b = 140 },
groups = { water = 3, liquid = 3, puts_out_fire = 1 },
})
Expand Down Expand Up @@ -123,6 +124,7 @@ minetest.register_node("lottmapgen:blackflowing", {
liquid_alternative_source = "lottmapgen:blacksource",
liquid_viscosity = 1,
damage_per_second = 1,
damage_groups = { poison = true, },
post_effect_color = { a = 192, r = 140, g = 140, b = 140 }, -- {a=224, r=31, g=56, b=8},
groups = { water = 3, liquid = 3, puts_out_fire = 1, not_in_creative_inventory = 1 },
})
Expand All @@ -146,6 +148,7 @@ minetest.register_node("lottmapgen:black_river_source", {
liquid_renewable = false,
liquid_range = 2,
damage_per_second = 1,
damage_groups = { poison = true, },
post_effect_color = { a = 192, r = 140, g = 140, b = 140 },
groups = { water = 3, liquid = 3, puts_out_fire = 1 },
})
Expand Down Expand Up @@ -177,6 +180,8 @@ minetest.register_node("lottmapgen:black_river_flowing", {
liquid_viscosity = 1,
liquid_renewable = false,
liquid_range = 2,
damage_per_second = 1,
damage_groups = { poison = true, },
post_effect_color = { a = 192, r = 140, g = 140, b = 140 }, -- {a=224, r=31, g=56, b=8},
groups = { water = 3, liquid = 3, puts_out_fire = 1, not_in_creative_inventory = 1 },
})
Expand Down
3 changes: 3 additions & 0 deletions mods/lord/_overwrites/MTG/default/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ minetest.override_item("default:jungletree", {
end,
})

minetest.override_item('default:lava_source', { damage_groups = { fire = true, }, })
minetest.override_item('default:lava_flowing', { damage_groups = { fire = true, }, })


-- default/functions.lua

Expand Down
6 changes: 6 additions & 0 deletions mods/lord/_overwrites/MTG/fire/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

-- We have typed damage.
-- The type of damage is determined by node `damage_groups`

minetest.override_item('fire:basic_flame', { damage_groups = { fire = true, }, })
minetest.override_item('fire:permanent_flame', { damage_groups = { fire = true, }, })
3 changes: 3 additions & 0 deletions mods/lord/_overwrites/MTG/fire/mod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = lord_overwrites_mtg_fire
description = Lord Overwrites of MTG/fire mod
depends = default, fire

0 comments on commit a4113ee

Please sign in to comment.