forked from Mirrors/openclonk
Fix script errors in scenarios that don't load Objects.ocd
parent
57e63a5275
commit
aeeedcd770
|
@ -11,6 +11,11 @@ global func Bubble(int amount, int x, int y)
|
|||
return;
|
||||
}
|
||||
|
||||
global func CastBubbles(int num, int level, int x, int y)
|
||||
{
|
||||
return CastObjects(Fx_Bubble, num, level, x, y);
|
||||
}
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
DoCon(RandomX(25, 100));
|
||||
|
|
|
@ -50,3 +50,65 @@ func Update()
|
|||
SetObjDrawTransform((width * 1000) / 110, 0, 0, 0, (height * 1000) / 19, 0, 0);
|
||||
SetObjDrawTransform(l, 0, -(w-l) * 55, 0, (height * 1000) / 19, 100, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
adds an energy bar above the object.
|
||||
The energy bar uses either target.HitPoints & GetDamage() or target->GetMaxEnergy() & target->GetEnergy().
|
||||
*/
|
||||
global func AddEnergyBar()
|
||||
{
|
||||
var e = AddEffect("ShowEnergyBar", this, 1, 0, nil, nil);
|
||||
if (e)
|
||||
return e.bar;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarStart(target, effect, temp)
|
||||
{
|
||||
if (temp) return;
|
||||
var attachpoint = { x = 0, y = target->GetDefOffset(1) - 5};
|
||||
var current, max;
|
||||
if (target->GetCategory() & C4D_Living)
|
||||
{
|
||||
max = target->~GetMaxEnergy();
|
||||
current = target->GetEnergy();
|
||||
}
|
||||
else
|
||||
{
|
||||
max = target.HitPoints;
|
||||
current = max - target->GetDamage();
|
||||
}
|
||||
|
||||
if (current == nil || max == nil)
|
||||
return -1;
|
||||
|
||||
effect.bar = target->CreateProgressBar(GUI_ShadedSimpleProgressBar, max, current, 0, target->GetOwner(), attachpoint, nil, { width = 28, height = 6, color = RGB(200, 1, 1) });
|
||||
effect.bar->SetPlane(750);
|
||||
// update once
|
||||
effect.Interval = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarTimer(target, effect, time)
|
||||
{
|
||||
var value;
|
||||
if (target->GetCategory() & C4D_Living) value = target->GetEnergy();
|
||||
else value = target.HitPoints - target->GetDamage();
|
||||
|
||||
effect.bar->SetValue(value);
|
||||
effect.Interval = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarDamage(target, effect, dmg, cause)
|
||||
{
|
||||
effect.Interval = 1;
|
||||
return dmg;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarStop(target, effect, reason, temp)
|
||||
{
|
||||
if (temp) return;
|
||||
if (effect.bar)
|
||||
effect.bar->Close();
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
adds an energy bar above the object.
|
||||
The energy bar uses either target.HitPoints & GetDamage() or target->GetMaxEnergy() & target->GetEnergy().
|
||||
*/
|
||||
global func AddEnergyBar()
|
||||
{
|
||||
var e = AddEffect("ShowEnergyBar", this, 1, 0, nil, nil);
|
||||
if (e)
|
||||
return e.bar;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarStart(target, effect, temp)
|
||||
{
|
||||
if (temp) return;
|
||||
var attachpoint = { x = 0, y = target->GetDefOffset(1) - 5};
|
||||
var current, max;
|
||||
if (target->GetCategory() & C4D_Living)
|
||||
{
|
||||
max = target->~GetMaxEnergy();
|
||||
current = target->GetEnergy();
|
||||
}
|
||||
else
|
||||
{
|
||||
max = target.HitPoints;
|
||||
current = max - target->GetDamage();
|
||||
}
|
||||
|
||||
if (current == nil || max == nil)
|
||||
return -1;
|
||||
|
||||
effect.bar = target->CreateProgressBar(GUI_ShadedSimpleProgressBar, max, current, 0, target->GetOwner(), attachpoint, nil, { width = 28, height = 6, color = RGB(200, 1, 1) });
|
||||
effect.bar->SetPlane(750);
|
||||
// update once
|
||||
effect.Interval = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarTimer(target, effect, time)
|
||||
{
|
||||
var value;
|
||||
if (target->GetCategory() & C4D_Living) value = target->GetEnergy();
|
||||
else value = target.HitPoints - target->GetDamage();
|
||||
|
||||
effect.bar->SetValue(value);
|
||||
effect.Interval = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarDamage(target, effect, dmg, cause)
|
||||
{
|
||||
effect.Interval = 1;
|
||||
return dmg;
|
||||
}
|
||||
|
||||
global func FxShowEnergyBarStop(target, effect, reason, temp)
|
||||
{
|
||||
if (temp) return;
|
||||
if (effect.bar)
|
||||
effect.bar->Close();
|
||||
}
|
|
@ -82,7 +82,7 @@ global func ExplosionEffect(int level, int x, int y)
|
|||
// Blast particle.
|
||||
CreateParticle("Blast", x, y, 0, 0, level * 10, RGBa(255, 255, 255, 100));
|
||||
if(!GBackLiquid(x,y)) CastParticles("Spark", 10, 80 + level, x, y, 35, 40, RGB(255, 200, 0), RGB(255, 255, 150));
|
||||
if(GBackLiquid(x,y)) CastObjects(Fx_Bubble, level * 7 / 10, level, x, y);
|
||||
if(GBackLiquid(x,y) && Global.CastBubbles) Global->CastBubbles(level * 7 / 10, level, x, y);
|
||||
//CastParticles("FSpark", level/5+1, level, x,y, level*5+10,level*10+10, 0x00ef0000,0xffff1010));
|
||||
|
||||
// Smoke trails.
|
||||
|
|
Loading…
Reference in New Issue