I did a bit of testing now:
Code: Select all
#RequireContext CEditorPlugin
declare Integer CountBlocksDeleted;
declare Text DeletionLog;
Void MyRemoveBlockFunction(Int3 _CursorCoord) {
CountBlocksDeleted += 1;
DeletionLog = """deleted {{{CountBlocksDeleted}}} blocks, last at {{{_CursorCoord}}}""" ^ "\n" ^ DeletionLog;
ManialinkText = """<label text="{{{DeletionLog}}}"/>""";
}
main() {
while (True) {
// place a block in the bottom right of the map to enable this/delete the block to use the menu
EnableEditorInputsCustomProcessing = !GetBlock(<0, CollectionGroundY, 0>).BlockModel.IsTerrain;
if (EditorInputIsDown_CursorDelete) {
if (GetBlock(CursorCoord) != Null) {
if (!GetBlock(CursorCoord).BlockModel.IsTerrain) {
RemoveBlock(CursorCoord);
MyRemoveBlockFunction(CursorCoord);
}
}
}
foreach (Event in PendingEvents) {
if (Event.Type == CEditorPluginEvent::Type::MapModified) {
if (EditMode == CEditorPlugin::EditMode::Erase) {
MyRemoveBlockFunction(CursorCoord);
}
}
}
yield;
}
}
This
kind of works: to catch the EditorInputIsDown_... in PlaceMode, you have to EnableEditorInputsCustomProcessing. (Which totally makes sense.)
The script above seems to log whenever you delete a block (not beeing in PlaceMode or having a block placed at <0, ground, 0> otherwise (switch for custom editor input processing)).
I don't know what your plan was, but maybe you can build around that.
However I'm afraid you can't just get what block was changed from EraseMode or MapModified events. If I remember correctly, I tried that back then.