more cludge on the cludge pile to fix getProp/ActorName

This commit is contained in:
2024-09-25 17:15:28 -05:00
parent 8484eac100
commit e54f37b540
2 changed files with 9 additions and 2 deletions

View File

@@ -64,6 +64,9 @@ interface Director<Set, Actor, Sound, Song, Prop, VoiceTrack, Camera, LightSourc
function showCharacter(character:Character<Actor>, appearance:Appearance, camera:Camera, cc:Continuation):Void;
function hideCharacter(character:Character<Actor>, camera:Camera, cc:Continuation):Void;
function propEquals(propA:Prop, propB:Prop):Bool;
function actorEquals(propA:Actor, propB:Actor):Bool;
function loadSound(path:String):Sound;
function playSound(sound:Sound, volumeMod:Float, ?cc:Continuation):Void;
function getSoundLength(sound:Sound):Float;

View File

@@ -299,7 +299,9 @@
(prop :Array<Array<Dynamic>> propNames [])
(method :String getPropName [:Prop prop]
(doFor [_prop name] propNames
(when (= prop _prop) (return name)))
(unless (.exists .props (_currentScene) name)
(continue))
(when (director.propEquals prop _prop) (return name)))
(throw "Couldn't get name of prop $prop in $propNames"))
(method _addProp [name :Prop prop]
@@ -329,7 +331,9 @@
(prop :Array<Array<Dynamic>> actorNames [])
(method :String getActorName [:Actor actor]
(doFor [_actor name] actorNames
(when (= actor _actor) (return name)))
(unless (.exists .characters (_currentScene) name)
(continue))
(when (director.actorEquals actor _actor) (return name)))
(throw "Couldn't get name of actor $actor in $actorNames"))
(method _addActor [name :Actor actor]