Commit e4cd1dc7 authored by Mario's avatar Mario

Merge branch 'Mario/notifications' into 'master'

Merge branch Mario/notifications (M merge request)

Moves some prints into the notifications system.

See merge request !63
parents 90e5a408 2ef462d7
This diff is collapsed.
......@@ -318,7 +318,7 @@ void W_MineLayer_Attack(void)
if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
{
// the refire delay keeps this message from being spammed
sprint(self, strcat("minelayer: You cannot place more than ^2", ftos(WEP_CVAR(minelayer, limit)), " ^7mines at a time\n") );
Send_Notification(NOTIF_ONE, self, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit));
play2(self, "weapons/unavailable.wav");
return;
}
......
......@@ -81,7 +81,7 @@ void W_Porto_Fail(float failhard)
if(vlen(trace_endpos - self.realowner.origin) < 128)
{
W_ThrowNewWeapon(self.realowner, WEP_PORTO, 0, self.origin, self.velocity);
centerprint(self.realowner, "^1Portal deployment failed.\n\n^2Catch it to try again!");
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
}
}
}
......@@ -157,7 +157,7 @@ void W_Porto_Touch(void)
{
sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
centerprint(self.realowner, "^1In^7-portal created.");
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN);
W_Porto_Success();
}
else
......@@ -174,7 +174,7 @@ void W_Porto_Touch(void)
{
sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
centerprint(self.realowner, "^4Out^7-portal created.");
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
W_Porto_Success();
}
else
......@@ -191,7 +191,7 @@ void W_Porto_Touch(void)
{
sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
centerprint(self.realowner, "^1In^7-portal created.");
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN);
self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * norm);
self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * norm));
CSQCProjectile(self, TRUE, PROJECTILE_PORTO_BLUE, TRUE); // change type
......@@ -212,7 +212,7 @@ void W_Porto_Touch(void)
{
sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
centerprint(self.realowner, "^4Out^7-portal created.");
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
W_Porto_Success();
}
else
......
......@@ -1558,7 +1558,7 @@ void player_regen (void)
mina = autocvar_g_balance_armor_regenstable;
limith = autocvar_g_balance_health_limit;
limita = autocvar_g_balance_armor_limit;
max_mod = regen_mod_max;
regen_mod = regen_mod_regen;
rot_mod = regen_mod_rot;
......@@ -1752,7 +1752,6 @@ float SpectateUpdate()
return 1;
}
float SpectateSet()
{
if(self.enemy.classname != "player")
......@@ -2623,8 +2622,6 @@ void PlayerPostThink (void)
}
*/
//pointparticles(particleeffectnum("machinegun_impact"), self.origin + self.view_ofs + '0 0 7', '0 0 0', 1);
if(self.waypointsprite_attachedforcarrier)
WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON));
......
......@@ -1120,7 +1120,7 @@ void SV_PlayerPhysics()
{
// we get here if we ran out of ammo
if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
sprint(self, "You don't have any fuel for the ^2Jetpack\n");
Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
// walking
makevectors(self.v_angle_y * '0 1 0');
......@@ -1189,7 +1189,7 @@ void SV_PlayerPhysics()
float wishspeed0;
// we get here if we ran out of ammo
if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
sprint(self, "You don't have any fuel for the ^2Jetpack\n");
Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
if(maxspd_mod < 1)
{
......
......@@ -150,7 +150,7 @@ void ClientCommand_join(float request)
{
if(IS_CLIENT(self))
{
if(!IS_PLAYER(self) && !lockteams)
if(!IS_PLAYER(self) && !lockteams && !gameover)
{
if(self.caplayer)
return;
......@@ -468,7 +468,7 @@ void ClientCommand_selectteam(float request, float argc)
GetTeamCounts(self);
if(!TeamSmallerEqThanTeam(Team_TeamToNumber(selection), Team_TeamToNumber(self.team), self))
{
sprint(self, "Cannot change to a larger/better/shinier team\n");
Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
return;
}
}
......
......@@ -478,14 +478,11 @@ void GameCommand_cointoss(float request, float argc)
{
case CMD_REQUEST_COMMAND:
{
entity client;
string result1 = (argv(2) ? strcat("^7", argv(1), "^3!\n") : "^1HEADS^3!\n");
string result2 = (argv(2) ? strcat("^7", argv(2), "^3!\n") : "^4TAILS^3!\n");
string result1 = (argv(2) ? strcat("^7", argv(1)) : "^1HEADS");
string result2 = (argv(2) ? strcat("^7", argv(2)) : "^4TAILS");
string choice = ((random() > 0.5) ? result1 : result2);
FOR_EACH_CLIENT(client)
centerprint(client, strcat("^3Throwing coin... Result: ", choice));
bprint(strcat("^3Throwing coin... Result: ", choice));
Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_COINTOSS, choice);
return;
}
......
......@@ -61,14 +61,13 @@ void SUB_UseTargets()
//
// print the message
//
if (IS_PLAYER(activator) && self.message != "")
if(self)
if(IS_PLAYER(activator) && self.message != "")
if(IS_REAL_CLIENT(activator))
{
if(IS_REAL_CLIENT(activator))
{
centerprint (activator, self.message);
if (self.noise == "")
play2(activator, "misc/talk.wav");
}
centerprint(activator, self.message);
if (self.noise == "")
play2(activator, "misc/talk.wav");
}
//
......@@ -205,8 +204,8 @@ void multi_use()
void multi_touch()
{
if (!(self.spawnflags & 2))
if (!other.iscreature)
if(!(self.spawnflags & 2))
if(!other.iscreature)
return;
if(self.team)
......@@ -378,32 +377,26 @@ void spawnfunc_trigger_delay()
void counter_use()
{
self.count = self.count - 1;
self.count -= 1;
if (self.count < 0)
return;
if (self.count != 0)
if (self.count == 0)
{
if (IS_PLAYER(activator)
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
{
if (self.count >= 4)
centerprint (activator, "There are more to go...");
else if (self.count == 3)
centerprint (activator, "Only 3 more to go...");
else if (self.count == 2)
centerprint (activator, "Only 2 more to go...");
else
centerprint (activator, "Only 1 more to go...");
}
return;
}
if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
if (IS_PLAYER(activator)
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
centerprint(activator, "Sequence completed!");
self.enemy = activator;
multi_trigger ();
self.enemy = activator;
multi_trigger ();
}
else
{
if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
if(self.count >= 4)
Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER);
else
Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, self.count);
}
}
void counter_reset()
......@@ -2059,9 +2052,9 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay,
for(ear = magicears; ear; ear = ear.enemy)
{
msgout = trigger_magicear_processmessage(ear, source, teamsay, privatesay, msgin);
if (!(ear.spawnflags & 64))
if(magicear_matched)
return msgout;
if(!(ear.spawnflags & 64))
if(magicear_matched)
return msgout;
msgin = msgout;
}
return msgin;
......
......@@ -333,12 +333,12 @@ void trigger_keylock_touch(void) {
if (key_used) {
// one or more keys were given, but others are still missing!
play2(other, self.noise1);
centerprint(other, strcat("You also need ", item_keys_keylist(self.itemkeys), "!"));
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(self.itemkeys));
other.key_door_messagetime = time + 2;
} else if (other.key_door_messagetime <= time) {
// no keys were given
play2(other, self.noise2);
centerprint(other, strcat("You need ", item_keys_keylist(self.itemkeys), "!"));
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(self.itemkeys));
other.key_door_messagetime = time + 2;
}
......
......@@ -63,20 +63,13 @@ void assault_objective_decrease_use()
PlayerTeamScore_Add(activator, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
self.enemy.health = -1;
entity oldself, oldactivator;
entity oldself, oldactivator, head;
oldself = self;
self = oldself.enemy;
if(self.message)
{
entity player;
string s;
FOR_EACH_PLAYER(player)
{
s = strcat(self.message, "\n");
centerprint(player, s);
}
}
FOR_EACH_PLAYER(head)
centerprint(head, self.message);
oldactivator = activator;
activator = oldself;
......@@ -523,9 +516,9 @@ void havocbot_ast_reset_role(entity bot)
MUTATOR_HOOKFUNCTION(assault_PlayerSpawn)
{
if(self.team == assault_attacker_team)
centerprint(self, "You are attacking!");
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
else
centerprint(self, "You are defending!");
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
return FALSE;
}
......
......@@ -391,8 +391,7 @@ void onslaught_generator_think()
{
if (!overtime_msg_time)
{
FOR_EACH_PLAYER(e)
centerprint(e, "^3Now playing ^1OVERTIME^3!\n^3Generators start now to decay.\n^3The more control points your team holds,\n^3the faster the enemy generator decays.");
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
overtime_msg_time = time;
}
// self.max_health / 300 gives 5 minutes of overtime.
......@@ -423,9 +422,9 @@ void onslaught_generator_think()
self.wait = time + 5;
FOR_EACH_REALPLAYER(e)
{
if(e.team == self.team)
if(SAME_TEAM(e, self))
{
centerprint(e, "^1Your generator is NOT shielded!\n^7Re-capture controlpoints to shield it!");
Send_Notification(NOTIF_ONE, e, MSG_CENTER, CENTER_ONS_NOTSHIELDED);
soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTEN_NONE); // FIXME: Uniqe sound?
}
}
......
......@@ -429,9 +429,7 @@ MUTATOR_HOOKFUNCTION(superspec_BuildMutatorsPrettyString)
void superspec_hello()
{
if(self.enemy.crypto_idfp == "")
centerprint(self.enemy, "Your client have/allow no crypto id, superspec options will not be saved/restored.");
else
centerprint(self.enemy, sprintf("Hello %s\nSince your client has a Crypto ID, your superspec preferences will be persisted on this server.", self.enemy.netname));
Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID);
remove(self);
}
......
......@@ -599,7 +599,7 @@ float Item_GiveTo(entity item, entity player)
{
pickedup = TRUE;
player.items |= it;
sprint (player, strcat("You got the ^2", item.netname, "\n"));
Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_ITEM_WEAPON_GOT, item.netname);
}
if (item.strength_finished)
......
......@@ -1176,7 +1176,7 @@ void door_touch()
if (!(self.owner.dmg) && (self.owner.message != ""))
{
if (IS_CLIENT(other))
centerprint (other, self.owner.message);
centerprint(other, self.owner.message);
play2(other, "misc/talk.wav");
}
}
......@@ -1849,7 +1849,7 @@ void secret_touch()
if (self.message)
{
if (IS_CLIENT(other))
centerprint (other, self.message);
centerprint(other, self.message);
play2(other, "misc/talk.wav");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment