Ticket #3530: SaveTheChickenNotTheWhales.patch

File SaveTheChickenNotTheWhales.patch, 2.0 KB (added by wraitii, 8 years ago)

Fixes the issue (this is a debug patch)

  • source/ps/TemplateLoader.cpp

     
    394394    CParamNode::LoadXMLString(out, "<Entity/>");
    395395    out.CopyFilteredChildrenOfChild(in, "Entity", permittedComponentTypes);
    396396
    397     // Disable the Obstruction component (if there is one) so it doesn't affect pathfinding
    398     // (but can still be used for testing this entity for collisions against others)
    399     if (out.GetChild("Entity").GetChild("Obstruction").IsOk())
    400         CParamNode::LoadXMLString(out, "<Entity><Obstruction><Active>false</Active></Obstruction></Entity>");
    401 
    402397    if (!corpse)
    403398    {
    404399        // Previews should not cast shadows
     
    542537    permittedComponentTypes.insert("Position");
    543538    permittedComponentTypes.insert("VisualActor");
    544539    permittedComponentTypes.insert("Identity");
    545     permittedComponentTypes.insert("Obstruction");
    546540    permittedComponentTypes.insert("Minimap");
    547541    permittedComponentTypes.insert("ResourceSupply");
    548542    permittedComponentTypes.insert("Selectable");
     
    554548
    555549    CParamNode::LoadXMLString(out, "<Entity/>");
    556550    out.CopyFilteredChildrenOfChild(in, "Entity", permittedComponentTypes);
     551   
     552    // When dying, resources lose the unitmotion component
     553    // This causes them to have no clearance, and an obstruction that does not really exist.
     554    // Which makes the unreachable in some cases (see #3530).
     555    // To fix this issue and still keep them an obstruction, they need to become static.
     556    // So create a static obstruction of an arbitratry radius.
     557    CParamNode::LoadXMLString(out, "<Entity><Obstruction><Active>true</Active><BlockMovement>true</BlockMovement><BlockPathfinding>true</BlockPathfinding><BlockFoundation>false</BlockFoundation><BlockConstruction>false</BlockConstruction><DisableBlockMovement>false</DisableBlockMovement><DisableBlockPathfinding>false</DisableBlockPathfinding><Static width=\"2.0\" depth=\"2.0\"/></Obstruction></Entity>");
    557558}