fix suicides not killing people

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5714 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2010-10-06 18:26:04 +00:00
parent a84dc9bccd
commit 9a6ea9db04
4 changed files with 23 additions and 10 deletions
+2
View File
@@ -405,11 +405,13 @@ void floatret(float v)
void result(const char *s) { commandret = newstring(s); }
#if 0
// seer : script evaluation excessive recursion
static int seer_count = 0; // count calls to executeret, check time every n1 (100) calls
static int seer_index = -1; // position in timestamp vector
vector<long long> seer_t1; // timestamp of last n2 (10) level-1 calls
vector<long long> seer_t2; // timestamp of last n3 (10) level-2 calls
#endif
char *executeret(const char *p) // all evaluation happens here, recursively
{
bool noproblem = true;
+7
View File
@@ -332,6 +332,13 @@ public:
// just subtract damage here, can set death, etc. later in code calling this
int dodamage(int damage)
{
if(damage == INT_MAX)
{
damage = health;
armour = health = 0;
return damage;
}
/* 4-level armor - continous approach: 16%, 33%, 37%, 41% */
int armoursection = 0;
int ad = damage;
+13 -9
View File
@@ -1302,16 +1302,20 @@ void serverdamage(client *target, client *actor, int damage, int gun, bool gib,
if ( m_arena && gun == GUN_GRENADE && arenaroundstartmillis + 2000 > gamemillis && target != actor ) return;
clientstate &ts = target->state;
ts.dodamage(damage);
actor->state.damage += damage != 1000 ? damage : 0;
sendf(-1, 1, "ri7", gib ? SV_GIBDAMAGE : SV_DAMAGE, target->clientnum, actor->clientnum, gun, damage, ts.armour, ts.health);
if(target!=actor){
checkcombo (target, actor, damage, gun);
if(!hitpush.iszero())
if(damage < INT_MAX)
{
actor->state.damage += damage;
sendf(-1, 1, "ri7", gib ? SV_GIBDAMAGE : SV_DAMAGE, target->clientnum, actor->clientnum, gun, damage, ts.armour, ts.health);
if(target!=actor)
{
vec v(hitpush);
if(!v.iszero()) v.normalize();
sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage,
int(v.x*DNF), int(v.y*DNF), int(v.z*DNF));
checkcombo (target, actor, damage, gun);
if(!hitpush.iszero())
{
vec v(hitpush);
if(!v.iszero()) v.normalize();
sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage,
int(v.x*DNF), int(v.y*DNF), int(v.z*DNF));
}
}
}
if(ts.health<=0)
+1 -1
View File
@@ -79,7 +79,7 @@ void processevent(client *c, shotevent &e)
void processevent(client *c, suicideevent &e)
{
serverdamage(c, c, 1000, GUN_KNIFE, false);
serverdamage(c, c, INT_MAX, GUN_KNIFE, false);
}
void processevent(client *c, pickupevent &e)