API: add DropDownEvent (#6611)

* API: add DropDownEvent

(cherry picked from commit d44a45c916da391200f1ffad3f98b15a99abb1aa)

* request changes
This commit is contained in:
WayZer
2022-03-03 00:26:37 +08:00
committed by GitHub
parent 6c59018d9f
commit 4ff697e19b
2 changed files with 20 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
if(!u.isAdded()) u.team.data().updateCount(u.type, -1);
u.add();
u.unloaded();
Events.fire(new PayloadDropEvent(self(), u));
return true;
}
@@ -168,6 +169,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
if(on != null && Build.validPlace(tile.block, tile.team, tx, ty, tile.rotation, false)){
int rot = (int)((rotation + 45f) / 90f) % 4;
payload.place(on, rot);
Events.fire(new PayloadDropEvent(self(), tile));
if(getControllerName() != null){
payload.build.lastAccessed = getControllerName();