mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
33 lines
757 B
JavaScript
33 lines
757 B
JavaScript
|
// @ts-nocheck
|
||
|
const METADATA = {
|
||
|
website: "https://tobspr.io",
|
||
|
author: "tobspr",
|
||
|
name: "Mod Example: Class Extensions",
|
||
|
version: "1",
|
||
|
id: "class-extensions",
|
||
|
description: "Shows how to extend builtin classes",
|
||
|
minimumGameVersion: ">=1.5.0",
|
||
|
};
|
||
|
|
||
|
const BeltExtension = ({ $super, $old }) => ({
|
||
|
getShowWiresLayerPreview() {
|
||
|
// Access the old method
|
||
|
return !$old.getShowWiresLayerPreview();
|
||
|
},
|
||
|
|
||
|
getIsReplaceable() {
|
||
|
// Instead of super, use $super
|
||
|
return $super.getIsReplaceable.call(this);
|
||
|
},
|
||
|
|
||
|
getIsRemoveable() {
|
||
|
return false;
|
||
|
},
|
||
|
});
|
||
|
|
||
|
class Mod extends shapez.Mod {
|
||
|
init() {
|
||
|
this.modInterface.extendClass(shapez.MetaBeltBuilding, BeltExtension);
|
||
|
}
|
||
|
}
|