| 66 | } |
| 67 | |
| 68 | bool CPHSkeleton::Spawn(CSE_Abstract* D) |
| 69 | { |
| 70 | CSE_PHSkeleton* po = smart_cast<CSE_PHSkeleton*>(D); |
| 71 | VERIFY(po); |
| 72 | |
| 73 | m_flags = po->_flags; |
| 74 | CSE_Visual* visual = smart_cast<CSE_Visual*>(D); |
| 75 | VERIFY(visual); |
| 76 | m_startup_anim = visual->startup_animation; |
| 77 | |
| 78 | if (po->_flags.test(CSE_PHSkeleton::flSpawnCopy)) |
| 79 | { |
| 80 | CPHSkeleton* source = smart_cast<CPHSkeleton*>(Level().Objects.net_Find(po->source_id)); |
| 81 | ASSERT_FMT(source, "no source: '%s'", *D->s_name); |
| 82 | source->UnsplitSingle(this); |
| 83 | m_flags.set(CSE_PHSkeleton::flSpawnCopy, FALSE); |
| 84 | po->_flags.set(CSE_PHSkeleton::flSpawnCopy, FALSE); |
| 85 | po->source_id = BI_NONE; |
| 86 | return true; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | CPhysicsShellHolder* obj = PPhysicsShellHolder(); |
| 91 | |
| 92 | IKinematics* k = nullptr; |
| 93 | if (obj->Visual()) |
| 94 | { |
| 95 | k = smart_cast<IKinematics*>(obj->Visual()); |
| 96 | if (k) |
| 97 | { |
| 98 | k->LL_SetBoneRoot(po->saved_bones.root_bone); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | SpawnInitPhysics(D); |
| 103 | RestoreNetState(po); |
| 104 | if (obj->PPhysicsShell() && obj->PPhysicsShell()->isFullActive()) |
| 105 | obj->PPhysicsShell()->GetGlobalTransformDynamic(&obj->XFORM()); |
| 106 | |
| 107 | CPHDestroyableNotificate::spawn_notificate(D); |
| 108 | |
| 109 | if (k) |
| 110 | { |
| 111 | CInifile* ini = k->LL_UserData(); |
| 112 | if (ini && ini->section_exist("collide")) |
| 113 | { |
| 114 | if (ini->line_exist("collide", "not_collide_parts")) |
| 115 | { |
| 116 | CGID gr = CPHCollideValidator::RegisterGroup(); |
| 117 | obj->PPhysicsShell()->RegisterToCLGroup(gr); |
| 118 | } |
| 119 | } |
| 120 | if (ini && ini->section_exist("collide_parts")) |
| 121 | { |
| 122 | if (ini->line_exist("collide_parts", "small_object")) |
| 123 | { |
| 124 | obj->PPhysicsShell()->SetSmall(); |
| 125 | } |
nothing calls this directly
no test coverage detected