This repository has been archived on 2021-02-20. You can view files and clone it, but cannot push or open issues or pull requests.
shapez.io/src/js/game/hud/parts/cat_memes.js

22 lines
669 B
JavaScript

import { makeDiv } from "../../../core/utils";
import { BaseHUDPart } from "../base_hud_part";
import { DynamicDomAttach } from "../dynamic_dom_attach";
const memeShowIntervalSeconds = 70 * 60;
const memeShowDuration = 5;
export class HUDCatMemes extends BaseHUDPart {
createElements(parent) {
this.element = makeDiv(parent, "ingame_HUD_CatMemes");
}
initialize() {
this.domAttach = new DynamicDomAttach(this.root, this.element);
}
update() {
const now = this.root.time.realtimeNow();
this.domAttach.update(now % memeShowIntervalSeconds > memeShowIntervalSeconds - memeShowDuration);
}
}