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);
|
sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
|
||||||
stuffcmd(other, "bf\n");
|
stuffcmd(other, "bf\n");
|
||||||
|
|
||||||
bound_other_ammo();
|
bound_ammo(other);
|
||||||
|
|
||||||
// change to the weapon
|
// change to the weapon
|
||||||
old = other.items;
|
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 = {
|
void() ammo_touch = {
|
||||||
entity stemp;
|
entity stemp;
|
||||||
float best;
|
float best;
|
||||||
|
|
||||||
if(other.classname != "player") {
|
if(other.classname != "player" || other.health <= 0) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(other.health <= 0) {
|
|
||||||
return;
|
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;
|
stemp = self;
|
||||||
self = other;
|
self = other;
|
||||||
best = W_BestWeapon();
|
best = W_BestWeapon();
|
||||||
self = stemp;
|
self = stemp;
|
||||||
|
|
||||||
|
switch(self.weapon) {
|
||||||
// shotgun
|
case AMTYPE_SHELLS:
|
||||||
if(self.weapon == 1) {
|
distribute_ammo(ammo_shells, AMMAX_SHELLS);
|
||||||
if(other.ammo_shells >= 100) {
|
break;
|
||||||
return;
|
case AMTYPE_NAILS:
|
||||||
}
|
distribute_ammo(ammo_nails, AMMAX_NAILS);
|
||||||
other.ammo_shells = other.ammo_shells + self.aflag;
|
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");
|
sprint(other, "You got the ", self.netname, "\n");
|
||||||
|
|
||||||
// ammo touch sound
|
// ammo touch sound
|
||||||
sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
|
sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
|
||||||
stuffcmd(other, "bf\n");
|
stuffcmd(other, "bf\n");
|
||||||
|
|
||||||
// change to a better weapon if appropriate
|
// change to a better weapon if appropriate
|
||||||
|
|
||||||
if(other.weapon == best) {
|
if(other.weapon == best) {
|
||||||
stemp = self;
|
stemp = self;
|
||||||
self = other;
|
self = other;
|
||||||
|
@ -1100,7 +1101,7 @@ void() BackpackTouch = {
|
||||||
old = other.items;
|
old = other.items;
|
||||||
other.items = other.items | new;
|
other.items = other.items | new;
|
||||||
|
|
||||||
bound_other_ammo();
|
bound_ammo(other);
|
||||||
|
|
||||||
if(self.ammo_shells) {
|
if(self.ammo_shells) {
|
||||||
if(acount) {
|
if(acount) {
|
||||||
|
|
6
todo
6
todo
|
@ -9,7 +9,8 @@ rename all functions to be lower_underscore
|
||||||
|
|
||||||
core features:
|
core features:
|
||||||
|
|
||||||
distributed ammo
|
add registercvar support
|
||||||
|
restart map after 10 seconds when everyone is dead
|
||||||
|
|
||||||
useful features:
|
useful features:
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ extraneous features:
|
||||||
|
|
||||||
emotes
|
emotes
|
||||||
player sound effect option
|
player sound effect option
|
||||||
players shoot through eachother
|
players shoot through eachother (teamplay 4?)
|
||||||
selectable player models and skins
|
selectable player models and skins
|
||||||
sound clips
|
sound clips
|
||||||
third person player weapon models
|
third person player weapon models
|
||||||
|
@ -30,5 +31,6 @@ done:
|
||||||
|
|
||||||
corpse pickups have keys
|
corpse pickups have keys
|
||||||
custom pronouns
|
custom pronouns
|
||||||
|
distributed ammo
|
||||||
lives counting
|
lives counting
|
||||||
no friendly fire
|
no friendly fire
|
||||||
|
|
Loading…
Reference in New Issue
Block a user