implement ammo distribution flag
This commit is contained in:
parent
71ac1c45a1
commit
6bca60e74a
|
@ -442,7 +442,7 @@ void() weapon_touch = {
|
|||
sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
|
||||
stuffcmd(other, "bf\n");
|
||||
|
||||
bound_other_ammo();
|
||||
bound_ammo(other);
|
||||
|
||||
// change to the weapon
|
||||
old = other.items;
|
||||
|
@ -566,65 +566,66 @@ AMMO
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
void(.float ammo, float max) distribute_ammo = {
|
||||
entity pl, stemp;
|
||||
|
||||
if(sf_dist_ammo) {
|
||||
pl = find(world, classname, "player");
|
||||
while(pl != world) {
|
||||
pl.ammo += self.aflag;
|
||||
bound_ammo(pl);
|
||||
stemp = self;
|
||||
self = pl;
|
||||
W_SetCurrentAmmo();
|
||||
self = stemp;
|
||||
pl = find(pl, classname, "player");
|
||||
}
|
||||
} else {
|
||||
if(other.ammo >= max) {
|
||||
return;
|
||||
}
|
||||
other.ammo += self.aflag;
|
||||
bound_ammo(other);
|
||||
}
|
||||
};
|
||||
|
||||
void() ammo_touch = {
|
||||
entity stemp;
|
||||
float best;
|
||||
|
||||
if(other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
if(other.health <= 0) {
|
||||
if(other.classname != "player" || other.health <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if the player was using their best weapon, change up to the new one if better
|
||||
// if the player was using their best weapon, change up to the new one if
|
||||
// better
|
||||
stemp = self;
|
||||
self = other;
|
||||
best = W_BestWeapon();
|
||||
self = stemp;
|
||||
|
||||
|
||||
// shotgun
|
||||
if(self.weapon == 1) {
|
||||
if(other.ammo_shells >= 100) {
|
||||
return;
|
||||
}
|
||||
other.ammo_shells = other.ammo_shells + self.aflag;
|
||||
switch(self.weapon) {
|
||||
case AMTYPE_SHELLS:
|
||||
distribute_ammo(ammo_shells, AMMAX_SHELLS);
|
||||
break;
|
||||
case AMTYPE_NAILS:
|
||||
distribute_ammo(ammo_nails, AMMAX_NAILS);
|
||||
break;
|
||||
case AMTYPE_ROCKETS:
|
||||
distribute_ammo(ammo_rockets, AMMAX_ROCKETS);
|
||||
break;
|
||||
case AMTYPE_CELLS:
|
||||
distribute_ammo(ammo_cells, AMMAX_CELLS);
|
||||
break;
|
||||
}
|
||||
|
||||
// spikes
|
||||
if(self.weapon == 2) {
|
||||
if(other.ammo_nails >= 200) {
|
||||
return;
|
||||
}
|
||||
other.ammo_nails = other.ammo_nails + self.aflag;
|
||||
}
|
||||
|
||||
// rockets
|
||||
if(self.weapon == 3) {
|
||||
if(other.ammo_rockets >= 100) {
|
||||
return;
|
||||
}
|
||||
other.ammo_rockets = other.ammo_rockets + self.aflag;
|
||||
}
|
||||
|
||||
// cells
|
||||
if(self.weapon == 4) {
|
||||
if(other.ammo_cells >= 100) {
|
||||
return;
|
||||
}
|
||||
other.ammo_cells = other.ammo_cells + self.aflag;
|
||||
}
|
||||
|
||||
bound_other_ammo();
|
||||
|
||||
sprint(other, "You got the ", self.netname, "\n");
|
||||
|
||||
// ammo touch sound
|
||||
sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
|
||||
stuffcmd(other, "bf\n");
|
||||
|
||||
// change to a better weapon if appropriate
|
||||
|
||||
if(other.weapon == best) {
|
||||
stemp = self;
|
||||
self = other;
|
||||
|
@ -1100,7 +1101,7 @@ void() BackpackTouch = {
|
|||
old = other.items;
|
||||
other.items = other.items | new;
|
||||
|
||||
bound_other_ammo();
|
||||
bound_ammo(other);
|
||||
|
||||
if(self.ammo_shells) {
|
||||
if(acount) {
|
||||
|
|
6
todo
6
todo
|
@ -9,7 +9,8 @@ rename all functions to be lower_underscore
|
|||
|
||||
core features:
|
||||
|
||||
distributed ammo
|
||||
add registercvar support
|
||||
restart map after 10 seconds when everyone is dead
|
||||
|
||||
useful features:
|
||||
|
||||
|
@ -21,7 +22,7 @@ extraneous features:
|
|||
|
||||
emotes
|
||||
player sound effect option
|
||||
players shoot through eachother
|
||||
players shoot through eachother (teamplay 4?)
|
||||
selectable player models and skins
|
||||
sound clips
|
||||
third person player weapon models
|
||||
|
@ -30,5 +31,6 @@ done:
|
|||
|
||||
corpse pickups have keys
|
||||
custom pronouns
|
||||
distributed ammo
|
||||
lives counting
|
||||
no friendly fire
|
||||
|
|
Loading…
Reference in New Issue
Block a user