Solved
The 2 following functions doesn't seem to work.
Is this a bug or not activated functions?
Is this a bug or not activated functions?
Code:
-- unemployed Colonists have increased Comfort
function OnMsg.ColonistStatusEffect(colonist, status_effect, bApply, now)
if status_effect =="StatusEffect_Unemployed" then
if bApply then
colonist:ChangeComfort(30*const.Scale.Stat, "unemployed")
end
end
end
~~~~
Code:
-- increase the Morale of all Colonists when a Rocket from Earth lands on Mars
function OnMsg.RocketLanded(rocket)
local morale = 15*const.Scale.Stat
local mod_id = "get_letter_from_earth"..rocket.name
local display_text = T{"<green>Letter form Earth! +<amount> </green>"}
local colonists = {}
for _, colonist in ipairs(UICity.labels.Colonist or empty_table) do
colonist:SetModifier("base_morale", mod_id, morale, 0, display_text)
colonists[#colonists+1] = colonist
end
CreateGameTimeThread( function()
Sleep(3*const.DayDuration)
for _, colonist in ipairs(colonists) do
if IsValid(colonist) then
colonist:SetModifier("base_morale", mod_id, 0, 0)
end
end
end )
end
~~~~