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} = ecs.get(1) const layer = TileLayers.layer(0) Controlled.locked = 1 const [, direction] = Sprite.animation.split(':') for (let i = 0; i < 2; ++i) { Sound.play('/resources/hoe/dig.wav'); for (const {x, y} of projected) { Emitter.emit({ entity: { Behaving: { routines: { initial: 'await delta(entity.Forces, {forceY: {delta: 640, duration: 0.125}}).promise', }, }, Forces: {forceY: -80}, Position: { x: x * layer.tileSize.x + (layer.tileSize.x / 2), y: y * layer.tileSize.y + (layer.tileSize.y / 2), }, Sprite: { tint: 0x552200, }, Ttl: {ttl: 0.35}, }, fields: [ { path: ['Sprite', 'lightness'], value: [0.05, 0.25], }, { path: ['Sprite', 'alpha'], value: [0.5, 1], }, { path: ['Sprite', 'scale'], value: [0.05, 0.1], }, ], frequency: 0.05, shape: { type: 'filledRect', payload: {width: 12, height: 12}, }, spurt: 5, ttl: 0.4, }); } Sprite.animation = ['moving', direction].join(':'); await wait(0.3) Sprite.animation = ['idle', direction].join(':'); await wait(0.1) } for (const position of projected) { TileLayers.layer(1).stamp(position, [[7]]) } Controlled.locked = 0; }