forked from Mirrors/openclonk
Add light effect to explosions.
Currently, all players see the light. In the future, we may want limit it to the controller of the explosion.issue1247
parent
61b05f92c3
commit
2b997b994a
|
@ -0,0 +1,7 @@
|
||||||
|
[DefCore]
|
||||||
|
id=Fx_Light
|
||||||
|
Version=6,0
|
||||||
|
Category=C4D_Vehicle
|
||||||
|
Width=1
|
||||||
|
Height=1
|
||||||
|
Mass=1
|
Binary file not shown.
After Width: | Height: | Size: 169 B |
|
@ -0,0 +1,46 @@
|
||||||
|
/*-- Light --*/
|
||||||
|
|
||||||
|
local Visibility = VIS_None;
|
||||||
|
local Name = "$Name$";
|
||||||
|
|
||||||
|
// Light types to be used for light_type parameter in CreateLight
|
||||||
|
local LGT_Constant = 0;
|
||||||
|
local LGT_Blast = 1; // light up and remove again after some time
|
||||||
|
local range, ltype, t;
|
||||||
|
|
||||||
|
global func CreateLight(int x, int y, int range, int light_type, player)
|
||||||
|
{
|
||||||
|
// create light object. player may be nil
|
||||||
|
var light = CreateObject(Fx_Light, x, y, player);
|
||||||
|
if (light) light->Init(range, light_type);
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
|
||||||
|
func Init(int lrange, int light_type)
|
||||||
|
{
|
||||||
|
// Init depending on type
|
||||||
|
range = lrange;
|
||||||
|
ltype = light_type;
|
||||||
|
t = 0;
|
||||||
|
if (ltype == LGT_Constant)
|
||||||
|
{
|
||||||
|
// Just a fixed light
|
||||||
|
SetPlrViewRange(range);
|
||||||
|
}
|
||||||
|
else if (ltype == LGT_Blast)
|
||||||
|
{
|
||||||
|
SetPlrViewRange(range);
|
||||||
|
var time = Sqrt(range)+10;
|
||||||
|
ScheduleCall(this, Global.RemoveObject, time, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Invalid light type
|
||||||
|
FatalError(Format("Light init: Invalid light type %v", light_type));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Temp or helper object not stored
|
||||||
|
func SaveScenarioObject() { return false; }
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Name=Lichteffekt
|
|
@ -0,0 +1 @@
|
||||||
|
Name=Light effect
|
|
@ -237,6 +237,9 @@ global func ExplosionEffect(int level, int x, int y, int smoothness)
|
||||||
smoke_trail_count--;
|
smoke_trail_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Temporary light effect
|
||||||
|
if (level>5) CreateLight(x, y, level, Fx_Light.LGT_Blast);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue