]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow persistent monster names
authorMario <zacjardine@y7mail.com>
Sun, 9 Sep 2018 12:44:15 +0000 (22:44 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 9 Sep 2018 12:44:15 +0000 (22:44 +1000)
qcsrc/common/monsters/sv_monsters.qc
qcsrc/server/command/common.qc

index 517e8494c85287f0e04ad974432fd0c3197d436a..938d22c4645a43fa1d9f695e8fd2a7ca562995b9 100644 (file)
@@ -1352,6 +1352,9 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id)
        else
                setmodel(this, mon.m_model);
 
+       if(!this.monster_name || this.monster_name == "")
+               this.monster_name = mon.monster_name;
+
        this.flags                              = FL_MONSTER;
        this.classname                  = "monster";
        this.takedamage                 = DAMAGE_AIM;
@@ -1379,7 +1382,6 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id)
        this.reset                              = Monster_Reset;
        this.netname                    = mon.netname;
        this.monster_attackfunc = mon.monster_attackfunc;
-       this.monster_name               = mon.monster_name;
        this.candrop                    = true;
        this.oldtarget2                 = this.target2;
        //this.pass_distance            = 0;
index 643afa3f177887ff8ab2754a30c882eb90263231..c39a1ba5ce657266a378d974bc885616dc508f20 100644 (file)
@@ -354,7 +354,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                        string mon_oldname = mon.monster_name;
 
                                        mon.monster_name = argument;
-                                       if (mon.sprite)   WaypointSprite_UpdateSprites(mon.sprite, WP_Monster, WP_Null, WP_Null);
+                                       if (mon.sprite)   WaypointSprite_UpdateSprites(mon.sprite, WP_Monster, WP_Null, WP_Null); // TODO: the new name is never actually sent to CSQC!
                                        print_to(caller, sprintf("Your pet '%s' is now known as '%s'", mon_oldname, mon.monster_name));
                                        return;
                                }