forked from Mirrors/openclonk
UserAction: Add more options for particle creation
Also fix collision behaviour setting to work.console-destruction
parent
147e70ace9
commit
0e3b1865ea
|
@ -154,9 +154,11 @@ func Definition(def)
|
|||
Speed={Function="int_constant", Value=20},
|
||||
Lifetime={Function="int_constant", Value=100},
|
||||
Size={Function="int_constant", Value=10},
|
||||
SizeEnd={Function="int_constant", Value=1},
|
||||
Color={Function="color_constant", Value=0xffff},
|
||||
BlitMode=0,
|
||||
HasGravity=true,
|
||||
Gravity={Function="int_constant", Value=100},
|
||||
FadeOut=true,
|
||||
CollisionFunc="bounce"
|
||||
}, { Type="proplist", Display="{{Amount}}x{{Name}}", EditorProps = {
|
||||
Name = { Name="$ParticleName$", EditorHelp="$ParticleNameHelp$", Type="enum", Priority=50, Options = [
|
||||
|
@ -173,13 +175,15 @@ func Definition(def)
|
|||
Speed = new Evaluator.Integer { Name="$Speed$", EditorHelp="$CastParticlesSpeedHelp$" },
|
||||
Lifetime = new Evaluator.Integer { Name="$Lifetime$", EditorHelp="$CastParticlesLifetimeHelp$" },
|
||||
Size = new Evaluator.Integer { Name="$Size$", EditorHelp="$CastParticlesSizeHelp$" },
|
||||
SizeEnd = new Evaluator.Integer { Name="$SizeEnd$", EditorHelp="$CastParticlesSizeEndHelp$" },
|
||||
Color = new Evaluator.Color { Name="$Color$", EditorHelp="$CastParticlesColorHelp$" },
|
||||
BlitMode = { Name="$BlitMode$", EditorHelp="$ParticleBlitModeHelp$", Type="enum", Options = [
|
||||
{ Name="$Normal$", Value=0 },
|
||||
{ Name="$Additive$", Value=GFX_BLIT_Additive },
|
||||
{ Name="$Mod2$", Value=GFX_BLIT_Mod2 }
|
||||
] },
|
||||
HasGravity = { Name="$HasGravity$", EditorHelp="$ParticleGravityHelp$", Type="bool" },
|
||||
Gravity = new Evaluator.Integer { Name="$Gravity$", EditorHelp="$ParticleGravityHelp$" },
|
||||
FadeOut = { Name="$FadeOut$", EditorHelp="$ParticleFadeOutHelp$", Type="bool" },
|
||||
CollisionFunc = { Name="$CollisionFunc$", EditorHelp="$ParticleCollisionFuncHelp$", Type="enum", Options = [
|
||||
{ Value="pass", Name="$Pass$" },
|
||||
{ Value="stop", Name="$Stop$" },
|
||||
|
@ -864,27 +868,28 @@ private func EvalAct_CastParticles(proplist props, proplist context)
|
|||
var particle_name = props.Name;
|
||||
var amount = EvaluateValue("Integer", props.Amount, context);
|
||||
var speed = EvaluateValue("Integer", props.Speed, context);
|
||||
var size = EvaluateValue("Integer", props.Size, context);
|
||||
if (size <= 0) return;
|
||||
var size_start = EvaluateValue("Integer", props.Size, context);
|
||||
var size_end = EvaluateValue("Integer", props.SizeEnd, context);
|
||||
var lifetime = EvaluateValue("Integer", props.Lifetime, context);
|
||||
if (lifetime <= 0) return;
|
||||
var position = EvaluatePosition(props.Position, context);
|
||||
var color = (EvaluateValue("Color", props.Color, context) ?? 0xffffff) | 0xff000000;
|
||||
var blit_mode = props.BlitMode;
|
||||
var has_gravity = props.HasGravity;
|
||||
var fadeout = props.FadeOut;
|
||||
var gravity = EvaluateValue("Integer", props.Gravity, context);
|
||||
var collision_func = props.CollisionFunc;
|
||||
var prototype =
|
||||
{
|
||||
BlitMode = props.BlitMode,
|
||||
Size = size,
|
||||
Size = PV_Linear(size_start, size_end),
|
||||
Rotation = PV_Direction(),
|
||||
Alpha=255,
|
||||
R = (color >> 16) & 0xff,
|
||||
G = (color >> 8) & 0xff,
|
||||
B = (color >> 0) & 0xff,
|
||||
CollisionVertex = 500
|
||||
};
|
||||
if (has_gravity) prototype.ForceY = PV_Gravity(20);
|
||||
if (fadeout) prototype.Alpha = PV_Linear(255, 0); else prototype.Alpha=255;
|
||||
if (gravity) prototype.ForceY = PV_Gravity(gravity);
|
||||
if (collision_func == "pass")
|
||||
{
|
||||
prototype.CollisionDensity = 9999;
|
||||
|
@ -901,8 +906,6 @@ private func EvalAct_CastParticles(proplist props, proplist context)
|
|||
{
|
||||
prototype.OnCollision = PC_Stop();
|
||||
}
|
||||
prototype.CollisionDensity=20;
|
||||
prototype.OnCollision = PC_Bounce(500);
|
||||
CreateParticle(particle_name, position[0], position[1], PV_Random(-speed, speed), PV_Random(-speed, speed), lifetime, prototype, amount);
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,8 @@ Lifetime=Lebenszeit
|
|||
CastParticlesLifetimeHelp=Anzahl Frames, die die Partikel existieren.
|
||||
Size=Groesse
|
||||
CastParticlesSizeHelp=Groesse der gestreuten Partikel.
|
||||
SizeEnd=Endgroesse
|
||||
CastParticlesSizeEndHelp=Groesse am Ende der Lebenszeit. Kann zum Beispiel auf 0 gesetzt werden, damit Partikel immer kleiner werden.
|
||||
Color=Farbe
|
||||
CastParticlesColorHelp=Farbe der gestreuten Partikel.
|
||||
BlitMode=Zeichenmodus
|
||||
|
@ -326,8 +328,10 @@ ParticleBlitModeHelp=Wie die Partikel ueber dem Hintergrund gezeichnet werden. A
|
|||
Normal=Normal
|
||||
Additive=Additiv
|
||||
Mod2=Mod2
|
||||
HasGravity=Gravitation
|
||||
ParticleGravityHelp=Ob Gravitation auf die Partikel wirkt.
|
||||
Gravity=Gravitation
|
||||
ParticleGravityHelp=Gravitationswirkung in Prozent. Bei 0 schweben die Partikel frei; bei 100 fallen sie wie jedes normale Objekt.
|
||||
FadeOut=Ausfaden
|
||||
ParticleFadeOutHelp=Ob die Partikel mit der Zeit transparenter werden.
|
||||
CollisionFunc=Kollisionsverhalten
|
||||
ParticleCollisionFuncHelp=Was mit den Partikeln passiert, wenn sie die Landschaft treffen.
|
||||
Pass=Passieren
|
||||
|
|
|
@ -319,6 +319,8 @@ Lifetime=Lifetime
|
|||
CastParticlesLifetimeHelp=Number of frames the particles exist.
|
||||
Size=Size
|
||||
CastParticlesSizeHelp=Size of cast particles.
|
||||
SizeEnd=End size
|
||||
CastParticlesSizeEndHelp=Size at the end of the particle's lifetime. Can be set to 0 to let the particle shrink into nothingness.
|
||||
Color=Color
|
||||
CastParticlesColorHelp=Color of cast particles.
|
||||
BlitMode=Draw mode
|
||||
|
@ -326,8 +328,10 @@ ParticleBlitModeHelp=How particles are drawn on top of the background. Additive:
|
|||
Normal=Normal
|
||||
Additive=Additive
|
||||
Mod2=Mod2
|
||||
HasGravity=Gravity
|
||||
ParticleGravityHelp=Whether gravity affects the particle.
|
||||
Gravity=Gravity
|
||||
ParticleGravityHelp=Gravitational pull on particle in percent of regular pull. 0: Particle floats freely. 100: Particle falls like any other object.
|
||||
FadeOut=Fade out
|
||||
ParticleFadeOutHelp=Whether particles become transparent over time.
|
||||
CollisionFunc=Collision behaviour
|
||||
ParticleCollisionFuncHelp=What happens to particles upon hitting the landscape.
|
||||
Pass=Pass through
|
||||
|
|
Loading…
Reference in New Issue