Hold a running game, and let the editor run reach into containers
Pause is a sub-state of play, not a third mode: the toolbar button and Ctrl+Enter stop ticking the world, the clock included. A held frame still drops the input edges, so resuming does not fire a pause worth of keys in one go. The editor run missed the case it is most wanted for. hasEditorRun only looked at the stored scene objects, so a behavior inside a placed container never started one; the world now builds from resolveObjects and writes back through objectRef, keeping the move as an instance edit instead of baking the instance out. Keys and clicks go to the run while the Game tab is on screen, where no key means anything to the editor, and are handed back on leaving it - held keys released, so nothing keeps walking unpressed.
This commit is contained in:
1 parent
8f31afac37
commit
9c4148dc1b
19 files changed
+838
-78
No files matched your search
@@ -5,6 +5,7 @@
|
||||
* the switch useful (a behavior can build or arrange content) and why it is off by default.
|
||||
*/
|
||||
import type { ObjectTree } from '../model/hierarchy';
|
||||
import { resolveObjects } from '../model/instance';
|
||||
import type { PropertyBag } from '../model/Properties';
|
||||
import { findAsset, type Project } from '../model/Project';
|
||||
import { resolveSceneObjectProps } from './resolve';
|
||||
@@ -13,9 +14,12 @@ export function runsInEditor(props: PropertyBag): boolean {
|
||||
return props.runInEditor === true;
|
||||
}
|
||||
|
||||
/** Whether a holder contains any behavior asking to run outside play mode. */
|
||||
/**
|
||||
* Whether a holder contains any behavior asking to run outside play mode – inside a placed
|
||||
* container as well, which is where such a behavior usually sits (the player of a level).
|
||||
*/
|
||||
export function hasEditorRun(project: Project, holder: ObjectTree): boolean {
|
||||
return holder.objects.some((object) => {
|
||||
return resolveObjects(project, holder).some((object) => {
|
||||
const asset = findAsset(project, object.assetId);
|
||||
return asset?.type === 'behavior' && runsInEditor(resolveSceneObjectProps(asset, object));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user