mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-16 03:31:52 +00:00
update belt comments
This commit is contained in:
parent
88b12c685d
commit
ec54093fc6
@ -8,6 +8,7 @@ import { GameSystemWithFilter } from "../game_system_with_filter";
|
|||||||
import { MapChunkView } from "../map_chunk_view";
|
import { MapChunkView } from "../map_chunk_view";
|
||||||
import { BELT_ANIM_COUNT } from "./belt";
|
import { BELT_ANIM_COUNT } from "./belt";
|
||||||
|
|
||||||
|
// nearly identical to systems/ejector_belt.js
|
||||||
export class AcceptorBeltSystem extends GameSystemWithFilter {
|
export class AcceptorBeltSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [ItemAcceptorComponent]);
|
super(root, [ItemAcceptorComponent]);
|
||||||
@ -25,9 +26,8 @@ export class AcceptorBeltSystem extends GameSystemWithFilter {
|
|||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
// Limit speed to avoid belts going backwards
|
|
||||||
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
|
||||||
// SYNC with systems/belt.js:drawChunk!
|
// SYNC with systems/belt.js:drawChunk!
|
||||||
|
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
||||||
const animationIndex = Math.floor(
|
const animationIndex = Math.floor(
|
||||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||||
globalConfig.itemSpacingOnBelts
|
globalConfig.itemSpacingOnBelts
|
||||||
|
|||||||
@ -494,9 +494,9 @@ export class BeltSystem extends GameSystemWithFilter {
|
|||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
|
// SYNC with systems/acceptor_belt.js:drawChunk and systems/ejector_belt.js:drawChunk!
|
||||||
// Limit speed to avoid belts going backwards
|
// Limit speed to avoid belts going backwards
|
||||||
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
||||||
// SYNC with systems/belt_underlays.js:drawChunk!
|
|
||||||
// 126 / 42 is the exact animation speed of the png animation
|
// 126 / 42 is the exact animation speed of the png animation
|
||||||
const animationIndex = Math.floor(
|
const animationIndex = Math.floor(
|
||||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { GameSystemWithFilter } from "../game_system_with_filter";
|
|||||||
import { MapChunkView } from "../map_chunk_view";
|
import { MapChunkView } from "../map_chunk_view";
|
||||||
import { BELT_ANIM_COUNT } from "./belt";
|
import { BELT_ANIM_COUNT } from "./belt";
|
||||||
|
|
||||||
|
// nearly identical to systems/acceptor_belt.js
|
||||||
export class EjectorBeltSystem extends GameSystemWithFilter {
|
export class EjectorBeltSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [ItemEjectorComponent]);
|
super(root, [ItemEjectorComponent]);
|
||||||
@ -25,9 +26,8 @@ export class EjectorBeltSystem extends GameSystemWithFilter {
|
|||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
// Limit speed to avoid belts going backwards
|
|
||||||
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
|
||||||
// SYNC with systems/belt.js:drawChunk!
|
// SYNC with systems/belt.js:drawChunk!
|
||||||
|
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
|
||||||
const animationIndex = Math.floor(
|
const animationIndex = Math.floor(
|
||||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||||
globalConfig.itemSpacingOnBelts
|
globalConfig.itemSpacingOnBelts
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user