Ninja powerup shouldn't spawn directly

This commit is contained in:
Olle Rosenquist 2007-07-23 17:52:04 +00:00
parent 9e70f71054
commit 027bfefffc

View file

@ -1350,6 +1350,9 @@ powerup::powerup(int _type, int _subtype)
void powerup::reset() void powerup::reset()
{ {
if (data->powerupinfo[type].startspawntime > 0)
spawntick = server_tick() + server_tickspeed() * data->powerupinfo[type].startspawntime;
else
spawntick = -1; spawntick = -1;
} }
@ -1372,39 +1375,39 @@ void powerup::tick()
int respawntime = -1; int respawntime = -1;
switch (type) switch (type)
{ {
case POWERUP_TYPE_HEALTH: case POWERUP_HEALTH:
if(pplayer->health < data->playerinfo[gameobj.gametype].maxhealth) if(pplayer->health < data->playerinfo[gameobj.gametype].maxhealth)
{ {
pplayer->health = min((int)data->playerinfo[gameobj.gametype].maxhealth, pplayer->health + 1); pplayer->health = min((int)data->playerinfo[gameobj.gametype].maxhealth, pplayer->health + data->powerupinfo[type].amount);
respawntime = 15; respawntime = data->powerupinfo[type].respawntime;
} }
break; break;
case POWERUP_TYPE_ARMOR: case POWERUP_ARMOR:
if(pplayer->armor < data->playerinfo[gameobj.gametype].maxarmor) if(pplayer->armor < data->playerinfo[gameobj.gametype].maxarmor)
{ {
pplayer->armor = min((int)data->playerinfo[gameobj.gametype].maxarmor, pplayer->armor + 1); pplayer->armor = min((int)data->playerinfo[gameobj.gametype].maxarmor, pplayer->armor + data->powerupinfo[type].amount);
respawntime = 15; respawntime = data->powerupinfo[type].respawntime;
} }
break; break;
case POWERUP_TYPE_WEAPON: case POWERUP_WEAPON:
if(subtype >= 0 && subtype < NUM_WEAPONS) if(subtype >= 0 && subtype < NUM_WEAPONS)
{ {
if(pplayer->weapons[subtype].ammo < 10 || !pplayer->weapons[subtype].got) if(pplayer->weapons[subtype].ammo < 10 || !pplayer->weapons[subtype].got)
{ {
pplayer->weapons[subtype].got = true; pplayer->weapons[subtype].got = true;
pplayer->weapons[subtype].ammo = min(10, pplayer->weapons[subtype].ammo + 10); pplayer->weapons[subtype].ammo = min(10, pplayer->weapons[subtype].ammo + data->powerupinfo[type].amount);
respawntime = 15; respawntime = data->powerupinfo[type].respawntime;
} }
} }
break; break;
case POWERUP_TYPE_NINJA: case POWERUP_NINJA:
{ {
// activate ninja on target player // activate ninja on target player
pplayer->ninjaactivationtick = server_tick(); pplayer->ninjaactivationtick = server_tick();
pplayer->weapons[WEAPON_NINJA].got = true; pplayer->weapons[WEAPON_NINJA].got = true;
pplayer->active_weapon = WEAPON_NINJA; pplayer->active_weapon = WEAPON_NINJA;
respawntime = 90; respawntime = data->powerupinfo[type].respawntime;
break; break;
} }
default: default:
@ -1668,32 +1671,32 @@ void mods_init()
switch(it->type) switch(it->type)
{ {
case ITEM_WEAPON_GUN: case ITEM_WEAPON_GUN:
type = POWERUP_TYPE_WEAPON; type = POWERUP_WEAPON;
subtype = WEAPON_GUN; subtype = WEAPON_GUN;
break; break;
case ITEM_WEAPON_SHOTGUN: case ITEM_WEAPON_SHOTGUN:
type = POWERUP_TYPE_WEAPON; type = POWERUP_WEAPON;
subtype = WEAPON_SHOTGUN; subtype = WEAPON_SHOTGUN;
break; break;
case ITEM_WEAPON_ROCKET: case ITEM_WEAPON_ROCKET:
type = POWERUP_TYPE_WEAPON; type = POWERUP_WEAPON;
subtype = WEAPON_ROCKET; subtype = WEAPON_ROCKET;
break; break;
case ITEM_WEAPON_HAMMER: case ITEM_WEAPON_HAMMER:
type = POWERUP_TYPE_WEAPON; type = POWERUP_WEAPON;
subtype = WEAPON_HAMMER; subtype = WEAPON_HAMMER;
break; break;
case ITEM_HEALTH: case ITEM_HEALTH:
type = POWERUP_TYPE_HEALTH; type = POWERUP_HEALTH;
break; break;
case ITEM_ARMOR: case ITEM_ARMOR:
type = POWERUP_TYPE_ARMOR; type = POWERUP_ARMOR;
break; break;
case ITEM_NINJA: case ITEM_NINJA:
type = POWERUP_TYPE_NINJA; type = POWERUP_NINJA;
subtype = WEAPON_NINJA; subtype = WEAPON_NINJA;
break; break;
}; };