diff -ur teeworlds-0.4.3-src-orig/src/game/g_variables.h teeworlds-0.4.3-src/src/game/g_variables.h --- teeworlds-0.4.3-src-orig/src/game/g_variables.h 2008-08-31 15:30:58.000000000 +0200 +++ teeworlds-0.4.3-src/src/game/g_variables.h 2008-09-27 16:08:05.000000000 +0200 @@ -61,3 +61,8 @@ MACRO_CONFIG_INT(sv_spectator_slots, 0, 0, 12) MACRO_CONFIG_INT(sv_teambalance_time, 1, 0, 1000) + +MACRO_CONFIG_INT(sv_instagib, 0, 0, 1) +MACRO_CONFIG_INT(sv_spawnprotect_time, 0, 0, 5000) +MACRO_CONFIG_INT(sv_sprees, 0, 0, 2) + diff -ur teeworlds-0.4.3-src-orig/src/game/server/gs_common.h teeworlds-0.4.3-src/src/game/server/gs_common.h --- teeworlds-0.4.3-src-orig/src/game/server/gs_common.h 2008-08-31 15:30:58.000000000 +0200 +++ teeworlds-0.4.3-src/src/game/server/gs_common.h 2008-09-27 16:15:11.000000000 +0200 @@ -305,6 +305,8 @@ int score; int team; int player_state; // if the client is chatting, accessing a menu or so + int spree; + int spawn_tick; bool spawning; bool dead; @@ -358,6 +360,8 @@ virtual void tick_defered(); void die(int killer, int weapon); + void increment_spree(); + void end_spree(int killer); virtual bool take_damage(vec2 force, int dmg, int from, int weapon); virtual void snap(int snaping_client); diff -ur teeworlds-0.4.3-src-orig/src/game/server/gs_server.cpp teeworlds-0.4.3-src/src/game/server/gs_server.cpp --- teeworlds-0.4.3-src-orig/src/game/server/gs_server.cpp 2008-08-31 15:30:58.000000000 +0200 +++ teeworlds-0.4.3-src/src/game/server/gs_server.cpp 2008-09-27 20:27:53.000000000 +0200 @@ -718,6 +718,9 @@ active_weapon = WEAPON_GUN; last_weapon = WEAPON_HAMMER; queued_weapon = -1; + + spree = 0; + spawn_tick = 0; } void player::destroy() { } @@ -930,19 +933,32 @@ mem_zero(&input, sizeof(input)); + spree = 0; + spawn_tick = server_tick(); + // init weapons mem_zero(&weapons, sizeof(weapons)); - weapons[WEAPON_HAMMER].got = true; - weapons[WEAPON_HAMMER].ammo = -1; - weapons[WEAPON_GUN].got = true; - weapons[WEAPON_GUN].ammo = data->weapons[WEAPON_GUN].maxammo; - - /*weapons[WEAPON_RIFLE].got = true; - weapons[WEAPON_RIFLE].ammo = -1;*/ - - active_weapon = WEAPON_GUN; - last_weapon = WEAPON_HAMMER; - queued_weapon = 0; + if(config.sv_instagib) { + weapons[WEAPON_RIFLE].got = true; + weapons[WEAPON_RIFLE].ammo = -1; + + active_weapon = WEAPON_RIFLE; + last_weapon = WEAPON_RIFLE; + queued_weapon = WEAPON_RIFLE; + } + else { + weapons[WEAPON_HAMMER].got = true; + weapons[WEAPON_HAMMER].ammo = -1; + weapons[WEAPON_GUN].got = true; + weapons[WEAPON_GUN].ammo = data->weapons[WEAPON_GUN].maxammo; + + /*weapons[WEAPON_RIFLE].got = true; + weapons[WEAPON_RIFLE].ammo = -1;*/ + + active_weapon = WEAPON_GUN; + last_weapon = WEAPON_HAMMER; + queued_weapon = 0; + } reload_timer = 0; @@ -1513,6 +1529,12 @@ if (dead || team == -1) return; + if(config.sv_sprees) { + if(killer != client_id) + get_player(killer)->increment_spree(); + end_spree(killer); + } + int mode_special = gameobj->on_player_death(this, get_player(killer), weapon); dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d", @@ -1539,6 +1561,46 @@ create_death(pos, client_id); } +char spree_note[6][64] = { "is on a killing spree!", "is on a rampage!", "is dominating!", "is unstoppable!", "is Godlike!", "is Wicked SICK!!" }; +void player::increment_spree() +{ + if(!config.sv_sprees) + return; + + spree++; + if(spree%5 == 0 && spree < 31) { + char buf[512]; + str_format(buf, sizeof(buf), "%s %s", server_clientname(client_id), spree_note[spree/5-1]); + if(config.sv_sprees == 1) + send_broadcast(buf, -1); + else + send_chat(-1, CHAT_ALL, buf); + } +} + +void player::end_spree(int killer) +{ + if(!config.sv_sprees) + return; + + if(spree < 5) { + spree = 0; + return; + } + spree = 0; + + char buf[512]; + if(client_id != killer) + str_format(buf, sizeof(buf), "%s's killing spree ended by %s", server_clientname(client_id), server_clientname(killer)); + else + str_format(buf, sizeof(buf), "%s was looking good till he killed himself!", server_clientname(client_id)); + + if(config.sv_sprees == 1) + send_broadcast(buf, -1); + else + send_chat(-1, CHAT_ALL, buf); +} + bool player::take_damage(vec2 force, int dmg, int from, int weapon) { core.vel += force; @@ -1546,6 +1608,12 @@ if(gameobj->is_friendly_fire(client_id, from) && !config.sv_teamdamage) return false; + if(server_tick() - spawn_tick <= server_tickspeed()*((float)config.sv_spawnprotect_time/1000)) + return false; + + if(config.sv_instagib) + dmg = health + armor; + // player only inflicts half damage on self if(from == client_id) dmg = max(1, dmg/2); @@ -1710,10 +1778,12 @@ subtype = _subtype; proximity_radius = phys_size; - reset(); + if(!config.sv_instagib) { + reset(); - // TODO: should this be done here? - world->insert_entity(this); + // TODO: should this be done here? + world->insert_entity(this); + } } void powerup::reset()