Add initial (stubby) artifact implementations
This commit is contained in:
parent
678b5f8c42
commit
425005e91f
3 changed files with 277 additions and 0 deletions
256
src/server/item_artifact.qc
Normal file
256
src/server/item_artifact.qc
Normal file
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class item_artifact:NSRenderableEntity
|
||||
{
|
||||
float m_respawnTime;
|
||||
|
||||
void(void) item_artifact;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_artifact::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
player pl = (player)eToucher;
|
||||
Sound_Play(eToucher, CHAN_ITEM, noise);
|
||||
Logging_Pickup(eToucher, this, __NULL__);
|
||||
|
||||
/* TODO: if deathmatch is 4 and player invincible, don't pick up */
|
||||
if (cvar("deathmatch") == 0 || cvar("deathmatch") == 2) {
|
||||
Destroy();
|
||||
} else {
|
||||
Disappear();
|
||||
ScheduleThink(Respawn, m_respawnTime);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetModel(GetSpawnModel());
|
||||
SetSize([-16,-16,0],[16,16,16]);
|
||||
|
||||
ReleaseThink();
|
||||
|
||||
if (time > 20.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "dmc_item.respawn");
|
||||
|
||||
DropToFloor();
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
Sound_Precache(noise);
|
||||
Sound_Precache("dmc_item.respawn");
|
||||
precache_model(model);
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact::item_artifact(void)
|
||||
{
|
||||
m_oldModel = model;
|
||||
m_respawnTime = 60.0f;
|
||||
}
|
||||
|
||||
/*QUAKED item_artifact_envirosuit (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
DEATHMATCH CLASSIC (1999) ENTITY
|
||||
|
||||
A 'Bio-Suit' artifact which will protect the person wearing it
|
||||
against environmental damage types. Respawns every minute.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/suit.mdl"
|
||||
*/
|
||||
|
||||
class
|
||||
item_artifact_envirosuit:item_artifact
|
||||
{
|
||||
void(void) item_artifact_envirosuit;
|
||||
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_artifact_envirosuit::item_artifact_envirosuit(void)
|
||||
{
|
||||
model = "models/suit.mdl";
|
||||
noise = "item_artifact_envirosuit.pickup";
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_envirosuit::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.classname != "player")
|
||||
return;
|
||||
|
||||
super::Touch(eToucher);
|
||||
}
|
||||
|
||||
|
||||
/*QUAKED item_artifact_invisibility (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
DEATHMATCH CLASSIC (1999) ENTITY
|
||||
|
||||
The 'Ring of Shadows' artifact which will make the wearer invisible for
|
||||
a about 30 seconds. Respawns every 5 minutes.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/pow_invis.mdl"
|
||||
*/
|
||||
|
||||
class
|
||||
item_artifact_invisibility:item_artifact
|
||||
{
|
||||
void(void) item_artifact_invisibility;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_artifact_invisibility::item_artifact_invisibility(void)
|
||||
{
|
||||
model = "models/pow_invis.mdl";
|
||||
noise = "item_artifact_invisibility.pickup";
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_invisibility::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
SetRenderMode(RM_DONTRENDER);
|
||||
SetRenderFX(RFX_GLOWSHELL);
|
||||
SetRenderColor([0.5, 0.5, 0.5]);
|
||||
SetRenderAmt(0.25f);
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_invisibility::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.classname != "player")
|
||||
return;
|
||||
|
||||
m_respawnTime = 5 * 60.0f;
|
||||
super::Touch(eToucher);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*QUAKED item_artifact_invulnerability (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
DEATHMATCH CLASSIC (1999) ENTITY
|
||||
|
||||
The 'Pentagram of Protection' gives the wearer invulnerability for
|
||||
30 seconds. It respawns every 5 minutes.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/pow_invuln.mdl"
|
||||
*/
|
||||
|
||||
class item_artifact_invulnerability:item_artifact
|
||||
{
|
||||
void(void) item_artifact_invulnerability;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_artifact_invulnerability::item_artifact_invulnerability(void)
|
||||
{
|
||||
model = "models/pow_invuln.mdl";
|
||||
noise = "item_artifact_invulnerability.pickup";
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_invulnerability::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
SetRenderFX(RFX_GLOWSHELL);
|
||||
SetRenderColor([1.0, 0.5, 0.0]);
|
||||
SetRenderAmt(0.5f);
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_invulnerability::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.classname != "player")
|
||||
return;
|
||||
|
||||
m_respawnTime = 5 * 60.0f;
|
||||
super::Touch(eToucher);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*QUAKED item_artifact_super_damage (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
DEATHMATCH CLASSIC (1999) ENTITY
|
||||
|
||||
This is the 'Quad Damage' artifact. The player who grabs it
|
||||
will inflict 4x the damage while it's active. Respawns every minute.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/pow_quad.mdl"
|
||||
*/
|
||||
|
||||
class item_artifact_super_damage:item_artifact
|
||||
{
|
||||
void(void) item_artifact_super_damage;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_artifact_super_damage::item_artifact_super_damage(void)
|
||||
{
|
||||
model = "models/pow_quad.mdl";
|
||||
noise = "item_artifact_super_damage.pickup";
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_super_damage::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
SetRenderFX(RFX_GLOWSHELL);
|
||||
SetRenderColor([0.5, 0.5, 1.0]);
|
||||
SetRenderAmt(0.45f);
|
||||
}
|
||||
|
||||
void
|
||||
item_artifact_super_damage::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.classname != "player")
|
||||
return;
|
||||
|
||||
super::Touch(eToucher);
|
||||
}
|
|
@ -70,6 +70,7 @@ item_weaponbox.qc
|
|||
ammo.qc
|
||||
item_armor.qc
|
||||
item_health.qc
|
||||
item_artifact.qc
|
||||
|
||||
../../../src/botlib/include.src
|
||||
|
||||
|
|
|
@ -34,6 +34,26 @@ item_health.pickup
|
|||
sample items/health1.wav
|
||||
}
|
||||
|
||||
item_artifact_envirosuit.pickup
|
||||
{
|
||||
sample items/suit.wav
|
||||
}
|
||||
|
||||
item_artifact_invisibility.pickup
|
||||
{
|
||||
sample items/inv1.wav
|
||||
}
|
||||
|
||||
item_artifact_invulnerability.pickup
|
||||
{
|
||||
sample items/protect.wav
|
||||
}
|
||||
|
||||
item_artifact_super_damage.pickup
|
||||
{
|
||||
sample items/damage.wav
|
||||
}
|
||||
|
||||
dmc_item.respawn
|
||||
{
|
||||
sample items/itembk2.wav
|
||||
|
|
Loading…
Reference in a new issue