const {Direction, Position, Wielder} = wielder const projected = Wielder.activeItem()?.project(Position.tile, Direction.quantize(4)) if (projected?.length > 0) { const {Controlled, Emitter, Sound, Sprite} = wielder const {TileLayers, Water} = ecs.get(1) const layer = TileLayers.layer(0) Controlled.locked = 1 const [, direction] = Sprite.animation.split(':') Sprite.animation = ['idle', direction].join(':'); Sound.play('/assets/watering-can/water.wav'); for (const {x, y} of projected) { Emitter.emit({ count: 100, fields: [ { path: ['Sprite', 'lightness'], value: [0.111, 0.666], }, ], frequency: 0.005, shape: { type: 'filledRect', payload: {width: 16, height: 16}, }, entity: { Forces: {forceY: 400}, Position: { x: x * layer.tileSize.x + (layer.tileSize.x / 2), y: y * layer.tileSize.y - layer.tileSize.y, }, Sprite: { scaleX: 0.1, scaleY: 0.3, tint: 0x0022aa, }, Ttl: {ttl: 0.0625}, } }); } await wait(0.5); for (const {x, y} of projected) { const tileIndex = layer.area.x * y + x let w; if (Water.water[tileIndex]) { w = Water.water[tileIndex] } else { w = 0 } Water.water[tileIndex] = Math.min(255, 64 + w); } Controlled.locked = 0; }