Skip to content

Commit

Permalink
so close
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle committed Feb 19, 2025
1 parent 2b51722 commit a08e3b1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
14 changes: 5 additions & 9 deletions OpenDreamClient/Rendering/DreamViewOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ private void ProcessIconComponents(DreamIcon icon, Vector2 position, EntityUid u

//query entity for particles component
//if it has one, add it to the result list
if(_particlesManager.TryGetParticleSystem(current.Uid, out var particlesSystem)){
current.Particles ??= new();
current.Particles.Add(particlesSystem);
}
foreach(var particleNetEntity in icon.Appearance.Particles)
if(_particlesManager.TryGetParticleSystem(_entityManager.GetEntity(particleNetEntity), out var particlesSystem)){
current.Particles ??= new();
current.Particles.Add(particlesSystem);
}

//flatten KeepTogetherGroup. Done here so we get implicit recursive iteration down the tree.
if (current.KeepTogetherGroup?.Count > 0) {
Expand Down Expand Up @@ -461,15 +462,10 @@ public void DrawIcon(DrawingHandleWorld handle, Vector2i renderTargetSize, Rende
var pixelPosition = (iconMetaData.Position + positionOffset) * EyeManager.PixelsPerMeter;

if(iconMetaData.Particles is not null) {

foreach(var particleSystem in iconMetaData.Particles){
var particleRenderTarget = _renderTargetPool.Rent(particleSystem.RenderSize);
handle.UseShader(GetBlendAndColorShader(iconMetaData, ignoreColor: true));
particleSystem.Draw(handle, pixelPosition);
handle.SetTransform(CalculateDrawingMatrix(iconMetaData.TransformToApply, pixelPosition-particleSystem.RenderSize/2, particleSystem.RenderSize, renderTargetSize));
handle.DrawTextureRect(particleRenderTarget.Texture, Box2.FromDimensions(Vector2.Zero, particleSystem.RenderSize));

_renderTargetPool.ReturnAtEndOfFrame(particleRenderTarget);
}
}
//if frame is null, this doesn't require a draw, so return NOP
Expand Down
8 changes: 6 additions & 2 deletions OpenDreamRuntime/Objects/Types/DreamObjectParticles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ public sealed class DreamObjectParticles : DreamObject {
private List<string> _iconStates = new();

public DreamObjectParticles(DreamObjectDefinition objectDefinition) : base(objectDefinition) {
Entity = EntityManager.SpawnEntity(null, new MapCoordinates(0, 0, MapId.Nullspace)); //spawning an entity in nullspace means it never actually gets sent to any clients until it's placed on the map, or it gets a PVS override
Entity = EntityManager.SpawnEntity(null, new MapCoordinates(0, 0, MapId.Nullspace)); //spawning an entity in nullspace means it never actually gets sent to any clients until it's put in the particles list on an atom, when PVS override happens
ParticlesComponent = EntityManager.AddComponent<DreamParticlesComponent>(Entity);
//populate component with settings from type
foreach(KeyValuePair<string,DreamValue> kv in objectDefinition.Variables){
if(objectDefinition.ConstVariables is not null && !objectDefinition.ConstVariables.Contains(kv.Key))
SetVar(kv.Key, kv.Value);
}
//check if I need to manually send update events to the component?
//collect entities client-side for the rendermetadata
}

protected override void SetVar(string varName, DreamValue value) {
Expand Down Expand Up @@ -285,6 +288,7 @@ protected override void SetVar(string varName, DreamValue value) {
}
break;
}

base.SetVar(varName, value); //all calls should set the internal vars, so GetVar() can just be default also
}
}
24 changes: 12 additions & 12 deletions OpenDreamShared/Rendering/DreamParticlesComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace OpenDreamShared.Rendering;

[NetworkedComponent]
public abstract partial class SharedDreamParticlesComponent : Component {
[ViewVariables(VVAccess.ReadWrite)] public int Width = 640;
[ViewVariables(VVAccess.ReadWrite)] public int Height = 480;
[ViewVariables(VVAccess.ReadWrite)] public int Count = 1000;
[ViewVariables(VVAccess.ReadWrite)] public float Spawning = 100;
[ViewVariables(VVAccess.ReadWrite)] public int Width;
[ViewVariables(VVAccess.ReadWrite)] public int Height;
[ViewVariables(VVAccess.ReadWrite)] public int Count;
[ViewVariables(VVAccess.ReadWrite)] public float Spawning;
[ViewVariables(VVAccess.ReadWrite)] public Vector3 Bound1;
[ViewVariables(VVAccess.ReadWrite)] public Vector3 Bound2;
[ViewVariables(VVAccess.ReadWrite)] public Vector3 Gravity;
Expand All @@ -25,11 +25,11 @@ public abstract partial class SharedDreamParticlesComponent : Component {
[ViewVariables(VVAccess.ReadWrite)] public float LifespanHigh;
[ViewVariables(VVAccess.ReadWrite)] public float LifespanLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType LifespanType;

Check failure on line 27 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 27 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)
[ViewVariables(VVAccess.ReadWrite)] public int FadeInHigh = 0;
[ViewVariables(VVAccess.ReadWrite)] public int FadeInLow = 0;
[ViewVariables(VVAccess.ReadWrite)] public int FadeInHigh;
[ViewVariables(VVAccess.ReadWrite)] public int FadeInLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType FadeInType;

Check failure on line 30 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)
[ViewVariables(VVAccess.ReadWrite)] public int FadeOutHigh = 0;
[ViewVariables(VVAccess.ReadWrite)] public int FadeOutLow = 0;
[ViewVariables(VVAccess.ReadWrite)] public int FadeOutHigh;
[ViewVariables(VVAccess.ReadWrite)] public int FadeOutLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType FadeOutType;

Check failure on line 33 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 33 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

[ViewVariables(VVAccess.ReadWrite)] public Vector3 SpawnPositionHigh;
Expand All @@ -51,16 +51,16 @@ public abstract partial class SharedDreamParticlesComponent : Component {
[ViewVariables(VVAccess.ReadWrite)] public Vector2 ScaleLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType ScaleType;

Check failure on line 52 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 52 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)
//Rotation applied to the particles in degrees
[ViewVariables(VVAccess.ReadWrite)] public float RotationHigh = 0;
[ViewVariables(VVAccess.ReadWrite)] public float RotationLow = 0;
[ViewVariables(VVAccess.ReadWrite)] public float RotationHigh;
[ViewVariables(VVAccess.ReadWrite)] public float RotationLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType RotationType;

Check failure on line 56 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)
//Increase in scale per second
[ViewVariables(VVAccess.ReadWrite)] public Vector2 GrowthHigh;
[ViewVariables(VVAccess.ReadWrite)] public Vector2 GrowthLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType GrowthType;

Check failure on line 60 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 60 in OpenDreamShared/Rendering/DreamParticlesComponent.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ParticlePropertyType' could not be found (are you missing a using directive or an assembly reference?)
//Change in rotation per second
[ViewVariables(VVAccess.ReadWrite)] public float SpinHigh = 0;
[ViewVariables(VVAccess.ReadWrite)] public float SpinLow = 0;
[ViewVariables(VVAccess.ReadWrite)] public float SpinHigh;
[ViewVariables(VVAccess.ReadWrite)] public float SpinLow;
[ViewVariables(VVAccess.ReadWrite)] public ParticlePropertyType SpinType;
[ViewVariables(VVAccess.ReadWrite)] public Vector3 DriftHigh;
[ViewVariables(VVAccess.ReadWrite)] public Vector3 DriftLow;
Expand Down

0 comments on commit a08e3b1

Please sign in to comment.