diff --git a/app/ecs/components/light.js b/app/ecs/components/light.js
index b037771..4ace89b 100644
--- a/app/ecs/components/light.js
+++ b/app/ecs/components/light.js
@@ -2,6 +2,7 @@ import Component from '@/ecs/component.js';
export default class Light extends Component {
static properties = {
+ brightness: {defaultValue: 1, type: 'float32'},
radius: {type: 'uint8'},
};
}
diff --git a/app/react/components/pixi/entity.jsx b/app/react/components/pixi/entity.jsx
index e8a8cfe..aacd2c8 100644
--- a/app/react/components/pixi/entity.jsx
+++ b/app/react/components/pixi/entity.jsx
@@ -5,7 +5,7 @@ import {useDebug} from '@/react/context/debug.js';
import {useMainEntity} from '@/react/context/main-entity.js';
import Emitter from './emitter.jsx';
-// import Light from './light.jsx';
+import Light from './light.jsx';
import Sprite from './sprite.jsx';
function Aabb({color, width = 0.5, x0, y0, x1, y1, ...rest}) {
@@ -67,12 +67,13 @@ function Entity({entity, ...rest}) {
entity={entity}
/>
)}
- {/* {entity.Light && (
+ {entity.Light && (
- )} */}
+ )}
{debug && entity.Position && (
)}
diff --git a/app/react/components/pixi/light.jsx b/app/react/components/pixi/light.jsx
index f796874..7499d1c 100644
--- a/app/react/components/pixi/light.jsx
+++ b/app/react/components/pixi/light.jsx
@@ -3,8 +3,12 @@ import {PixiComponent} from '@pixi/react';
import {PointLight} from './lights.js';
const LightInternal = PixiComponent('Light', {
- create({x, y}) {
- const light = new PointLight(0xffffff - 0x2244cc, 1);
+ create({brightness, x, y}) {
+ const light = new PointLight(
+ 0xffffff - 0x2244cc,
+ 0//brightness,
+ );
+
light.position.set(x, y);
// light.shader.program.fragmentSrc = light.shader.program.fragmentSrc.replace(
// 'float D = length(lightVector)',
@@ -16,7 +20,7 @@ const LightInternal = PixiComponent('Light', {
// );
// light.falloff = [0.5, 5, 50];
// light.falloff = light.falloff.map((n, i) => n / (2 + i));
- // light.parentGroup = entityLighting.lightGroup;
+ // light.parentGroup = deferredLighting.lightGroup;
// delete light.parentGroup;
return light;
},
@@ -25,9 +29,10 @@ const LightInternal = PixiComponent('Light', {
},
});
-export default function Light({x, y}) {
+export default function Light({brightness, x, y}) {
return (
diff --git a/app/server/create/player.js b/app/server/create/player.js
index 287a04f..5373775 100644
--- a/app/server/create/player.js
+++ b/app/server/create/player.js
@@ -33,7 +33,7 @@ export default async function createPlayer(id) {
},
},
Health: {health: 100},
- Light: {},
+ Light: {brightness: 4},
Magnet: {strength: 24},
Player: {},
Position: {x: 128, y: 448},
diff --git a/public/assets/magic-swords/start.js b/public/assets/magic-swords/start.js
index 1267826..6136c70 100644
--- a/public/assets/magic-swords/start.js
+++ b/public/assets/magic-swords/start.js
@@ -29,6 +29,7 @@ for (let i = 0; i < N; ++i) {
Controlled: {},
Direction: {direction: Math.TAU * (i / N)},
Forces: {},
+ Light: {brightness: 0.1},
Owned: {owner: Player ? Player.id : 0},
Position: {x: Position.x, y: Position.y},
Speed: {},