Compile Time Changes

MhEngineEntryBase changes

Deprecated the following and replaced with a new method. This is so that an Object arg can be passed into sortFunc.

Deprecated: extend public MhEngineEntry[] sortedChildren(MhEngine engine, function(MhEngineEntry, MhEngineEntry, Object):int sortFunc) : deprecated {
New: extend public MhEngineEntry[] sortedChildren(MhEngine engine, function(MhEngineEntry, MhEngineEntry, Object):int sortFunc, Object arg=null) {

MhEngineConstructionEntry changes

Now MhEngineConstructionEntry has a field assortmentClassification, determining which assortment this entry comes from and belongs to.

Added: public LayerSet assortmentClassification : copy=reference;
Added: extend public LayerSet assortmentClassification() {
Added: extend public LayerSet assortmentClassification=(LayerSet a) {

Thus, exporting entry now at MhRowExportFunction will check for the entry assortmentClassification, to get the correct spawner selector and assortment.

Old: 
    s = entry.spawnSnapper(engine.MhEngine, getSpawnerSelector());
New: 
        LayerSet assortClassi = entry.assortmentClassification;
        if (assortClassi) s = entry.spawnSnapper(engine.MhEngine, assortment.spawnerSelector(assortClassi));
        else s = entry.spawnSnapper(engine.MhEngine, configuration.spawnerSelector);

Add assortmentClassification as an argument on the constructors.

Old: public constructor(box b, Transform t, LayerSet classification=null) : deprecated {
Old: public constructor(box b, LayerSet classification) : deprecated {
New: public constructor(box b, Transform t, LayerSet classification=null, LayerSet assortClassification=null) {
New: public constructor(box b, LayerSet classification, LayerSet assortClassification=null) {

Therefore, all MhEngineConstructionEntry instantiations now pass in the assortment's classification as an argument.

Runtime/Behavior Changes

mhEngine changes

Added additional PropDefs to MhEngine during developMode when getting MhEngine using MhEngine mhEngine(Space space, bool createIfNone=true, class MhSystemEngineEnvironment environment=null) for engine visualiser functionality. Additional PropDefs include:

  • spaceKey representing space id string
  • plugIn representing a flag if the engine originates from a regular space or a MhDebugPlugInFunctionSpace plug in function space
/**
 * MH Engine.
 */
public MhEngine mhEngine(Space space, bool createIfNone=true, class MhSystemEngineEnvironment environment=null) {
    ...
        if (developMode) {
            engine."spaceKey" = space.id;
            engine."plugIn" = space in MhDebugPlugInFunctionSpace;
        }
    ...
}

MhEngineFunctionLibrary changes

Modified Object exec(CxEngine engine, str key, str->Object args) to run the engine plug in function replacement process during developMode when the engine visualiser alternate plug in space is enabled and engine is from the plug in function space.

/**
 * Library of functions for an CxEngine.
 */
public class MhEngineFunctionLibrary extends CxFunctionLibrary {

Old:
    /**
     * Run.
     */
    public Object exec(CxEngine engine, str key, str->Object args) {
        ...
            if (developMode) appendToRecentRunned(MhEngineFunctionRun(key, args), fun);
            if (dbg_engineVisualisationEnabled()) engineVisualiserBeforeRun(key, args, fun);

            Object res = fun.exec(args);

            if (dbg_engineVisualisationEnabled()) engineVisualiserAfterRun(key, args, fun);

            return res;
        ...
    }


New:
    /**
     * Run.
     */
    public Object exec(CxEngine engine, str key, str->Object args) {
        ...
            if (developMode and dbg_engineVisualisationEnabled) {
                return dbg_engineVisualisationExecFunction(this, fun, args);
            }

            if (developMode) appendToRecentRunned(MhEngineFunctionRun(key, args), fun);

            return fun.exec(args);
        }
        ...
    }

MhSnapperShape changes

Modified Object setPropertyValue(str key, Object value, CoreProperty property, CoreProperties properties, Object env=null) to pipe changes from the main space to the plug in function space when the engine visualiser alternate plug in space is enabled.

/**
 * Mh snapper shape.
 */
public class MhSnapperShape extends CorePropObj {

    /**
     * Set property value.
     */
    public Object setPropertyValue(str key, Object value, CoreProperty property,
                                   CoreProperties properties, Object env=null) {
        if (dbg_engineVisualisationDebugSpaceEnabled and value and !value.equal(get(key, env))) {
            mhDebugPlugInFunctionSpaceManager.pipeSetPropertyValue(owner, key, value, property, properties, env);
        }
        return super(..);
    }
}

MhCollisionFetchEnv new fetch reason #engine

We now use a #engine symbol as a new fetch reason for collection of collision primitives with MhCollisionFetchEnv. This symbol is used specifically in MhSnapper.setEngineEntryCollisionPrimitive(MhEngineEntry entry) where we collect collision primitives and assign it to an engine entry.

Check for this new fetch reason when appending collision primitives that are meant only for use with engine functions.

/**
 * Abstract industry (generation 2) snapper base class.
 */
public class MhSnapper extends Snapper {

Old:
    /**
     * Update engine entry collision primitive.
     */
    extend public void setEngineEntryCollisionPrimitive(MhEngineEntry entry) {
        if (entry as MhEngineCollisionEntry) {
            MhCollisionFetchEnv env();
            CollisionPrimitive prim = localCollisionPrimitive(env);
            CollisionPrimitiveSet set(null, null);
            set.subPrims <<? prim;
            entry.setPrim(set);
        }
    }


New:
    /**
     * Update engine entry collision primitive.
     */
    extend public void setEngineEntryCollisionPrimitive(MhEngineEntry entry) {
        if (entry as MhEngineCollisionEntry) {
            MhCollisionFetchEnv env(#engine);
            CollisionPrimitive prim = localCollisionPrimitive(env);
            CollisionPrimitiveSet set(null, null);
            set.subPrims <<? prim;
            entry.setPrim(set);
        }
    }