Added initial logging code...
This commit is contained in:
parent
57d513eae8
commit
dad17ab315
11 changed files with 147 additions and 86 deletions
37
src/server/logging.c
Normal file
37
src/server/logging.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2019 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var int autocvar_logging_enabled = FALSE;
|
||||
|
||||
void
|
||||
Logging_Frag(entity a, entity v)
|
||||
{
|
||||
logfrag(a, v);
|
||||
}
|
||||
|
||||
void
|
||||
Logging_Pickup(entity cl, entity it, string altname)
|
||||
{
|
||||
if (!autocvar_logging_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (altname) {
|
||||
print(sprintf("%s picked up %s\n", cl.netname, altname));
|
||||
} else {
|
||||
print(sprintf("%s picked up %s\n", cl.netname, it.classname));
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
../defs.h
|
||||
|
||||
../plugins.c
|
||||
../logging.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../valve/monster_rat.cpp
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
../defs.h
|
||||
|
||||
../plugins.c
|
||||
../logging.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../valve/monster_rat.cpp
|
||||
|
|
|
@ -23,18 +23,21 @@ class item_ammo:CBaseEntity
|
|||
|
||||
void item_ammo::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
player pl = (player)other;
|
||||
sound(other, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
Weapons_RefreshAmmo(pl);
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
player pl = (player)other;
|
||||
sound(other, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
Weapons_RefreshAmmo(pl);
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,25 +23,28 @@ class item_battery:CBaseEntity
|
|||
|
||||
void item_battery::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
if (other.armor >= 100) {
|
||||
return;
|
||||
}
|
||||
/* Move this somewhere else? */
|
||||
other.armor += 15;
|
||||
if (other.armor > 100) {
|
||||
other.armor = 100;
|
||||
}
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.armor >= 100) {
|
||||
return;
|
||||
}
|
||||
/* Move this somewhere else? */
|
||||
other.armor += 15;
|
||||
if (other.armor > 100) {
|
||||
other.armor = 100;
|
||||
}
|
||||
|
||||
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,20 +23,23 @@ class item_healthkit:CBaseEntity
|
|||
|
||||
void item_healthkit::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
if (other.health >= other.max_health) {
|
||||
return;
|
||||
}
|
||||
Damage_Apply(other, this, -20, this.origin, TRUE);
|
||||
sound(this, CHAN_ITEM, "items/smallmedkit1.wav", 1, ATTN_NORM);
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.health >= other.max_health) {
|
||||
return;
|
||||
}
|
||||
Damage_Apply(other, this, -20, this.origin, TRUE);
|
||||
sound(this, CHAN_ITEM, "items/smallmedkit1.wav", 1, ATTN_NORM);
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 20.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,24 +24,28 @@ class item_longjump:CBaseTrigger
|
|||
|
||||
void item_longjump::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
player pl = (player)other;
|
||||
if (pl.g_items & ITEM_LONGJUMP) {
|
||||
return;
|
||||
}
|
||||
sound(other, CHAN_ITEM, "fvox/blip.wav", 1, ATTN_NORM);
|
||||
sound(other, CHAN_VOICE, "fvox/powermove_on.wav", 1, ATTN_NORM);
|
||||
pl.g_items |= ITEM_LONGJUMP;
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
player pl = (player)other;
|
||||
if (pl.g_items & ITEM_LONGJUMP) {
|
||||
return;
|
||||
}
|
||||
|
||||
CBaseTrigger::UseTargets();
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
sound(other, CHAN_ITEM, "fvox/blip.wav", 1, ATTN_NORM);
|
||||
sound(other, CHAN_VOICE, "fvox/powermove_on.wav", 1, ATTN_NORM);
|
||||
pl.g_items |= ITEM_LONGJUMP;
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
CBaseTrigger::UseTargets();
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,23 +25,27 @@ class item_suit:CBaseTrigger
|
|||
void item_suit::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
player pl = (player)other;
|
||||
if (pl.g_items & ITEM_SUIT) {
|
||||
return;
|
||||
}
|
||||
sound(other, CHAN_ITEM, "fvox/bell.wav", 1, ATTN_NORM);
|
||||
sound(other, CHAN_VOICE, "fvox/hev_logon.wav", 1, ATTN_NORM);
|
||||
pl.g_items |= ITEM_SUIT;
|
||||
return;
|
||||
}
|
||||
|
||||
CBaseTrigger::UseTargets();
|
||||
player pl = (player)other;
|
||||
if (pl.g_items & ITEM_SUIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
sound(other, CHAN_ITEM, "fvox/bell.wav", 1, ATTN_NORM);
|
||||
sound(other, CHAN_VOICE, "fvox/hev_logon.wav", 1, ATTN_NORM);
|
||||
pl.g_items |= ITEM_SUIT;
|
||||
|
||||
CBaseTrigger::UseTargets();
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ void item_weaponbox::touch(void)
|
|||
}
|
||||
|
||||
player pl = (player)other;
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
pl.ammo_9mm += ammo_9mm;
|
||||
pl.ammo_357 += ammo_357;
|
||||
|
|
|
@ -27,23 +27,26 @@ class item_pickup:CBaseTrigger
|
|||
|
||||
void item_pickup::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
/*if (Weapons_IsPresent((player)other, id) == TRUE) {
|
||||
return;
|
||||
}*/
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
Weapons_AddItem((player)other, id);
|
||||
/*if (Weapons_IsPresent((player)other, id) == TRUE) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
CBaseTrigger::UseTargets();
|
||||
Logging_Pickup(other, this, __NULL__);
|
||||
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
Weapons_AddItem((player)other, id);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
CBaseTrigger::UseTargets();
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ defs.h
|
|||
../defs.h
|
||||
|
||||
../plugins.c
|
||||
../logging.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
monster_rat.cpp
|
||||
|
|
Loading…
Reference in a new issue