SERVER: Better management of model and sound allocation

This commit is contained in:
cypress 2023-08-25 15:14:24 -04:00
parent 1011f18b98
commit d56a17faf3
8 changed files with 48 additions and 31 deletions

View File

@ -267,8 +267,9 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
}
}
if (other.button7)
if (other.button7 && !other.semiuse)
{
other.semiuse = true;
if (other.points >= self.cost)
{
door_fire();
@ -287,15 +288,13 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
}
addmoney(other, self.cost*-1, 0);
self.solid = SOLID_NOT;
//centerprint (other, "");
//useprint (other, 0, 0, 0);
//other.total_bought = other.total_bought + 1;
}
else
{
if(other.classname == "player" && !other.downed)
{
centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
other.semiuse = 1;
}
}
@ -647,7 +646,12 @@ void() func_door_nzp =
if (self.cost)
{
self.classname = "door_nzp_cost";
// total_buy = total_buy +1;
switch(self.sounds)
{
case 1: precache_sound("sounds/misc/wood_door.wav"); break;
case 2: precache_sound("sounds/misc/debris.wav"); break;
default: break;
}
}
else
self.classname = "door_nzp";

View File

@ -341,8 +341,8 @@ void() button_touch =
centerprint(other,ftos(self.cost));
centerprint(other,"]\n");
if (other.button7) {
if (other.button7 && !other.semiuse) {
other.semiuse = true;
if(other.points >= self.cost) {
self.enemy = other;
addmoney(other, 0 - self.cost, FALSE);
@ -351,6 +351,7 @@ void() button_touch =
return;
} else {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
}
}
}

View File

@ -299,7 +299,7 @@ void() touch_perk =
// sequence = perk ID in client
useprint(other, 9, price, self.sequence);
if (other.points >= price && other.button7) {
if (other.points >= price && other.button7 && !other.semiuse) {
addmoney(other, -price, 0);
// Pass along the Perk information to the Player to avoid complications later on, then Drink!
@ -315,9 +315,12 @@ void() touch_perk =
ReviveGoAway();
}
}
} else if (other.button7) {
other.semiuse = true;
} else if (other.button7 && !other.semiuse) {
// We tried to use, but we don't have the cash..
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
other.semiuse = true;
}
}
}
@ -427,6 +430,7 @@ void() setup_perk =
void() perk_revive =
{
precache_sound ("sounds/pu/byebye.wav");
precache_model ("models/sprites/lightning.spr");
//
// Set Default Stats for Compatibility
@ -1533,6 +1537,7 @@ void() mystery_touch =
}
else {
centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
}
}
if (self.boxstatus == 2)
@ -1697,10 +1702,11 @@ void() mystery_box =
Load_Mbox_Data();
precache_model ("models/machines/mystery.mdl");
precache_model ("models/machines/mglow$.mdl");
precache_model ("models/props/teddy.mdl");
precache_sound ("sounds/machines/mbox_open.wav");
precache_sound ("sounds/machines/mbox_close.wav");
if (!(self.spawnflags & MBOX_SPAWNFLAG_NOLIGHT))
precache_model ("models/machines/mglow$.mdl");
self.solid = SOLID_TRIGGER;
self.classname = "mystery";
@ -1875,6 +1881,7 @@ void touch_pap() {
}
else if (other.button7 && other.weapon) {
centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
}
} else if (self.papState == 2) {
useprint (other, 7, 0, 0);

View File

@ -273,10 +273,12 @@ void() teleport_touch =
useprint(other, 15, self.cost, 0);
if (other.button7) {
if (other.button7 && !other.semiuse) {
other.semiuse = true;
if (other.points < self.cost) {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}

View File

@ -238,12 +238,14 @@ void zapper_touch () {
if (self.state == 0) {
useprint (other, 11, self.cost, self.weapon);
if (!other.button7) {
if (!other.button7 || other.semiuse) {
return;
}
other.semiuse = true;
if (other.points < self.cost) {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}

View File

@ -180,6 +180,7 @@ void () WallWeapon_TouchTrigger =
// Player doesn't have enough points. Abort.
if (other.points < wcost) {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}
@ -225,6 +226,7 @@ void () WallWeapon_TouchTrigger =
// Player doesn't have enough points. Abort.
if (other.points < wcost) {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}
@ -290,7 +292,6 @@ void () WallWeapon_TouchTrigger =
{
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}
else
@ -320,6 +321,7 @@ void () WallWeapon_TouchTrigger =
{
if (other.points < self.cost2) {
centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
} else {
addmoney(other, -self.cost2, FALSE);
@ -347,6 +349,7 @@ void () WallWeapon_TouchTrigger =
other.semiuse = 1;
if (other.points < self.cost) {
centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return;
}

View File

@ -136,16 +136,18 @@ void() precaches =
// sprites
precache_model ("models/sprites/sprkle.spr");
precache_model ("models/sprites/explosion.spr");
precache_model ("models/sprites/lightning.spr");
precache_model ("models/sprites/null.spr");
precache_model ("models/way/current_way.spr");
precache_model ("models/way/current_way_door.spr");
precache_model ("models/way/last_way.spr");
precache_model ("models/way/last_way_door.spr");
precache_model ("models/way/normal_way.spr");
precache_model ("models/way/normal_way_door.spr");
precache_model ("models/way/way_jump.spr");
precache_model ("models/way/way_land.spr");
if (waypoint_mode) {
precache_model ("models/way/current_way.spr");
precache_model ("models/way/current_way_door.spr");
precache_model ("models/way/last_way.spr");
precache_model ("models/way/last_way_door.spr");
precache_model ("models/way/normal_way.spr");
precache_model ("models/way/normal_way_door.spr");
precache_model ("models/way/way_jump.spr");
precache_model ("models/way/way_land.spr");
}
// zombie
precache_model ("models/ai/zfull.mdl");
@ -163,7 +165,6 @@ void() precaches =
// start weapons
precache_model ("models/weapons/m1911/v_colt.mdl");
precache_model ("models/weapons/m1911/g_colt.mdl");
precache_model ("models/weapons/knife/v_knife.mdl");
precache_model ("models/weapons/grenade/v_grenade.mdl");
precache_model ("models/weapons/grenade/g_grenade.mdl");
@ -217,10 +218,8 @@ void() precaches =
precache_sound("sounds/rounds/splash.wav");
precache_sound("sounds/music/end.wav");
// misc
// purchasing
precache_sound("sounds/misc/buy.wav");
precache_sound("sounds/misc/wood_door.wav");
precache_sound("sounds/misc/debris.wav");
precache_sound("sounds/misc/denybuy.wav");
// power-ups

View File

@ -648,11 +648,10 @@ void() PlayerSpawn =
self.weaponnum = 0;
self.perks = G_PERKS;
SetPerk(self, self.perks);
//self.zoom = 1; // This is to fix an aimin bug for the kar scope
if (rounds < 1 && player_count == 0) {
sound(self, CHAN_AUTO, "sounds/rounds/splash.wav", 1, ATTN_NONE);
sound(self, 0, "sounds/rounds/splash.wav", 1, ATTN_NONE);
sound(self, 1, "sounds/rounds/nround.wav", 0.75, ATTN_NONE);
}
PromptLevelChange(self.nextthink + 3, 1, self);