[Question] How to make friendly units block fire?

Discussion in 'Mod Discussions' started by exterminans, June 2, 2014.

  1. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Title says it all. I'm looking for a way to make friendly units block projectiles, independent of friendly fire enabled or not.

    I'm sure I had seen collision classes declared in the unit and projectile properties at some time of the development, but it appears as if they are gone.

    Only property left appears to be "splash_damages_allies", but that's certainly not the desired effect.
  2. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Hm.. What exactly makes hit detection for enemy units? I'd start there...
  3. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Currently: Nothing.

    Entities are declared {"ammo_type":"AMMO_*"} which is about everything useful visible. And then somehow all enemy units with physics properties (namely: collision box) can consume collision events with ammo and thereby trigger the damage effects.

    It appears as if friendly fire can't be expressed with the json files currently. And neither have I found any clue how targeting actually works, e.g. how to tell units to test for free line of sight before shooting. It occurs as if they would only automatically consider the terrain for this decision, but nothing else.
  4. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    what do walls do to detect? Do they just be in the right place at the right time? Is it simply they take up the space projectiles fly thru?
  5. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Code:
    "collision_layers":"WL_AnyHorizontalGroundOrWaterSurface"
    There it is.

    Anyone willing to test what happens when unit base classes get "collision_layers":"WL_AnyHorizontalGroundOrWaterSurface" assigned to their physics property? In theory, that should make them block shots.
    Can't test it myself unfortunately since my GPU is broken and PA just won't run on Intel IGP.

    EDIT:
    I'm not sure yet why walls do block projectiles at all. Projectiles are spawned in WL_Air, however walls and other structures are only in WL_AnyHorizontalGroundOrWaterSurface.

    And there is also that odd WL_AnySurface group which however is only used in the guard_layer property.

    And yet another property I don't understand yet: "ignore_collisions":false
    Does this only prevent the engine from using relax mechanics when pushing units into it, or does it enable collisions with friendly entities?

    We should really start documenting that stuff...
    Last edited: June 3, 2014
  6. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    If you figure it out put it in here https://github.com/Noah-Huppert/PA-Documentation

Share This Page