Add some more shapes

This commit is contained in:
RandomityGuy 2021-06-12 22:38:53 +05:30
parent bfae8b91d8
commit a5704ff8c5
4 changed files with 59 additions and 3 deletions

View file

@ -1,12 +1,13 @@
package shapes;
import mis.MissionElement.MissionElementItem;
import src.TimeState;
import src.DtsObject;
class Gem extends DtsObject {
public var pickedUp:Bool;
public function new() {
public function new(element:MissionElementItem) {
super();
dtsPath = "data/shapes/items/gem.dts";
ambientRotate = true;
@ -15,7 +16,9 @@ class Gem extends DtsObject {
showSequences = false; // Gems actually have an animation for the little shiny thing, but the actual game ignores that. I get it, it was annoying as hell.
var GEM_COLORS = ["blue", "red", "yellow", "purple", "green", "turquoise", "orange", "black"];
var color = GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)];
var color = element.datablock.substring("GemItem".length);
if (color.length == 0)
GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)];
this.identifier = "Gem" + color;
this.matNameOverride.set('base.gem', color + ".gem");
}

20
src/shapes/SignCaution.hx Normal file
View file

@ -0,0 +1,20 @@
package shapes;
import mis.MissionElement.MissionElementStaticShape;
import src.DtsObject;
class SignCaution extends DtsObject {
public function new(element:MissionElementStaticShape) {
super();
this.dtsPath = "data/shapes/signs/cautionsign.dts";
this.isCollideable = true;
var type = element.datablock.substring("SignCaution".length);
switch (type) {
case "Caution":
this.matNameOverride.set("base.cautionsign", "caution.cautionsign");
case "Danger":
this.matNameOverride.set("base.cautionsign", "danger.cautionsign");
}
}
}

26
src/shapes/SignPlain.hx Normal file
View file

@ -0,0 +1,26 @@
package shapes;
import mis.MissionElement.MissionElementStaticShape;
import src.DtsObject;
class SignPlain extends DtsObject {
public function new(element:MissionElementStaticShape) {
super();
this.dtsPath = "data/shapes/signs/plainsign.dts";
this.isCollideable = true;
// Determine the direction to show
var direction = element.datablock.substring("SignPlain".length);
switch (direction) {
case "Right":
this.matNameOverride.set("base.plainsign", "right.plainsign");
case "Left":
this.matNameOverride.set("base.plainsign", "left.plainsign");
case "Up":
this.matNameOverride.set("base.plainsign", "uo.plainsign");
case "Down":
this.matNameOverride.set("base.plainsign", "down.plainsign");
}
}
}

View file

@ -1,16 +1,23 @@
package shapes;
import mis.MissionElement.MissionElementItem;
import src.TimeState;
import mis.MisParser;
class TimeTravel extends PowerUp {
var timeBonus:Float = 5;
public function new() {
public function new(element:MissionElementItem) {
super();
this.dtsPath = "data/shapes/items/timetravel.dts";
this.isCollideable = false;
this.isTSStatic = false;
this.identifier = "TimeTravel";
if (element.timebonus != null) {
this.timeBonus = MisParser.parseNumber(element.timebonus) / 1000;
}
this.pickUpName = '${this.timeBonus} second Time Travel bonus';
this.cooldownDuration = 1e8;
this.useInstancing = true;