|
13 | 13 | [Attribute(defvalue: "1", desc: "If enabled the entity will deleted from persistence when deleted from the world automatically.")]
|
14 | 14 | bool m_bSelfDelete;
|
15 | 15 |
|
| 16 | + [Attribute(defvalue: "0", desc: "Update the navmesh on being loaded back into the world. Only makes sense for prefabs that can affect the navmesh - e.g. houses.")] |
| 17 | + bool m_bUpdateNavmesh; |
| 18 | + |
16 | 19 | [Attribute(defvalue: "1", desc: "Only storage root entities can be saved in the open world.\nIf disabled the entity will only be saved if inside another storage root (e.g. character, vehicle).")]
|
17 | 20 | bool m_bStorageRoot;
|
18 | 21 |
|
|
266 | 269 | }
|
267 | 270 | else
|
268 | 271 | {
|
| 272 | + if (settings.m_bUpdateNavmesh) |
| 273 | + UpdateNavesh(); |
| 274 | + |
269 | 275 | if (m_pOnAfterLoad)
|
270 | 276 | m_pOnAfterLoad.Invoke(this, saveData);
|
271 | 277 | }
|
|
412 | 418 | {
|
413 | 419 | if (!parent)
|
414 | 420 | return; // Maybe parent got deleted by the time this invokes on next frame
|
415 |
| - |
| 421 | + |
416 | 422 | array<Managed> outComponents();
|
417 | 423 | parent.FindComponents(SlotManagerComponent, outComponents);
|
418 | 424 | foreach (Managed componentRef : outComponents)
|
|
694 | 700 | //------------------------------------------------------------------------------------------------
|
695 | 701 | protected void DeferredApplyCallback(EPF_EntitySaveData saveData)
|
696 | 702 | {
|
| 703 | + EPF_PersistenceComponentClass settings = EPF_PersistenceComponentClass.Cast(GetComponentData(GetOwner())); |
| 704 | + if (settings.m_bUpdateNavmesh) |
| 705 | + UpdateNavesh(); |
| 706 | + |
697 | 707 | if (m_pOnAfterLoad)
|
698 | 708 | m_pOnAfterLoad.Invoke(this, saveData);
|
699 | 709 | }
|
700 | 710 |
|
| 711 | + //------------------------------------------------------------------------------------------------ |
| 712 | + protected void UpdateNavesh() |
| 713 | + { |
| 714 | + SCR_AIWorld aiworld = SCR_AIWorld.Cast(GetGame().GetAIWorld()); |
| 715 | + if (aiworld) |
| 716 | + aiworld.RequestNavmeshRebuildEntity(GetOwner()); |
| 717 | + } |
| 718 | + |
701 | 719 | #ifdef WORKBENCH
|
702 | 720 | //------------------------------------------------------------------------------------------------
|
703 | 721 | override event void _WB_OnInit(IEntity owner, inout vector mat[4], IEntitySource src)
|
|
0 commit comments