[nexuiz-commits] r8553 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jan 25 12:04:45 EST 2010
Author: div0
Date: 2010-01-25 12:04:39 -0500 (Mon, 25 Jan 2010)
New Revision: 8553
Modified:
trunk/data/qcsrc/server/campaign.qc
trunk/data/qcsrc/server/cheats.qc
trunk/data/qcsrc/server/cheats.qh
trunk/data/qcsrc/server/cl_physics.qc
trunk/data/qcsrc/server/g_world.qc
Log:
Track whether cheats have been used (cheatcount field)
Modified: trunk/data/qcsrc/server/campaign.qc
===================================================================
--- trunk/data/qcsrc/server/campaign.qc 2010-01-25 17:04:09 UTC (rev 8552)
+++ trunk/data/qcsrc/server/campaign.qc 2010-01-25 17:04:39 UTC (rev 8553)
@@ -241,7 +241,7 @@
void CampaignLevelWarp(float n)
{
- if(!sv_cheats) // can this even work?
+ if(!sv_cheats)
return;
CampaignFile_Unload();
CampaignFile_Load(n, 1);
Modified: trunk/data/qcsrc/server/cheats.qc
===================================================================
--- trunk/data/qcsrc/server/cheats.qc 2010-01-25 17:04:09 UTC (rev 8552)
+++ trunk/data/qcsrc/server/cheats.qc 2010-01-25 17:04:39 UTC (rev 8553)
@@ -18,7 +18,7 @@
{
if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING)
if(self.lip < sv_clones)
- return 1;
+ goto allow;
if(self.maycheat)
return 1;
if(sv_cheats && autocvar_sv_cheats)
@@ -63,18 +63,18 @@
self.personal.strength_finished = self.strength_finished;
self.personal.invincible_finished = self.invincible_finished;
self.personal.teleport_time = time;
- return 1;
+ goto cheated;
case CHIMPULSE_CLONE_MOVING:
makevectors (self.v_angle);
self.velocity = self.velocity + v_forward * 300;
CopyBody(1);
self.lip += 1;
self.velocity = self.velocity - v_forward * 300;
- return 1;
+ goto cheated;
case CHIMPULSE_CLONE_STANDING:
CopyBody(0);
self.lip += 1;
- return 1;
+ goto cheated;
case CHIMPULSE_GIVE_ALL:
self.weapons |= WEPBIT_ALL;
self.items |= IT_UNLIMITED_AMMO;
@@ -96,7 +96,7 @@
weapon_action(wep, WR_PRECACHE);
wep = wep + 1;
}
- return 1;
+ goto cheated;
case CHIMPULSE_SPEEDRUN:
if(self.personal)
{
@@ -154,7 +154,7 @@
self.strength_finished = time + self.personal.strength_finished - self.personal.teleport_time;
self.invincible_finished = time + self.personal.invincible_finished - self.personal.teleport_time;
}
- return 1;
+ goto cheated;
}
else if(self.deadflag != DEAD_NO)
sprint(self, "UR DEAD AHAHAH))\n");
@@ -167,7 +167,7 @@
self.angles_x = -self.angles_x;
self.fixangle = TRUE;
self.velocity = '0 0 0';
- return 1;
+ goto cheated;
}
else
sprint(self, "Emergency teleport could not find a good location, forget it!\n");
@@ -203,9 +203,14 @@
remove(e2);
}
print("404 Sportsmanship not found.\n");
- return 1;
+ goto cheated;
}
return 0;
+
+:cheated
+ cheatcount_total += 1;
+ self.cheatcount += 1;
+ return 1;
}
float CheatCommand(float argc)
@@ -235,7 +240,7 @@
end = stov(argv(3));
f = stof(argv(4));
pointparticles(effectnum, start, end, f);
- return 1;
+ goto cheated;
}
sprint(self, "Usage: sv_cheats 1; restart; cmd pointparticles effectname position(0..1) velocityvector multiplier\n");
break;
@@ -248,7 +253,7 @@
W_SetupShot(self, FALSE, FALSE, "",0);
traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
trailparticles(self, effectnum, w_shotorg, trace_endpos);
- return 1;
+ goto cheated;
}
sprint(self, "Usage: sv_cheats 1; restart; cmd trailparticles effectname\n");
break;
@@ -291,10 +296,10 @@
sprint(self, "cannot make stuff there (no space)\n");
}
else
- return 1;
+ goto cheated;
}
else
- return 1;
+ goto cheated;
}
}
else
@@ -304,7 +309,7 @@
if(argc == 3)
{
race_ImposePenaltyTime(self, stof(argv(1)), argv(2));
- return 1;
+ goto cheated;
}
sprint(self, "Usage: sv_cheats 1; restart; cmd penalty 5.0 AHAHAHAHAHAHAH))\n");
break;
@@ -356,7 +361,7 @@
e.killindicator.killindicator.owner = e;
setattachment(e.killindicator.killindicator, e, "");
setorigin(e.killindicator.killindicator, '0 0 8');
- return 1;
+ goto cheated;
case "dragpoint_spawn":
e = spawn();
e.classname = "dragpoint";
@@ -388,7 +393,7 @@
e.killindicator.killindicator.owner = e;
setattachment(e.killindicator.killindicator, e, "");
setorigin(e.killindicator.killindicator, '0 0 56');
- return 1;
+ goto cheated;
case "drag_remove":
RandomSelection_Init();
for(e = world; (e = find(e, classname, "dragbox_box")); )
@@ -405,7 +410,7 @@
remove(RandomSelection_chosen_ent.enemy);
remove(RandomSelection_chosen_ent);
}
- return 1;
+ goto cheated;
case "drag_setcnt":
if(argc == 2)
{
@@ -421,7 +426,7 @@
else
RandomSelection_chosen_ent.cnt = drag_lastcnt = stof(argv(1));
}
- return 1;
+ goto cheated;
}
else
sprint(self, "Usage: sv_cheats 1; restart; cmd dragbox_setcnt cnt\n");
@@ -440,7 +445,7 @@
fputs(f, strcat("cmd dragpoint_spawn ", ftos(e.cnt), " \"", vtos(e.origin), "\"\n"));
}
fclose(f);
- return 1;
+ goto cheated;
}
else
sprint(self, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n");
@@ -508,7 +513,7 @@
fputs(f, "}\n");
}
fclose(f);
- return 1;
+ goto cheated;
}
else
sprint(self, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n");
@@ -524,9 +529,14 @@
remove(e);
for(e = world; (e = find(e, classname, "drag_digit")); )
remove(e);
- return 1;
+ goto cheated;
}
return 0;
+
+:cheated
+ cheatcount_total += 1;
+ self.cheatcount += 1;
+ return 1;
}
void Drag_Begin(entity dragger, entity draggee, vector touchpoint);
@@ -593,6 +603,13 @@
}
}
+ if(cheating)
+ {
+ cheatcount_total += 1;
+ self.cheatcount += 1;
+ return 1;
+ }
+
return cheating;
}
Modified: trunk/data/qcsrc/server/cheats.qh
===================================================================
--- trunk/data/qcsrc/server/cheats.qh 2010-01-25 17:04:09 UTC (rev 8552)
+++ trunk/data/qcsrc/server/cheats.qh 2010-01-25 17:04:39 UTC (rev 8553)
@@ -1,3 +1,5 @@
+float cheatcount_total;
+.float cheatcount;
float CheatImpulse(float i);
float CheatCommand(float argc);
float CheatFrame();
Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc 2010-01-25 17:04:09 UTC (rev 8552)
+++ trunk/data/qcsrc/server/cl_physics.qc 2010-01-25 17:04:39 UTC (rev 8553)
@@ -501,9 +501,7 @@
#ifdef TETRIS
TetrisImpulse();
#else
- if(sv_cheats || self.maycheat)
- self.impulse = 99;
- else
+ if(!CheatImpulse(99))
print("A hollow voice says \"Plugh\".\n");
#endif
}
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2010-01-25 17:04:09 UTC (rev 8552)
+++ trunk/data/qcsrc/server/g_world.qc 2010-01-25 17:04:39 UTC (rev 8553)
@@ -449,10 +449,7 @@
// needs to be done so early as they would still spawn
RegisterWeapons();
- if(sv_cheats)
- ServerProgsDB = db_create();
- else
- ServerProgsDB = db_load("server.db");
+ ServerProgsDB = db_load("server.db");
TemporaryDB = db_create();
@@ -2689,10 +2686,7 @@
// some things then break, so let's work around them...
// Progs DB (capture records)
- if(sv_cheats)
- ServerProgsDB = db_create();
- else
- ServerProgsDB = db_load("server.db");
+ ServerProgsDB = db_load("server.db");
// Mapinfo
MapInfo_Shutdown();
@@ -2713,7 +2707,7 @@
world_initialized = 0;
print("Saving persistent data...\n");
Ban_SaveBans();
- if(!sv_cheats)
+ if(!cheatcount_total)
db_save(ServerProgsDB, "server.db");
if(cvar("developer"))
db_save(TemporaryDB, "server-temp.db");
More information about the nexuiz-commits
mailing list