/* * Copyright (c) 2023 Marco Cawthorne * * 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; int m_itemID; float m_usageTime; 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__); if (m_itemID == ITEM_QUAD) { pl.m_quadFinishTime = time + 30.0f; } else if (m_itemID == ITEM_INVIS) { pl.m_invisFinishTime = time + 30.0f; } else if (m_itemID == ITEM_INVULN) { pl.m_invulnFinishTime = time + 30.0f; } else if (m_itemID == ITEM_ENVIROSUIT) { pl.m_enviroFinishTime = time + 30.0f; } pl.g_items |= m_itemID; pl.SetRenderMode(GetRenderMode()); pl.SetRenderFX(GetRenderFX()); pl.SetRenderColor(GetRenderColor()); pl.SetRenderAmt(GetRenderAmt()); /* 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]); modelflags = MF_ROTATE; 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; m_itemID = 0i; } /*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; m_itemID = ITEM_ENVIROSUIT; 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; m_itemID = ITEM_INVIS; 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; m_itemID = ITEM_INVULN; 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(); Sound_Precache("item_artifact_super_damage.attack"); 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; m_itemID = ITEM_QUAD; super::Touch(eToucher); }