item_generic: initial implementation of this Opposing Force entity
This commit is contained in:
parent
e1fd04de05
commit
a91122ccbe
2 changed files with 94 additions and 0 deletions
|
@ -54,6 +54,7 @@ server/light.qc
|
||||||
server/logic_auto.qc
|
server/logic_auto.qc
|
||||||
server/stubs.qc
|
server/stubs.qc
|
||||||
server/infodecal.qc
|
server/infodecal.qc
|
||||||
|
server/item_generic.qc
|
||||||
server/player_weaponstrip.qc
|
server/player_weaponstrip.qc
|
||||||
server/player_loadsaved.qc
|
server/player_loadsaved.qc
|
||||||
server/prop_dynamic.qc
|
server/prop_dynamic.qc
|
||||||
|
|
93
src/gs-entbase/server/item_generic.qc
Normal file
93
src/gs-entbase/server/item_generic.qc
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!QUAKED scripted_sequence (1 0 0) (-8 -8 -8) (8 8 8)
|
||||||
|
# OVERVIEW
|
||||||
|
A 'generic' decorative entity which uses an animation sequence.
|
||||||
|
|
||||||
|
# KEYS
|
||||||
|
- "targetname" : Name
|
||||||
|
- "target" : Target when triggered.
|
||||||
|
- "killtarget" : Target to kill when triggered.
|
||||||
|
- "sequencename" : Animation sequence to play, by name.
|
||||||
|
- "body" : Which bodygroup to use.
|
||||||
|
- "skin" : Which skin to use.
|
||||||
|
|
||||||
|
# TRIVIA
|
||||||
|
This entity was introduced in Half-Life: Opposing Force (1999).
|
||||||
|
*/
|
||||||
|
class
|
||||||
|
item_generic:NSRenderableEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void item_generic(void);
|
||||||
|
|
||||||
|
virtual void Respawn(void);
|
||||||
|
virtual void SpawnKey(string, string);
|
||||||
|
private:
|
||||||
|
string m_strSequenceName;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
item_generic::item_generic(void)
|
||||||
|
{
|
||||||
|
m_strSequenceName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
item_generic::Save(float handle)
|
||||||
|
{
|
||||||
|
super::Save(handle);
|
||||||
|
SaveString(handle, "m_strSequenceName", m_strSequenceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
item_generic::Restore(string strKey, string strValue)
|
||||||
|
{
|
||||||
|
switch (strKey) {
|
||||||
|
case "m_strSequenceName":
|
||||||
|
m_strSequenceName = ReadString(strValue);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super::Restore(strKey, strValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
item_generic::SpawnKey(string strKey, string strValue)
|
||||||
|
{
|
||||||
|
switch (strKey) {
|
||||||
|
case "sequencename":
|
||||||
|
m_strSequenceName = strValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super::SpawnKey(strKey, strValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
item_generic::Respawn(void)
|
||||||
|
{
|
||||||
|
SetOrigin(GetSpawnOrigin());
|
||||||
|
SetAngles(GetSpawnAngles());
|
||||||
|
SetModel(GetSpawnModel());
|
||||||
|
SetSize([0,0,0], [0,0,0]);
|
||||||
|
SetSolid(SOLID_NOT);
|
||||||
|
SetMovetype(MOVETYPE_NONE);
|
||||||
|
|
||||||
|
if (m_strSequenceName)
|
||||||
|
SetFrame(frameforname(GetModelindex(), m_strSequenceName));
|
||||||
|
}
|
Loading…
Reference in a new issue