2019-12-18 13:25:51 +02:00
|
|
|
local Public = {}
|
2019-12-20 22:13:50 +02:00
|
|
|
local string_sub = string.sub
|
|
|
|
|
|
|
|
local balance_functions = {
|
|
|
|
["land-mine"] = function(force_name)
|
|
|
|
game.forces[force_name].set_ammo_damage_modifier("landmine", -0.6)
|
|
|
|
end,
|
|
|
|
["stronger-explosives"] = function(force_name)
|
|
|
|
game.forces[force_name].set_ammo_damage_modifier("landmine", -0.6)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
function Public.research(event)
|
|
|
|
local research_name = event.research.name
|
|
|
|
local force_name = event.research.force.name
|
|
|
|
local key
|
|
|
|
for b = 1, string.len(research_name), 1 do
|
|
|
|
key = string_sub(research_name, 0, b)
|
|
|
|
if balance_functions[key] then
|
|
|
|
balance_functions[key](force_name)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-12-18 13:25:51 +02:00
|
|
|
|
|
|
|
function Public.fish(event)
|
|
|
|
if event.item.name ~= "raw-fish" then return end
|
|
|
|
local player = game.players[event.player_index]
|
2019-12-20 15:46:20 +02:00
|
|
|
player.character.health = player.character.health - 80
|
2019-12-18 13:25:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return Public
|