Transport Fever 2

Transport Fever 2

[TGR] Volga steamships of the late XIX and early XX century
doug 21 Jan, 2024 @ 8:19am
Smoke color
If you're interested, the following mod.lua file will make the smoke color and duration selectable when the mod is loaded. I was a little surprised to discover that it does only apply to new ships purchased, not to ones already on the map:



local userChoices = {}

local p = {
{
key = "tgr_smoke_colour",
name = _("Smoke colour"),
values = {"0", ".05", ".1", ".15", ".2", ".25", ".3", ".35", ".4", ".45", ".5", ".55", "6", ".65", ".7", ".75", ".8", ".85", ".9", ".95", "1",},
defaultIndex = 2,
tooltip = _("Higher numbers are lighter."),
uiType = 'SLIDER',
},
{
key = "tgr_smoke_lifetime",
name = _("Smoke duration"),
values = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"},
defaultIndex = 10,
uiType = 'SLIDER',
},
}

local function smokeModifier(fileName, data)
if string.find(fileName, "vehicle/ship/steamer_Neva.mdl") or string.find(fileName, "vehicle/ship/steamer_Neva_1.mdl") then
local grey = userChoices.tgr_smoke_colour * .05
local smokeTime = 10 + userChoices.tgr_smoke_lifetime
data.metadata.particleSystem.emitters[1].color = {grey, grey, grey}
data.metadata.particleSystem.emitters[1].lifeTime = smokeTime
-- debugPrint({fileName, data.metadata.particleSystem.emitters})
end
return data
end

function data()
return {
info = {
params = p,
minorVersion = 0,
severityAdd = "NONE",
severityRemove = "NONE",
name = _("TGR_STEAMSHIP_MOD_NAME"),
description = _("TGR_STEAMSHIP_MOD_DESCRIPTION"),
tags = { "Ship", "Asia", "Europe", "USSR", },
authors = {
{
name = "TGR Studio",
role = "CREATOR",
},
{
name = "Old",
role = "3D and textures",
},
{
name = "Alex",
role = "Convertation and sounds",
},
},
visible = true,
},
runFn = function(settings, modParams)
local params = modParams[getCurrentModId()]
if params ~= nil then
addModifier( "loadModel", smokeModifier )
userChoices = params
end
end
}
end
Last edited by doug; 21 Jan, 2024 @ 8:19am