thmsndk / Screeps3D

A 3D client for the MMORTS Screeps.com
90 stars 17 forks source link

Feature - Add 'Destroy' button to owned structures #202

Closed Gadjung closed 4 years ago

Gadjung commented 4 years ago

Owned structures (except controller) should have a button added that would enable to destroy them after confirmation

thmsndk commented 4 years ago

The following should assist us with that, I had it in mind when making flags https://github.com/thmsndk/Screeps3D/blob/30b715152669883ac708b569b766d78ea72f6145/Assets/Scripts/Screeps3D/RoomObjects/Flag.cs#L40-L49

thmsndk commented 4 years ago

When confirming destruction of a s tructure, the following api call is called https://github.com/screepers/node-screeps-api/blob/38134ddf1eaca38b5c7834db432dc73cc1d1386d/src/RawAPI.js#L124-L126 POST https://screeps.com/api/game/add-object-intent

{
    "room": "E19S38",
    "shard": "shard3",
    "_id": "room",
    "name": "destroyStructure",
    "intent": [{
            "id": "5e7ff81a7e00f81474101903",
            "roomName": "E19S38",
            "user": "5a44e109ac5a5f1d0146916e"
        }
    ]
}
thmsndk commented 4 years ago

Destroy structures button is visible on structures you don't own when spectating as an example.