Fixed a runtime error for melting ice

stable-5.4
Maikel de Vries 2013-10-28 11:39:41 +01:00
parent 994f45f521
commit 2686cfd6f0
1 changed files with 9 additions and 6 deletions

View File

@ -8,27 +8,30 @@ protected func Hit()
protected func Construction()
{
var graphic = Random(5);
if(graphic)
SetGraphics(Format("%d",graphic));
if (graphic)
SetGraphics(Format("%d", graphic));
AddTimer("Check", 30);
}
protected func Check()
{
if(GetTemperature() > 0) Melt();
if(GetTemperature() <= 0 && GetMaterial()==Material("Water") && GetCon()<100) Freeze();
if (GetTemperature() <= 0 && GetMaterial() == Material("Water") && GetCon() < 100)
Freeze();
// Don't do anything af
if (GetTemperature() > 0)
Melt();
}
private func Melt()
{
CastPXS("Water",2,0);
CastPXS("Water", 2, 0);
DoCon(-1);
}
private func Freeze()
{
ExtractMaterialAmount(0, 0, Material("Water"), 2);
DoCon(1);
ExtractMaterialAmount(0,0,Material("Water"),2);
}
local Collectible = 1;