Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganization of some Shape .ts files #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/ts/level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,24 @@ import { Marble, bounceParticleOptions } from "./marble";
import { Shape, SharedShapeData } from "./shape";
import { MissionElementSimGroup, MissionElementType, MissionElementStaticShape, MissionElementItem, MisParser, MissionElementTrigger, MissionElementInteriorInstance, MissionElementTSStatic, MissionElementParticleEmitterNode, MissionElementSky } from "./parsing/mis_parser";
import { StartPad } from "./shapes/start_pad";
import { SignFinish } from "./shapes/sign_finish";
import { SignPlain } from "./shapes/sign_plain";
import { EndPad, fireworkSmoke, redSpark, redTrail, blueSpark, blueTrail } from "./shapes/end_pad";
import { Gem } from "./shapes/gem";
import { SuperJump, superJumpParticleOptions } from "./shapes/super_jump";
import { SignCaution } from "./shapes/sign_caution";
import { SuperBounce } from "./shapes/super_bounce";
import { RoundBumper } from "./shapes/round_bumper";
import { RoundBumper, TriangleBumper } from "./shapes/abstract_bumper";
import { Helicopter } from "./shapes/helicopter";
import { DuctFan } from "./shapes/duct_fan";
import { DuctFan, SmallDuctFan } from "./shapes/duct_fan";
import { AntiGravity } from "./shapes/anti_gravity";
import { LandMine, landMineSmokeParticle, landMineSparksParticle } from "./shapes/land_mine";
import { ShockAbsorber } from "./shapes/shock_absorber";
import { SuperSpeed, superSpeedParticleOptions } from "./shapes/super_speed";
import { TimeTravel } from "./shapes/time_travel";
import { Tornado } from "./shapes/tornado";
import { TrapDoor } from "./shapes/trap_door";
import { TriangleBumper } from "./shapes/triangle_bumper";
import { Oilslick } from "./shapes/oilslick";
import { Util, Scheduler } from "./util";
import { PowerUp } from "./shapes/power_up";
import { isPressed, releaseAllButtons, gamepadAxes, getPressedFlag, resetPressedFlag, hideTouchControls, maybeShowTouchControls, setTouchControlMode } from "./input";
import { SmallDuctFan } from "./shapes/small_duct_fan";
import { PathedInterior } from "./pathed_interior";
import { Trigger } from "./triggers/trigger";
import { InBoundsTrigger } from "./triggers/in_bounds_trigger";
Expand All @@ -39,7 +34,7 @@ import { Replay } from "./replay";
import { Mission } from "./mission";
import { PushButton } from "./shapes/push_button";
import { state } from "./state";
import { Sign } from "./shapes/sign";
import { Sign, SignFinish, SignPlain, SignCaution } from "./shapes/sign";
import { Magnet } from "./shapes/magnet";
import { Nuke, nukeSmokeParticle, nukeSparksParticle } from "./shapes/nuke";
import { TeleportTrigger } from "./triggers/teleport_trigger";
Expand Down
11 changes: 11 additions & 0 deletions src/ts/shapes/abstract_bumper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,15 @@ export abstract class AbstractBumper extends Shape {

super.render(time);
}
}

/** The Bumpers. */
export class TriangleBumper extends AbstractBumper {
dtsPath = "shapes/bumpers/pball_tri.dts";
sounds = ["bumper1.wav"];
}

export class RoundBumper extends AbstractBumper {
dtsPath = "shapes/bumpers/pball_round.dts";
sounds = ["bumperding1.wav"];
}
20 changes: 20 additions & 0 deletions src/ts/shapes/duct_fan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ export class DuctFan extends ForceShape {
this.addConicForce(10, 2.617, 40);
}

async onLevelStart() {
this.soundSource = this.level.audio.createAudioSource(this.sounds[0], undefined, this.worldPosition);
this.soundSource.setLoop(true);
this.soundSource.play();
await this.soundSource.promise;
}
}

/** Blows the marble away, but not much. */
export class SmallDuctFan extends ForceShape {
dtsPath = "shapes/hazards/ductfan.dts";
sounds = ["fan_loop.wav"];
soundSource: AudioSource;

constructor() {
super();

this.addConicForce(5, 2.617, 10);
}

async onLevelStart() {
this.soundSource = this.level.audio.createAudioSource(this.sounds[0], undefined, this.worldPosition);
this.soundSource.setLoop(true);
Expand Down
7 changes: 0 additions & 7 deletions src/ts/shapes/round_bumper.ts

This file was deleted.

41 changes: 41 additions & 0 deletions src/ts/shapes/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,45 @@ export class Sign extends Shape {
}
}
}
}

/** A caution/danger sign. */
export class SignCaution extends Shape {
dtsPath = "shapes/signs/cautionsign.dts";
shareMaterials = false;

constructor(element: MissionElementStaticShape) {
super();

// Determine the type of the sign
let type = element.datablock.slice("SignCaution".length).toLowerCase();
switch (type) {
case "caution": this.matNamesOverride["base.cautionsign"] = "caution.cautionsign"; break;
case "danger": this.matNamesOverride["base.cautionsign"] = "danger.cautionsign"; break;
}
}
}

/** The flickering finish sign, usually above the finish pad. */
export class SignFinish extends Shape {
dtsPath = "shapes/signs/finishlinesign.dts";
}

/** A plain sign showing a direction, used in Marble Blast Gold. */
export class SignPlain extends Shape {
dtsPath = "shapes/signs/plainsign.dts";
shareMaterials = false;

constructor(element: MissionElementStaticShape) {
super();

// Determine the direction to show
let direction = element.datablock.slice("SignPlain".length).toLowerCase();
switch (direction) {
case "right": this.matNamesOverride["base.plainsign"] = "right.plainsign"; break;
case "left": this.matNamesOverride["base.plainsign"] = "left.plainsign"; break;
case "up": this.matNamesOverride["base.plainsign"] = "up.plainsign"; break;
case "down": this.matNamesOverride["base.plainsign"] = "down.plainsign"; break;
}
}
}
19 changes: 0 additions & 19 deletions src/ts/shapes/sign_caution.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/ts/shapes/sign_finish.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/ts/shapes/sign_plain.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/ts/shapes/small_duct_fan.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/ts/shapes/triangle_bumper.ts

This file was deleted.