Identity notices time out
[wgj58.git] / wgj58.js
index 78cd42b4726f0c8bbda38238777fb2584f2b5f16..d737ad82fe0fb9f347e980b5c4453eeeee663870 100644 (file)
--- a/wgj58.js
+++ b/wgj58.js
@@ -160,6 +160,7 @@ class Player extends Phaser.Sprite {
                this.loadTexture(npc.key);
                npc.kill();
                this.disguise = npc;
+               logic.gameinterface.dropNoticeTimeout(Phaser.Timer.SECOND * 5, "You are now identified as " + npc.fullname + "!");
        }
 }
 
@@ -172,11 +173,13 @@ class GameNPC extends Phaser.Sprite {
                this.interaction_distance = interaction_distance;
                this.interactable = false;
                this.talkcount = 0;
+               this.happy = false;
        }
 
        kill() {
                super.kill();
                this.exists = false;
+               this.happy = false;                     // Dead people are not happy.
        }
 
        update() {
@@ -215,6 +218,11 @@ class GameNPC extends Phaser.Sprite {
                return true;
        }
 
+       makeHappy() {
+               this.happy = true;
+               console.log(this.shortname, "is happy!");
+       }
+
        offscreenTeleportation(newPosition, callback, callbackValue) {
                this.teleport_instructions = { newPosition: newPosition, callback: callback, callbackValue: callbackValue };
                console.log("Offscreen teleport request registered:", this.teleport_instructions);
@@ -508,6 +516,8 @@ class NPC_Saiki extends GameNPC {
 
        tpDone(value) {
                console.log("Woot-woot! Teleport complete:", value);
+               value.makeHappy();
+               logic.carlos.makeHappy();
        }
 }
 
@@ -583,6 +593,11 @@ class GameInterface extends Phaser.Group {
                this.text_notice.visible = true;
        }
 
+       dropNoticeTimeout(timeout, text) {
+               this.dropNotice(text);
+               game.time.events.add(timeout, this.clearNotice, this);
+       }
+
        clearNotice() {
                this.back_notice.visible = false;
                this.text_notice.visible = false;