NSEntity: remove parenting hack, do our own parenting as the engine won't do it for entities using .SendEntity (virtually every single one in Nuclide)
This commit is contained in:
parent
5cf55b8271
commit
ca316277e7
3 changed files with 27 additions and 22 deletions
|
@ -418,6 +418,10 @@ private:
|
|||
string m_parent;
|
||||
string m_parent_old;
|
||||
string m_parent_attachment;
|
||||
|
||||
vector m_parentPosOffs;
|
||||
vector m_parentAngOffs;
|
||||
|
||||
NETWORKED_FLOAT_N(frame)
|
||||
NETWORKED_FLOAT_N(skin)
|
||||
__int32 effects_net;
|
||||
|
|
|
@ -378,6 +378,17 @@ ncEntity::EvaluateEntity(void)
|
|||
void
|
||||
ncEntity::ParentUpdate(void)
|
||||
{
|
||||
if (tag_entity) {
|
||||
makevectors(tag_entity.angles);
|
||||
origin = tag_entity.origin + v_forward * m_parentPosOffs[0];
|
||||
origin += v_right * m_parentPosOffs[1];
|
||||
origin += v_up * m_parentPosOffs[2];
|
||||
angles = v_forward * m_parentPosOffs[0];
|
||||
angles += v_right * m_parentPosOffs[1];
|
||||
angles += v_up * m_parentPosOffs[2];
|
||||
angles = vectoangles(angles);
|
||||
}
|
||||
|
||||
EvaluateEntity();
|
||||
|
||||
if (!(vv_flags & VFL_NOFRAMEADVANCE)) {
|
||||
|
@ -424,7 +435,17 @@ ncEntity::GetParent(void)
|
|||
void
|
||||
ncEntity::SetParent(string name)
|
||||
{
|
||||
vector parentOffset, angleOffset;
|
||||
tag_entity = find(world, ::targetname, name);
|
||||
parentOffset = origin - tag_entity.origin;
|
||||
angleOffset = anglesToForward(angles) - anglesToForward(tag_entity.angles);
|
||||
makevectors(tag_entity.angles);
|
||||
m_parentPosOffs[0] = dotproduct(parentOffset, v_forward);
|
||||
m_parentPosOffs[1] = dotproduct(parentOffset, v_right);
|
||||
m_parentPosOffs[2] = dotproduct(parentOffset, v_up);
|
||||
m_parentAngOffs[0] = dotproduct(angleOffset, v_forward);
|
||||
m_parentAngOffs[1] = dotproduct(angleOffset, v_right);
|
||||
m_parentAngOffs[2] = dotproduct(angleOffset, v_up);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -957,11 +978,6 @@ ncEntity::GetModelMaxs(void)
|
|||
void
|
||||
ncEntity::Respawn(void)
|
||||
{
|
||||
static void HackFixMe(void) {
|
||||
this.origin = this.tag_entity.origin;
|
||||
this.angles = this.tag_entity.angles + [90, 0, 0];
|
||||
}
|
||||
|
||||
super::Respawn();
|
||||
|
||||
if (CreatedByMap()) {
|
||||
|
@ -971,14 +987,8 @@ ncEntity::Respawn(void)
|
|||
SetAngles(GetSpawnVector("angles"));
|
||||
SetModel(GetSpawnString("model"));
|
||||
|
||||
string parentName = GetSpawnString("parentname");
|
||||
|
||||
if (STRING_SET(parentName)) {
|
||||
SetParent(parentName);
|
||||
|
||||
if (GetParent()) {
|
||||
customphysics = HackFixMe;
|
||||
}
|
||||
if (STRING_SET(m_parent)) {
|
||||
SetParent(m_parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,6 @@ ncPointTrigger::Respawn(void)
|
|||
void
|
||||
ncPointTrigger::InitPointTrigger(void)
|
||||
{
|
||||
static void HackFixMe(void) {
|
||||
this.origin = this.tag_entity.origin;
|
||||
this.angles = this.tag_entity.angles + [90, 0, 0];
|
||||
}
|
||||
|
||||
SetOrigin(GetSpawnVector("origin"));
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
SetSolid(SOLID_NOT);
|
||||
|
@ -46,10 +41,6 @@ ncPointTrigger::InitPointTrigger(void)
|
|||
|
||||
if (STRING_SET(parentName)) {
|
||||
SetParent(parentName);
|
||||
|
||||
if (GetParent()) {
|
||||
customphysics = HackFixMe;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue