| 277 | } |
| 278 | |
| 279 | void CPHCapture::Release() |
| 280 | { |
| 281 | if (b_failed) |
| 282 | return; |
| 283 | if (e_state == cstReleased) |
| 284 | return; |
| 285 | if (m_joint) |
| 286 | { |
| 287 | m_island.RemoveJoint(m_joint); |
| 288 | |
| 289 | dJointDestroy(m_joint); |
| 290 | } |
| 291 | m_joint = NULL; |
| 292 | if (m_ajoint) |
| 293 | { |
| 294 | m_island.RemoveJoint(m_ajoint); |
| 295 | dJointDestroy(m_ajoint); |
| 296 | } |
| 297 | m_ajoint = NULL; |
| 298 | if (m_body) |
| 299 | { |
| 300 | m_island.RemoveBody(m_body); |
| 301 | dBodyDestroy(m_body); |
| 302 | } |
| 303 | m_body = NULL; |
| 304 | |
| 305 | if (e_state == cstPulling && m_taget_element && !m_taget_object->getDestroy() && m_taget_object->PPhysicsShell() && m_taget_object->PPhysicsShell()->isActive()) |
| 306 | { |
| 307 | m_taget_element->set_DynamicLimits(); |
| 308 | } |
| 309 | |
| 310 | b_failed = false; |
| 311 | b_collide = true; |
| 312 | CActor* A = smart_cast<CActor*>(m_character->PhysicsRefObject()); |
| 313 | if (A) |
| 314 | { |
| 315 | if (e_state == cstCaptured && !m_taget_object->getDestroy() && m_taget_object->PPhysicsShell() && m_taget_object->PPhysicsShell()->isActive()) |
| 316 | { |
| 317 | Fvector dir = {0, -1, 0}; |
| 318 | m_taget_object->PPhysicsShell()->applyImpulse(dir, 0.5f * m_taget_object->PPhysicsShell()->getMass()); |
| 319 | } |
| 320 | A->SetWeaponHideState(INV_STATE_BLOCK_ALL, false); |
| 321 | //. A->inventory().setSlotsBlocked(false); |
| 322 | } |
| 323 | e_state = cstReleased; |
| 324 | } |
| 325 | |
| 326 | void CPHCapture::Deactivate() |
| 327 | { |
no test coverage detected