GS-EntBase: Add SetScale(), SetOwner(), SetVelocity() and SetTouch() methods
to NSEntity.
This commit is contained in:
parent
bcf9e2e758
commit
54cf7f8273
7 changed files with 114 additions and 2 deletions
|
@ -13,6 +13,7 @@ shared/NSPointTrigger.qc
|
||||||
shared/NSVehicle.qc
|
shared/NSVehicle.qc
|
||||||
shared/NSMonster.qc
|
shared/NSMonster.qc
|
||||||
shared/NSTalkMonster.qc
|
shared/NSTalkMonster.qc
|
||||||
|
shared/NSProjectile.qc
|
||||||
shared/decals.qc
|
shared/decals.qc
|
||||||
shared/spraylogo.qc
|
shared/spraylogo.qc
|
||||||
shared/func_friction.qc
|
shared/func_friction.qc
|
||||||
|
|
|
@ -21,4 +21,4 @@ class NSBrushTrigger:NSEntity
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
virtual void(void) InitBrushTrigger;
|
virtual void(void) InitBrushTrigger;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,6 +72,10 @@ class NSEntity:NSTrigger
|
||||||
nonvirtual string(void) GetSpawnModel;
|
nonvirtual string(void) GetSpawnModel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void(float) SetScale;
|
||||||
|
virtual void(entity) SetOwner;
|
||||||
|
virtual void(vector) SetVelocity;
|
||||||
|
virtual void(void()) SetTouch;
|
||||||
virtual void(float) SetSendFlags;
|
virtual void(float) SetSendFlags;
|
||||||
virtual void(float) SetSolid;
|
virtual void(float) SetSolid;
|
||||||
virtual void(string) SetModel;
|
virtual void(string) SetModel;
|
||||||
|
|
|
@ -253,6 +253,28 @@ NSEntity::ClearAngles(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
NSEntity::SetOwner(entity newOwner)
|
||||||
|
{
|
||||||
|
owner = newOwner;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
NSEntity::SetVelocity(vector vecNew)
|
||||||
|
{
|
||||||
|
if (vecNew == velocity)
|
||||||
|
return;
|
||||||
|
|
||||||
|
velocity = vecNew;
|
||||||
|
SetSendFlags(BASEFL_CHANGED_VELOCITY);
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
NSEntity::SetTouch(void() newTouch)
|
||||||
|
{
|
||||||
|
touch = newTouch;
|
||||||
|
};
|
||||||
|
|
||||||
/* we want to really use those set functions because they'll notify of any
|
/* we want to really use those set functions because they'll notify of any
|
||||||
* networking related changes. otherwise we'll have to keep track of copies
|
* networking related changes. otherwise we'll have to keep track of copies
|
||||||
* that get updated every frame */
|
* that get updated every frame */
|
||||||
|
@ -282,6 +304,15 @@ NSEntity::SetSolid(float newSolid)
|
||||||
solid = newSolid;
|
solid = newSolid;
|
||||||
SetSendFlags(BASEFL_CHANGED_SOLID);
|
SetSendFlags(BASEFL_CHANGED_SOLID);
|
||||||
}
|
}
|
||||||
|
void
|
||||||
|
NSEntity::SetScale(float newScale)
|
||||||
|
{
|
||||||
|
if (newScale == scale)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scale = newScale;
|
||||||
|
SetSendFlags(BASEFL_CHANGED_SCALE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NSEntity::UpdateBounds(void)
|
NSEntity::UpdateBounds(void)
|
||||||
|
|
26
src/gs-entbase/shared/NSProjectile.h
Normal file
26
src/gs-entbase/shared/NSProjectile.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2022 Vera Visions L.L.C.
|
||||||
|
*
|
||||||
|
* 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 NSProjectile:NSSurfacePropEntity
|
||||||
|
{
|
||||||
|
void(void) NSProjectile;
|
||||||
|
|
||||||
|
virtual void(entity, entity) m_pImpact = 0;
|
||||||
|
|
||||||
|
virtual void(void()) SetImpact;
|
||||||
|
virtual void(string) SetModel;
|
||||||
|
virtual void(void) ProjectileTouch;
|
||||||
|
};
|
49
src/gs-entbase/shared/NSProjectile.qc
Normal file
49
src/gs-entbase/shared/NSProjectile.qc
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2022 Vera Visions L.L.C.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
NSProjectile::ProjectileTouch(void)
|
||||||
|
{
|
||||||
|
if (m_pImpact)
|
||||||
|
m_pImpact(other, this);
|
||||||
|
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSProjectile::SetImpact(void() func)
|
||||||
|
{
|
||||||
|
m_pImpact = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSProjectile::SetModel(string mdl)
|
||||||
|
{
|
||||||
|
super::SetModel(mdl);
|
||||||
|
SetSize([0,0,0], [0,0,0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSProjectile::NSProjectile(void)
|
||||||
|
{
|
||||||
|
super::NSSurfacePropEntity();
|
||||||
|
touch = ProjectileTouch;
|
||||||
|
|
||||||
|
SetMovetype(MOVETYPE_FLY);
|
||||||
|
SetRenderColor([1,1,1]);
|
||||||
|
SetRenderAmt(1.0);
|
||||||
|
SetSolid(SOLID_BBOX);
|
||||||
|
}
|
|
@ -26,6 +26,7 @@
|
||||||
#include "NSPointTrigger.h"
|
#include "NSPointTrigger.h"
|
||||||
#include "NSMonster.h"
|
#include "NSMonster.h"
|
||||||
#include "NSTalkMonster.h"
|
#include "NSTalkMonster.h"
|
||||||
|
#include "NSProjectile.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
|
@ -60,4 +61,4 @@ CBaseTrigger::CBaseTrigger(void)
|
||||||
{
|
{
|
||||||
CBaseEntity::CBaseEntity();
|
CBaseEntity::CBaseEntity();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue