void StackSteam(aref rCharacter, int puffs_per_second)
// Character and number of tentacles
{
if (!bSeaActive) return;
bool PlayEngineSound = false;
int delay = 0;
// Particle Effects
for (int i=0; i < puffs_per_second; i++)
{
PostEvent("CreateStackSteam", delay, "i", rCharacter);
delay = delay + 1000/puffs_per_second;
}
if(IsMainCharacter(rCharacter) && abs(sti(GetAttribute(rCharacter,"Ship.Power"))) > 0)
{
// Sound
if(!CheckAttribute(rCharacter,"Ship.PlayedEngineSound"))
{
rCharacter.Ship.PlayedEngineSound = GetSeaTime();
PlayEngineSound = true;
}
if(GetSeaTime() >= sti(rCharacter.Ship.PlayedEngineSound) + sti(rCharacter.basetime)) PlayEngineSound = true;
if(PlayEngineSound)
{
int SoundID;
SoundID = PlayStereoSound("objects\engine.wav");
float volume;
volume = 0.1 + 0.9*abs(stf(GetAttribute(rCharacter,"Ship.Power")))/100;
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, SoundID, volume);
rCharacter.Ship.PlayedEngineSound = GetSeaTime();
}
// Fuel Consumption
if(!CheckAttribute(rCharacter,"Ship.FuelConsumption")) rCharacter.Ship.FuelConsumption = 0;
else rCharacter.Ship.FuelConsumption = stf(rCharacter.Ship.FuelConsumption) + abs(stf(GetAttribute(rCharacter,"Ship.Power")))/100;
if(stf(rCharacter.Ship.FuelConsumption) >= 60)
{
RemoveCharacterGoods(rCharacter,GOOD_PLANKS,1);
rCharacter.Ship.FuelConsumption = 0;
}
}
}