mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-25 05:11:05 +00:00
SERVER: Unlatch special Perk-A-Cola functions from Quick Revive
This commit is contained in:
parent
a17b21151a
commit
ba2f2f225a
4 changed files with 254 additions and 56 deletions
|
@ -417,7 +417,12 @@ float isPowerOn;
|
|||
.float isBuying; // naievil -- used for checking if a perk is being consumed, limits glitching
|
||||
.float perks;
|
||||
.float perk_delay;
|
||||
.float revivesoda;
|
||||
|
||||
.float perk_purchase_count;
|
||||
.float perk_purchase_limit_solo;
|
||||
.float perk_purchase_limit_coop;
|
||||
.float perk_requires_power_solo;
|
||||
.float perk_requires_power_coop;
|
||||
|
||||
// Mystery Box
|
||||
#define MAX_BOX_WEAPONS 27
|
||||
|
|
|
@ -193,7 +193,7 @@ void(vector where, float time_alive) SpawnSpark =
|
|||
// Called when the max amount of solo revives have been used.
|
||||
// Does a little animation and then 'teleports' away.
|
||||
//
|
||||
void() StopReviveAnimation =
|
||||
void() Perk_StopLeaveAnimation =
|
||||
{
|
||||
self.velocity = 0;
|
||||
|
||||
|
@ -206,7 +206,7 @@ void() StopReviveAnimation =
|
|||
sound(self,CHAN_ITEM,"sounds/pu/drop.wav",1,ATTN_NONE); // Play a fitting sound
|
||||
}
|
||||
|
||||
void() ReviveAnimation =
|
||||
void() Perk_MachineLeaveAnimation =
|
||||
{
|
||||
if (self.score == 0)
|
||||
self.angles_z += 6;
|
||||
|
@ -219,13 +219,13 @@ void() ReviveAnimation =
|
|||
self.score = 0;
|
||||
|
||||
if(self.ltime < time) {
|
||||
StopReviveAnimation();
|
||||
Perk_StopLeaveAnimation();
|
||||
} else {
|
||||
self.nextthink = time + 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
void() ReviveGoAwayForReal =
|
||||
void() Perk_MachineGoAwayForReal =
|
||||
{
|
||||
makevectors(self.angles);
|
||||
self.movetype = MOVETYPE_NOCLIP;
|
||||
|
@ -235,15 +235,15 @@ void() ReviveGoAwayForReal =
|
|||
|
||||
// Do our silly little animation for 6 seconds
|
||||
self.ltime = time + 6;
|
||||
self.think = ReviveAnimation;
|
||||
self.think = Perk_MachineLeaveAnimation;
|
||||
self.nextthink = time + 0.05;
|
||||
}
|
||||
|
||||
void() ReviveGoAway =
|
||||
void() Perk_MachineGoAway =
|
||||
{
|
||||
// First start a timer, we want to wait until the player finishes drinking
|
||||
// before starting the animation.
|
||||
self.think = ReviveGoAwayForReal;
|
||||
self.think = Perk_MachineGoAwayForReal;
|
||||
self.nextthink = time + 4;
|
||||
|
||||
// Save our original position to restore on restart
|
||||
|
@ -276,18 +276,24 @@ void() touch_perk =
|
|||
return;
|
||||
}
|
||||
|
||||
float perk_purchase_limit;
|
||||
|
||||
if (player_count >= 1)
|
||||
perk_purchase_limit = self.perk_purchase_limit_coop;
|
||||
else
|
||||
perk_purchase_limit = self.perk_purchase_limit_solo;
|
||||
|
||||
// Back up weapon skin
|
||||
backupWepSkin = other.weaponskin;
|
||||
|
||||
// Don't prompt if our hands or busy or we already have the perk
|
||||
if (!(other.perks & self.style) && other.fire_delay < time && self.revivesoda < 3) {
|
||||
if (!(other.perks & self.style) && other.fire_delay < time && self.perk_purchase_count < perk_purchase_limit) {
|
||||
float price;
|
||||
|
||||
// Check if this is Quick Revive and we are playing in Co-Op,
|
||||
// adjust price if so.
|
||||
if (self.classname == "perk_revive" && player_count >= 1)
|
||||
// Check if we're playing in Co-Op, adjust price if so.
|
||||
if (player_count >= 1)
|
||||
price = self.cost2;
|
||||
// Nope, use normal cost.
|
||||
// Nope, use normal/solo cost.
|
||||
else
|
||||
price = self.cost;
|
||||
|
||||
|
@ -321,15 +327,13 @@ void() touch_perk =
|
|||
other = self; // Set other to client
|
||||
self = tempe; // Set self to machine
|
||||
|
||||
// Do Self-Revive checks
|
||||
if (self.classname == "perk_revive" && !player_count) {
|
||||
// Increment self-revive count
|
||||
self.revivesoda++;
|
||||
// Increment usage count
|
||||
self.perk_purchase_count++;
|
||||
|
||||
// Time to disappear!
|
||||
if (self.perk_purchase_count >= perk_purchase_limit)
|
||||
Perk_MachineGoAway();
|
||||
|
||||
if (self.revivesoda >= 3) {
|
||||
ReviveGoAway();
|
||||
}
|
||||
}
|
||||
other.semiuse = true;
|
||||
} else if (other.button7 && !other.semiuse) {
|
||||
// We tried to use, but we don't have the cash..
|
||||
|
@ -384,8 +388,15 @@ void(entity who) Turn_PerkLight_On =
|
|||
//
|
||||
void() Perk_Jingle =
|
||||
{
|
||||
// If Revive is gone, don't bother to check anymore
|
||||
if (self.revivesoda >= 3)
|
||||
float perk_purchase_limit;
|
||||
|
||||
if (player_count >= 1)
|
||||
perk_purchase_limit = self.perk_purchase_limit_coop;
|
||||
else
|
||||
perk_purchase_limit = self.perk_purchase_limit_solo;
|
||||
|
||||
// If the Vending Machine is gone, don't bother to check anymore
|
||||
if (self.perk_purchase_count >= perk_purchase_limit)
|
||||
return;
|
||||
|
||||
local float jinglewaittime;
|
||||
|
@ -415,8 +426,11 @@ void() setup_perk =
|
|||
{
|
||||
entity power = find(world, classname, "power_switch");
|
||||
|
||||
// Check for Revive before Power
|
||||
if (self.classname == "perk_revive" && !player_count) {
|
||||
self.requirespower = true;
|
||||
|
||||
// Start Perk-A-Cola without Power
|
||||
if ((self.perk_requires_power_coop < 0 && player_count >= 1) ||
|
||||
(self.perk_requires_power_solo < 0 && !player_count)) {
|
||||
Turn_PerkLight_On(self);
|
||||
self.requirespower = false;
|
||||
} else {
|
||||
|
@ -436,24 +450,6 @@ void() setup_perk =
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Perk_UpdateQuickRevive()
|
||||
// Tallies whether to make Quick Revive
|
||||
// solo or co-op accessible.
|
||||
//
|
||||
void() Perk_UpdateQuickRevive =
|
||||
{
|
||||
entity revives = find(world, classname, "perk_revive");
|
||||
|
||||
while(revives != world) {
|
||||
Light_None(revives);
|
||||
revives.think = setup_perk;
|
||||
revives.nextthink = time + 0.1;
|
||||
|
||||
revives = find(revives, classname, "perk_revive");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// --------------------
|
||||
// Perk Entity Spawn Functions
|
||||
|
@ -475,9 +471,13 @@ void() perk_revive =
|
|||
self.model = "models/machines/quake_scale/quick_revive.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 500;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = 1500;
|
||||
}
|
||||
|
||||
|
@ -506,6 +506,26 @@ void() perk_revive =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_CYANLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 3;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = -1;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -544,11 +564,16 @@ void() perk_flopper =
|
|||
self.model = "models/machines/quake_scale/flopper.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 2000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -574,6 +599,26 @@ void() perk_flopper =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_YELLOWLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -610,11 +655,16 @@ void() perk_juggernog =
|
|||
self.model = "models/machines/quake_scale/juggernog.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 2500;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -640,6 +690,26 @@ void() perk_juggernog =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_PINKLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -676,11 +746,16 @@ void() perk_staminup =
|
|||
self.model = "models/machines/quake_scale/staminup.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 2000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -706,6 +781,26 @@ void() perk_staminup =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_YELLOWLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -742,11 +837,16 @@ void() perk_speed =
|
|||
self.model = "models/machines/quake_scale/speed_cola.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 3000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -772,6 +872,26 @@ void() perk_speed =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_LIMELIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -808,11 +928,16 @@ void() perk_double =
|
|||
self.model = "models/machines/quake_scale/double_tap.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 2000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -838,6 +963,26 @@ void() perk_double =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_YELLOWLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -874,10 +1019,14 @@ void() perk_deadshot =
|
|||
self.model = "models/machines/quake_scale/deadshot.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 1500;
|
||||
self.cost2 = 1000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
|
@ -905,6 +1054,26 @@ void() perk_deadshot =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_YELLOWLIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
@ -943,11 +1112,16 @@ void() perk_mule =
|
|||
self.model = "models/machines/quake_scale/mulekick.mdl";
|
||||
}
|
||||
|
||||
// Perk Cost
|
||||
// Perk Cost (Solo)
|
||||
if (!self.cost) {
|
||||
self.cost = 4000;
|
||||
}
|
||||
|
||||
// Perk Cost (Co-Op)
|
||||
if (!self.cost2) {
|
||||
self.cost2 = self.cost;
|
||||
}
|
||||
|
||||
// Player Trigger Sound
|
||||
if (!self.oldmodel) {
|
||||
self.oldmodel = "sounds/machines/perk_drink.wav";
|
||||
|
@ -973,6 +1147,26 @@ void() perk_mule =
|
|||
self.spawnflags = self.spawnflags | PERK_SPAWNFLAG_LIMELIGHT;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Solo)
|
||||
if (!self.perk_purchase_limit_solo) {
|
||||
self.perk_purchase_limit_solo = 1000;
|
||||
}
|
||||
|
||||
// Perk Purchase Limit (Co-Op)
|
||||
if (!self.perk_purchase_limit_coop) {
|
||||
self.perk_purchase_limit_coop = 1000;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Solo)
|
||||
if (!self.perk_requires_power_solo) {
|
||||
self.perk_requires_power_solo = true;
|
||||
}
|
||||
|
||||
// Perk Requires Power (Co-Op)
|
||||
if (!self.perk_requires_power_coop) {
|
||||
self.perk_requires_power_coop = true;
|
||||
}
|
||||
|
||||
// Set up the Perk Entity
|
||||
self.solid = SOLID_TRIGGER;
|
||||
precache_model(self.model);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
void(entity e) Light_None;
|
||||
void() Spawns_Init;
|
||||
void() Perk_UpdateQuickRevive;
|
||||
void() SUB_UseTargets;
|
||||
void() rec_downed;
|
||||
|
||||
|
@ -897,7 +896,7 @@ void() PutClientInServer =
|
|||
|
||||
#endif // FTE
|
||||
|
||||
Perk_UpdateQuickRevive();
|
||||
GameRestart_ResetPerkaColas();
|
||||
};
|
||||
|
||||
//called when client disconnects from the server
|
||||
|
@ -914,7 +913,7 @@ void() ClientDisconnect =
|
|||
self.nextthink = -1;
|
||||
setmodel(self, "models/sprites/null.spr");
|
||||
|
||||
Perk_UpdateQuickRevive();
|
||||
GameRestart_ResetPerkaColas();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void(string perk_classname) GameRestart_TurnPerkOff =
|
|||
tempe.velocity = '0 0 0';
|
||||
tempe.angles = tempe.finalangle;
|
||||
tempe.touch = touch_perk;
|
||||
tempe.revivesoda = 0;
|
||||
tempe.perk_purchase_count = 0;
|
||||
|
||||
// Run our initial setup function
|
||||
tempe.think = setup_perk;
|
||||
|
|
Loading…
Reference in a new issue