2016-12-16 08:33:23 +00:00
|
|
|
|
/**
|
|
|
|
|
@author Dustin Neß (dness.de)
|
2013-03-28 18:08:11 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
local fShine = false;
|
|
|
|
|
local objShine;
|
|
|
|
|
local x = 0;
|
|
|
|
|
local y = 0;
|
|
|
|
|
|
|
|
|
|
protected func Initialize()
|
|
|
|
|
{
|
|
|
|
|
return SetAction("Shine");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected func Construction()
|
|
|
|
|
{
|
|
|
|
|
SetProperty("MeshTransformation", Trans_Mul(Trans_Rotate(RandomX(-30, 30), 11, 40), Trans_Scale(400)));
|
2015-01-10 09:14:02 +00:00
|
|
|
|
objShine = CreateObjectAbove(EnvPack_Lantern_Shine, x, y + 15, -1);
|
2015-10-05 21:46:52 +00:00
|
|
|
|
SetLightRange(80, 60);
|
2013-03-28 18:08:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func Shining()
|
|
|
|
|
{
|
2016-12-16 08:33:23 +00:00
|
|
|
|
// check if position changed
|
2013-03-28 18:08:11 +00:00
|
|
|
|
if (x != GetX() && y != GetY())
|
|
|
|
|
{
|
|
|
|
|
x = GetX();
|
|
|
|
|
y = GetY();
|
|
|
|
|
objShine->SetObjectBlitMode(GFX_BLIT_Additive);
|
|
|
|
|
objShine->SetClrModulation(RGBa(255, 255, 255, 228));
|
|
|
|
|
objShine->SetPosition(GetX(), GetY() - 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fShine)
|
|
|
|
|
fShine = true;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-16 08:33:23 +00:00
|
|
|
|
// flickering
|
2013-03-28 18:08:11 +00:00
|
|
|
|
private func Noise()
|
|
|
|
|
{
|
|
|
|
|
if (RandomX(5) <= 2)
|
|
|
|
|
{
|
|
|
|
|
objShine->SetClrModulation(RGBa(255, 255, 255, RandomX(190, 228)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public func SetOn(fOn)
|
|
|
|
|
{
|
|
|
|
|
if (fOn)
|
|
|
|
|
{
|
|
|
|
|
if (!FindObject(Find_ID(objShine)))
|
2015-01-10 09:14:02 +00:00
|
|
|
|
objShine = CreateObjectAbove(EnvPack_Lantern_Shine, 0, 15, -1);
|
2013-03-28 18:08:11 +00:00
|
|
|
|
SetAction("Shine");
|
|
|
|
|
SetClrModulation(RGB(255, 255, 255));
|
|
|
|
|
fShine = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
objShine->RemoveObject();
|
|
|
|
|
SetAction("Idle");
|
2016-12-16 08:33:23 +00:00
|
|
|
|
SetClrModulation(RGB(155, 155, 155)); // Turn model darker
|
2013-03-28 18:08:11 +00:00
|
|
|
|
fShine = false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local ActMap = {
|
|
|
|
|
Shine: {
|
|
|
|
|
Prototype: Action,
|
|
|
|
|
Name: "Shine",
|
|
|
|
|
StartCall: "Shining",
|
|
|
|
|
NextAction: "Shine",
|
|
|
|
|
EndCall: "Noise",
|
|
|
|
|
Delay: 5
|
|
|
|
|
}
|
2015-01-10 09:14:02 +00:00
|
|
|
|
};
|