mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 21:21:41 +00:00
add support for marble attribute changing
This commit is contained in:
parent
4743684298
commit
f40914f071
4 changed files with 37 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import mis.MisParser;
|
||||||
import triggers.Trigger;
|
import triggers.Trigger;
|
||||||
import net.Net;
|
import net.Net;
|
||||||
import gui.MarbleSelectGui;
|
import gui.MarbleSelectGui;
|
||||||
|
|
@ -581,6 +582,8 @@ class Marble extends GameObject {
|
||||||
worker.addTask(fwd -> level.addDtsObject(this.helicopter, fwd));
|
worker.addTask(fwd -> level.addDtsObject(this.helicopter, fwd));
|
||||||
worker.addTask(fwd -> level.addDtsObject(this.megaHelicopter, fwd));
|
worker.addTask(fwd -> level.addDtsObject(this.megaHelicopter, fwd));
|
||||||
worker.run();
|
worker.run();
|
||||||
|
|
||||||
|
loadMarbleAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildShadowVolume() {
|
function buildShadowVolume() {
|
||||||
|
|
@ -662,6 +665,36 @@ class Marble extends GameObject {
|
||||||
shadowVolume.setRotationQuat(q);
|
shadowVolume.setRotationQuat(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadMarbleAttributes() {
|
||||||
|
var attribs = this.level.mission.marbleAttributes;
|
||||||
|
if (attribs.exists("maxrollvelocity"))
|
||||||
|
this._maxRollVelocity = MisParser.parseNumber(attribs.get("maxrollvelocity"));
|
||||||
|
if (attribs.exists("angularacceleration"))
|
||||||
|
this._angularAcceleration = MisParser.parseNumber(attribs.get("angularacceleration"));
|
||||||
|
if (attribs.exists("jumpimpulse"))
|
||||||
|
this._jumpImpulse = MisParser.parseNumber(attribs.get("jumpimpulse"));
|
||||||
|
if (attribs.exists("kineticfriction"))
|
||||||
|
this._kineticFriction = MisParser.parseNumber(attribs.get("kineticfriction"));
|
||||||
|
if (attribs.exists("staticfriction"))
|
||||||
|
this._staticFriction = MisParser.parseNumber(attribs.get("staticfriction"));
|
||||||
|
if (attribs.exists("brakingacceleration"))
|
||||||
|
this._brakingAcceleration = MisParser.parseNumber(attribs.get("brakingacceleration"));
|
||||||
|
if (attribs.exists("gravity"))
|
||||||
|
this._gravity = MisParser.parseNumber(attribs.get("gravity"));
|
||||||
|
if (attribs.exists("airaccel"))
|
||||||
|
this._airAccel = MisParser.parseNumber(attribs.get("airaccel"));
|
||||||
|
if (attribs.exists("maxdotslide"))
|
||||||
|
this._maxDotSlide = MisParser.parseNumber(attribs.get("maxdotslide"));
|
||||||
|
if (attribs.exists("minbouncevel"))
|
||||||
|
this._minBounceVel = MisParser.parseNumber(attribs.get("minbouncevel"));
|
||||||
|
if (attribs.exists("minbouncespeed"))
|
||||||
|
this._minBounceSpeed = MisParser.parseNumber(attribs.get("minbouncespeed"));
|
||||||
|
if (attribs.exists("mintrailvel"))
|
||||||
|
this._minTrailVel = MisParser.parseNumber(attribs.get("mintrailvel"));
|
||||||
|
if (attribs.exists("bouncekineticfriction"))
|
||||||
|
this._bounceKineticFriction = MisParser.parseNumber(attribs.get("bouncekineticfriction"));
|
||||||
|
}
|
||||||
|
|
||||||
function findContacts(collisiomWorld:CollisionWorld, timeState:TimeState) {
|
function findContacts(collisiomWorld:CollisionWorld, timeState:TimeState) {
|
||||||
this.contacts = queuedContacts;
|
this.contacts = queuedContacts;
|
||||||
CollisionPool.clear();
|
CollisionPool.clear();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class MarbleGame {
|
||||||
|
|
||||||
static var instance:MarbleGame;
|
static var instance:MarbleGame;
|
||||||
|
|
||||||
static var currentVersion = "1.6.1";
|
static var currentVersion = "1.7.0";
|
||||||
|
|
||||||
var world:MarbleWorld;
|
var world:MarbleWorld;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class Mission {
|
||||||
#if js
|
#if js
|
||||||
public var addedAt:Int;
|
public var addedAt:Int;
|
||||||
#end
|
#end
|
||||||
|
public var marbleAttributes:Map<String, String>;
|
||||||
|
|
||||||
var next:Mission;
|
var next:Mission;
|
||||||
|
|
||||||
|
|
@ -71,6 +72,7 @@ class Mission {
|
||||||
var misParser = new MisParser(misText);
|
var misParser = new MisParser(misText);
|
||||||
var contents = misParser.parse();
|
var contents = misParser.parse();
|
||||||
root = contents.root;
|
root = contents.root;
|
||||||
|
marbleAttributes = contents.marbleAttributes;
|
||||||
|
|
||||||
function scanMission(simGroup:MissionElementSimGroup) {
|
function scanMission(simGroup:MissionElementSimGroup) {
|
||||||
for (element in simGroup.elements) {
|
for (element in simGroup.elements) {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class MisParser {
|
||||||
startText = outsideText;
|
startText = outsideText;
|
||||||
|
|
||||||
while (marbleAttributesRegEx.match(startText)) {
|
while (marbleAttributesRegEx.match(startText)) {
|
||||||
marbleAttributes.set(marbleAttributesRegEx.matched(1), this.resolveExpression(marbleAttributesRegEx.matched(2)));
|
marbleAttributes.set(marbleAttributesRegEx.matched(1).toLowerCase(), this.resolveExpression(marbleAttributesRegEx.matched(2)));
|
||||||
startText = marbleAttributesRegEx.matchedRight();
|
startText = marbleAttributesRegEx.matchedRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue