Building a rampart on top of an invader prevents killing it



  • Part of my code automatically replaces ramparts when they are destroyed. Normally a hostile walking onto a construction site will destroy it but if you create a construction site on top of a hostile creep then it's still possible to build it. (This has been the case for a long time.)

    What's new to me is that when I build a rampart on top of an invader, a mass ranged attack from a creep on an adjacent tile isn't damaging the invader and the rampart the invader is standing on isn't destroyed. I don't remember seeing this happening before so something seems to have changed.

    Here's a replay link of it happening on shard2: https://screeps.com/a/#!/history/shard2/E19N3?t=4001420



  • I'm not sure this is a bug. Ramparts protect whatever they're on the same tile as. If you set your ramparts to public it's also possible for hostiles to enter them, and they are similarly protected.


  • Dev Team

    I confirm this is intended behavior.



  • @artch I've been able to do a little more testing of this and I've discovered that:

    • A rangedMassAttack does not damage an invader on top of my rampart and does not damage the rampart.
    • A rangedAttack does damage an invader on top of my rampart because it does damage the rampart.

    This is a surprising inconsistency between the two methods.


  • Culture

    @hyramgraff That's because rangedMassAttack will not attack your own ramparts.
    A rangedAttack on the other hand is a directed attack at something in a specific location.

    rangedMassAttack will also not damage any of your own buildings while a directed rangedAttack will do that.



  • @artch Since moving onto an enemy ConstructionSite removes it, would it be possible to return an ERR_ code from Room.createConstructionSite if you attempt to make a ConstructionSite on top of an enemy creep instead of allowing it to occur?