From b0c72809acbe742d2fa226c01b65baf347c8457c Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 14 Nov 2014 13:28:27 +1100 Subject: [PATCH] Some random fixes and stuff (centerprints converted to notifications, less spam when using target_music with bots) --- qcsrc/common/mapinfo.qc | 2 +- qcsrc/common/notifications.qh | 11 ++++++++++- qcsrc/server/t_plats.qc | 14 +++++++------- qcsrc/server/target_music.qc | 9 +++++---- qcsrc/server/teamplay.qc | 16 ++++------------ 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index b060b375f..830c86db9 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1015,7 +1015,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo { t = car(s); s = cdr(s); f = MapInfo_Type_FromString(t); - print("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n"); + dprint("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n"); if(f) _MapInfo_Map_ApplyGametype (s, pGametypeToSet, f, TRUE); else diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 60cc622fa..2afd2987c 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -490,7 +490,9 @@ void Send_Notification_WOCOVA( MSG_INFO_NOTIF(1, INFO_RACE_NEW_SET, 1, 2, "s1 race_col f1ord race_col f2race_time", "s1 f2race_time", "race_newrecordserver", _("^BG%s^BG set the %s%s^BG place record with %s%s"), "") \ MULTITEAM_INFO(1, INFO_SCORES_, 4, 0, 0, "", "", "", _("^TC^TT ^BGteam scores!"), "") \ MSG_INFO_NOTIF(1, INFO_SPECTATE_WARNING, 0, 1, "f1secs", "", "", _("^F2You have to become a player within the next %s, otherwise you will be kicked, because spectating isn't allowed at this time!"), "") \ - MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_PICKUP, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up a Superweapon"), "") \ + MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_PICKUP, 1, 0, "s1", "s1", "superweapons", _("^BG%s^K1 picked up a Superweapon"), "") \ + MSG_INFO_NOTIF(1, INFO_TEAMCHANGE_LARGERTEAM, 0, 0, "", "", "", _("^BGYou cannot change to a larger team"), "") \ + MSG_INFO_NOTIF(1, INFO_TEAMCHANGE_NOTALLOWED, 0, 0, "", "", "", _("^BGYou are not allowed to change teams"), "") \ MSG_INFO_NOTIF(2, INFO_VERSION_BETA, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s (beta)^BG, you have ^F2Xonotic %s"), "") \ MSG_INFO_NOTIF(2, INFO_VERSION_OLD, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s^BG, you have ^F2Xonotic %s"), "") \ MSG_INFO_NOTIF(2, INFO_VERSION_OUTDATED, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^F1Xonotic %s^BG is out, and you still have ^F2Xonotic %s^BG - get the update from ^F3http://www.xonotic.org/^BG!"), "") \ @@ -634,6 +636,9 @@ void Send_Notification_WOCOVA( MSG_CENTER_NOTIF(1, CENTER_DEATH_TEAMKILL_FRAG, 1, 0, "s1", NO_CPID, "0 0", _("^K1Moron! You fragged ^BG%s^K1, a team mate!"), _("^K1Moron! You went against ^BG%s^K1, a team mate!")) \ MSG_CENTER_NOTIF(1, CENTER_DEATH_TEAMKILL_FRAGGED, 1, 0, "s1", NO_CPID, "0 0", _("^K1You were fragged by ^BG%s^K1, a team mate"), _("^K1You were scored against by ^BG%s^K1, a team mate")) \ MSG_CENTER_NOTIF(1, CENTER_DISCONNECT_IDLING, 0, 1, "", CPID_IDLING, "1 f1", _("^K1Stop idling!\n^BGDisconnecting in ^COUNT..."), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_LOCKED_NEED, 0, 0, "", NO_CPID, "0 0", _("^BGYou need %s^BG!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_LOCKED_ALSONEED, 0, 0, "", NO_CPID, "0 0", _("^BGYou also need %s^BG!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_UNLOCKED, 0, 0, "", NO_CPID, "0 0", _("^BGDoor unlocked!"), "") \ MSG_CENTER_NOTIF(1, CENTER_EXTRALIVES, 0, 0, "", NO_CPID, "0 0", _("^F2You picked up some extra lives"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FREEZE, 1, 0, "s1", NO_CPID, "0 0", _("^K3You froze ^BG%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FROZEN, 1, 0, "s1", NO_CPID, "0 0", _("^K1You were frozen by ^BG%s"), "") \ @@ -688,6 +693,9 @@ void Send_Notification_WOCOVA( MSG_CENTER_NOTIF(1, CENTER_POWERUP_SPEED, 0, 0, "", CPID_POWERUP, "0 0", _("^F2You are on speed"), "") \ MSG_CENTER_NOTIF(1, CENTER_POWERUP_STRENGTH, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Strength infuses your weapons with devastating power"), "") \ MSG_CENTER_NOTIF(1, CENTER_RACE_FINISHLAP, 0, 0, "", CPID_RACE_FINISHLAP, "0 0", _("^F2The race is over, finish your lap!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COMPLETED, 0, 0, "", NO_CPID, "0 0", _("^BGSequence completed!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COUNTER, 0, 0, "", NO_CPID, "0 0", _("^BGThere are more to go..."), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COUNTER_FEWMORE, 0, 1, "f1", NO_CPID, "0 0", _("^BGOnly %s^BG more to go..."), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_BROKEN, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have broken down"), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_LOST, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have been lost"), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_PICKUP, 0, 0, "", CPID_POWERUP, "0 0", _("^F2You now have a superweapon"), "") \ @@ -1524,6 +1532,7 @@ void RegisterNotifications_First() #endif printf("Beginning notification initialization on %s%s program...\n", dedi, PROGNAME); + #undef dedi // maybe do another implementation of this with checksums? for now, we don't need versioning /*if(autocvar_notification_version != NOTIF_VERSION) diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index beccc7179..d3f72b7eb 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -528,7 +528,7 @@ void func_bobbing_controller_think() vector v; self.nextthink = time + 0.1; - if (!(self.owner.active == ACTIVE_ACTIVE)) + if(self.owner.active != ACTIVE_ACTIVE) { self.owner.velocity = '0 0 0'; return; @@ -745,7 +745,7 @@ void button_reset() void button_use() { - if (!(self.active == ACTIVE_ACTIVE)) + if(self.active != ACTIVE_ACTIVE) return; self.enemy = activator; @@ -1012,14 +1012,14 @@ float door_check_keys(void) { // some keys were used if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); - centerprint(other, strcat("You also need ", item_keys_keylist(door.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; } } else { // no keys were used if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); - centerprint(other, strcat("You need ", item_keys_keylist(door.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; } } @@ -1027,7 +1027,7 @@ float door_check_keys(void) { if (door.itemkeys) { // door is now unlocked play2(other, "misc/talk.wav"); - centerprint(other, "Door unlocked!"); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED); return TRUE; } else return FALSE; @@ -1940,7 +1940,7 @@ void func_fourier_controller_think() float n, i, t; self.nextthink = time + 0.1; - if (!(self.owner.active == ACTIVE_ACTIVE)) + if(self.owner.active != ACTIVE_ACTIVE) { self.owner.velocity = '0 0 0'; return; @@ -2073,7 +2073,7 @@ void func_vectormamamam_controller_think() { self.nextthink = time + 0.1; - if (!(self.owner.active == ACTIVE_ACTIVE)) + if(self.owner.active != ACTIVE_ACTIVE) { self.owner.velocity = '0 0 0'; return; diff --git a/qcsrc/server/target_music.qc b/qcsrc/server/target_music.qc index 600af861a..cd1b374e6 100644 --- a/qcsrc/server/target_music.qc +++ b/qcsrc/server/target_music.qc @@ -28,10 +28,11 @@ void target_music_use() { if(!activator) return; - if(!IS_REAL_CLIENT(activator)) - return; - msg_entity = activator; - target_music_sendto(MSG_ONE, 1); + if(IS_REAL_CLIENT(activator)) + { + msg_entity = activator; + target_music_sendto(MSG_ONE, 1); + } entity head; FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); } } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 06286e8f5..5f2f278e7 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -663,16 +663,8 @@ float FindSmallestTeam(entity pl, float ignore_pl) { if(autocvar_g_campaign && pl && IS_REAL_CLIENT(pl)) return 1; // special case for campaign and player joining - else if(g_domination) - error("Too few teams available for domination\n"); - else if(g_ctf) - error("Too few teams available for ctf\n"); - else if(g_keyhunt) - error("Too few teams available for key hunt\n"); - else if(g_freezetag) - error("Too few teams available for freeze tag\n"); else - error("Too few teams available for team deathmatch\n"); + error(sprintf("Too few teams available for %s\n", MapInfo_Type_ToString(MapInfo_CurrentGametype()))); } // count how many players are in each team @@ -827,7 +819,7 @@ void SV_ChangeTeam(float _color) } if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && self.wasplayer)) { - sprint(self, "Team changes not allowed\n"); + Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED); return; // changing teams is not allowed } @@ -837,7 +829,7 @@ void SV_ChangeTeam(float _color) GetTeamCounts(self); if(!TeamSmallerEqThanTeam(dteam, steam, self)) { - sprint(self, "Cannot change to a larger/better/shinier team\n"); + Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM); return; } } @@ -998,7 +990,7 @@ void ShufflePlayerOutOfTeam (float source_team) if(selected.deadflag == DEAD_NO) Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0'); - centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", Team_ColoredFullName(selected.team))); + Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team); } // code from here on is just to support maps that don't have team entities -- 2.39.2