mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-16 19:51:50 +00:00
belt hover for ejector belts
This commit is contained in:
parent
e23c3c17e2
commit
0d3a1efa67
@ -556,6 +556,7 @@ export class BeltSystem extends GameSystemWithFilter {
|
|||||||
this.root.systemMgr.systems.ejectorBelt.internalDrawChunk(parameters, chunk, {
|
this.root.systemMgr.systems.ejectorBelt.internalDrawChunk(parameters, chunk, {
|
||||||
animationIndex,
|
animationIndex,
|
||||||
simplifiedBelts,
|
simplifiedBelts,
|
||||||
|
hoveredBeltPath,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { DrawParameters } from "../../core/draw_parameters";
|
|||||||
import { Loader } from "../../core/loader";
|
import { Loader } from "../../core/loader";
|
||||||
import { Rectangle } from "../../core/rectangle";
|
import { Rectangle } from "../../core/rectangle";
|
||||||
import { enumDirectionToAngle } from "../../core/vector";
|
import { enumDirectionToAngle } from "../../core/vector";
|
||||||
|
import { BeltPath } from "../belt_path";
|
||||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||||
import { MapChunkView } from "../map_chunk_view";
|
import { MapChunkView } from "../map_chunk_view";
|
||||||
@ -27,8 +28,9 @@ export class EjectorBeltSystem extends GameSystemWithFilter {
|
|||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
* @param {number} param0.animationIndex
|
* @param {number} param0.animationIndex
|
||||||
* @param {boolean} param0.simplifiedBelts
|
* @param {boolean} param0.simplifiedBelts
|
||||||
|
* @param {BeltPath} param0.hoveredBeltPath
|
||||||
*/
|
*/
|
||||||
internalDrawChunk(parameters, chunk, { animationIndex, simplifiedBelts }) {
|
internalDrawChunk(parameters, chunk, { animationIndex, simplifiedBelts, hoveredBeltPath }) {
|
||||||
const contents = chunk.containedEntitiesByLayer.regular;
|
const contents = chunk.containedEntitiesByLayer.regular;
|
||||||
for (let i = 0; i < contents.length; ++i) {
|
for (let i = 0; i < contents.length; ++i) {
|
||||||
const entity = contents[i];
|
const entity = contents[i];
|
||||||
@ -40,7 +42,9 @@ export class EjectorBeltSystem extends GameSystemWithFilter {
|
|||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
for (let i = 0; i < ejectorComp.slots.length; ++i) {
|
for (let i = 0; i < ejectorComp.slots.length; ++i) {
|
||||||
// Extract underlay parameters
|
// Extract underlay parameters
|
||||||
const { pos, direction, beltLength, cachedTargetEntity } = ejectorComp.slots[i];
|
const { pos, direction, beltLength, cachedTargetEntity, cachedBeltPath } = ejectorComp.slots[
|
||||||
|
i
|
||||||
|
];
|
||||||
|
|
||||||
// skips both missing and 0 belt lengths
|
// skips both missing and 0 belt lengths
|
||||||
if (!beltLength) {
|
if (!beltLength) {
|
||||||
@ -87,7 +91,9 @@ export class EjectorBeltSystem extends GameSystemWithFilter {
|
|||||||
parameters.context.translate(x, y);
|
parameters.context.translate(x, y);
|
||||||
parameters.context.rotate(angleRadians);
|
parameters.context.rotate(angleRadians);
|
||||||
this.underlayBeltSprites[
|
this.underlayBeltSprites[
|
||||||
!simplifiedBelts ? animationIndex % BELT_ANIM_COUNT : 0
|
!simplifiedBelts || (cachedBeltPath && cachedBeltPath === hoveredBeltPath)
|
||||||
|
? animationIndex % BELT_ANIM_COUNT
|
||||||
|
: 0
|
||||||
].drawCachedWithClipRect(
|
].drawCachedWithClipRect(
|
||||||
parameters,
|
parameters,
|
||||||
-globalConfig.halfTileSize,
|
-globalConfig.halfTileSize,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user