From 4a74b999cdd78edbded8b89642f37b76f048002f Mon Sep 17 00:00:00 2001 From: Tobias Nett Date: Sun, 29 Nov 2020 23:34:52 +0100 Subject: [PATCH] feat(campfire): add particle effects for campfire --- assets/prefabs/blocks/CampFire.prefab | 3 +- assets/prefabs/particles/flames.prefab | 27 +++++++++ assets/prefabs/particles/smoke.prefab | 27 +++++++++ assets/textures/particles/fx_flame.png | Bin 0 -> 491 bytes assets/textures/particles/fx_smoke.png | Bin 0 -> 493 bytes .../particles/CampfireComponent.java | 18 ++++++ .../particles/CampfireParticleSystem.java | 57 ++++++++++++++++++ 7 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 assets/prefabs/particles/flames.prefab create mode 100644 assets/prefabs/particles/smoke.prefab create mode 100644 assets/textures/particles/fx_flame.png create mode 100644 assets/textures/particles/fx_smoke.png create mode 100644 src/main/java/org/terasology/manualLabor/particles/CampfireComponent.java create mode 100644 src/main/java/org/terasology/manualLabor/particles/CampfireParticleSystem.java diff --git a/assets/prefabs/blocks/CampFire.prefab b/assets/prefabs/blocks/CampFire.prefab index 1083173..47316bb 100644 --- a/assets/prefabs/blocks/CampFire.prefab +++ b/assets/prefabs/blocks/CampFire.prefab @@ -9,5 +9,6 @@ "paragraphText": [ "The camp fire lights up a bigger area than just a torch." ] - } + }, + "Campfire": {} } diff --git a/assets/prefabs/particles/flames.prefab b/assets/prefabs/particles/flames.prefab new file mode 100644 index 0000000..65774f5 --- /dev/null +++ b/assets/prefabs/particles/flames.prefab @@ -0,0 +1,27 @@ +{ + "location": {}, + "particleDataSprite": { + "texture": "ManualLabor:fx_flame" + }, + "energyRangeGenerator": { + "minEnergy": 0.5, + "maxEnergy": 2 + }, + "scaleRangeGenerator": { + "minScale": [0.01, 0.01, 0.01], + "maxScale": [0.5, 0.5, 0.5] + }, + "velocityRangeGenerator": { + "minVelocity": [0, 0.5, 0], + "maxVelocity": [0.4, 2, 0.4] + }, + "velocityAffector": {}, + "particleEmitter": { + "spawnRateMax": 20, + "spawnRateMin": 10, + "maxParticles": 100, + "particleCollision": false, + "destroyEntityWhenDead": true + }, + "network": {} +} \ No newline at end of file diff --git a/assets/prefabs/particles/smoke.prefab b/assets/prefabs/particles/smoke.prefab new file mode 100644 index 0000000..c2faf01 --- /dev/null +++ b/assets/prefabs/particles/smoke.prefab @@ -0,0 +1,27 @@ +{ + "location": {}, + "particleDataSprite": { + "texture": "ManualLabor:fx_smoke" + }, + "energyRangeGenerator": { + "minEnergy": 0.5, + "maxEnergy": 4 + }, + "scaleRangeGenerator": { + "minScale": [0.01, 0.01, 0.01], + "maxScale": [0.5, 0.5, 0.5] + }, + "velocityRangeGenerator": { + "minVelocity": [0, 0.3, 0], + "maxVelocity": [0.4, 1, 0.4] + }, + "velocityAffector": {}, + "particleEmitter": { + "spawnRateMax": 20, + "spawnRateMin": 10, + "maxParticles": 100, + "particleCollision": false, + "destroyEntityWhenDead": true + }, + "network": {} +} \ No newline at end of file diff --git a/assets/textures/particles/fx_flame.png b/assets/textures/particles/fx_flame.png new file mode 100644 index 0000000000000000000000000000000000000000..aab42dc2bc237e363c1d60eae2dbe4a8f34edeb4 GIT binary patch literal 491 zcmVk^*UbfY9ZD;(M=>56xR`?YL5 zDSRaCH{^iA*Gf;+`9*Q2&L4`6Xk;Gjs;4*ehZBET%Nlv%F=1amSJoQmQ8#g?3QLPp z2W1Xn5+O(cFA2)5lcU7A)PiKz+Bfm*Tc9W&P5wF+3~^-0iq|h{S-PgArbSQ5m!qO` z|DUIso|>$8cL$*J*|Oe8z_|;xs%3p2TUPA^98YjrX!?ti)6A#n)u!e<1kVVi=NMhzGy007qX0~FDyFB|{>002ovPDHLkV1m0N)h_@5 literal 0 HcmV?d00001 diff --git a/assets/textures/particles/fx_smoke.png b/assets/textures/particles/fx_smoke.png new file mode 100644 index 0000000000000000000000000000000000000000..a55f60da0d47cdf27b0a62f2470fb7fc8fee4565 GIT binary patch literal 493 zcmVk^*UbfY9ZD;(M=>56xR`?YL5 zDSRaCH{^iA*Gf;+`9*Q2&L4`6Xk;Gjs;4*ehZBET%Nlv%F=1amSJoQmQ8#g?3QLPp z2W1Xn5+O(cFA2)5lcU7A)PiKz+Bfm*Tc9W&P5wF+3~^-0iq|h{S-PgArbSQ5m!qO` z|DUIso|>$8cL$*J*|Oe8z_|;xs%3p2TUPA^98YjrX!?ti)6A#n)u!e<1kV { + l.setWorldPosition(new Vector3f(location)); + return l; + }); + builder.updateComponent(ParticleEmitterComponent.class, emitter -> { + emitter.ownerEntity = entity; + return emitter; + }); + builder.setOwner(entity); + return builder.build(); + } +}