Happy value
authorMegaBrutal <code+git@megabrutal.com>
Sun, 16 Sep 2018 02:40:40 +0000 (04:40 +0200)
committerMegaBrutal <code+git@megabrutal.com>
Sun, 16 Sep 2018 02:40:40 +0000 (04:40 +0200)
For NPCs, this indicates whether the character's special needs are
met.

modified:   wgj58.js

wgj58.js

index 78cd42b..a50e494 100644 (file)
--- a/wgj58.js
+++ b/wgj58.js
@@ -172,11 +172,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 +217,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 +515,8 @@ class NPC_Saiki extends GameNPC {
 
        tpDone(value) {
                console.log("Woot-woot! Teleport complete:", value);
+               value.makeHappy();
+               logic.carlos.makeHappy();
        }
 }