From 58be425258ac3b01e107708f2e80947650724c4e Mon Sep 17 00:00:00 2001 From: mugg91 Date: Tue, 24 Dec 2024 01:20:55 +0100 Subject: [PATCH 1/2] [changed] can now always detach mounted bow --- Entities/Vehicles/Common/VehicleAttachment.as | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Entities/Vehicles/Common/VehicleAttachment.as b/Entities/Vehicles/Common/VehicleAttachment.as index 1ef7559ed..7701eb6a5 100644 --- a/Entities/Vehicles/Common/VehicleAttachment.as +++ b/Entities/Vehicles/Common/VehicleAttachment.as @@ -25,10 +25,12 @@ void GetButtonsFor(CBlob@ this, CBlob@ caller) CBlob@ occBlob = ap.getOccupied(); if (occBlob !is null) //detach button { - if (this.isOnGround() && occBlob.getName() != "mounted_bow") // HACK: + if (this.isOnGround() || occBlob.getName() == "mounted_bow") // HACK: { + Vec2f button_offset = ap.offset/2; + button_offset.RotateByDegrees(occBlob.getAngleDegrees()); string text = getTranslatedString("Detach {ITEM}").replace("{ITEM}", getTranslatedString(occBlob.getInventoryName())); - caller.CreateGenericButton(1, ap.offset, this, this.getCommandID("detach vehicle"), text); + CButton@ button = caller.CreateGenericButton(1, button_offset, this, this.getCommandID("detach vehicle"), text); } } } @@ -60,7 +62,7 @@ void onCommand(CBlob@ this, u8 cmd, CBitStream @params) // range check if (this.getDistanceTo(b) > 64.0f) return; - if (this.isOnGround() && occBlob.getName() != "mounted_bow") + if (this.isOnGround() || occBlob.getName() == "mounted_bow") { occBlob.server_DetachFrom(this); } From 91f27c08aab5f396cb5c4473cfa484d69f03030c Mon Sep 17 00:00:00 2001 From: mugg91 Date: Tue, 24 Dec 2024 01:23:57 +0100 Subject: [PATCH 2/2] no need for this reference --- Entities/Vehicles/Common/VehicleAttachment.as | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Entities/Vehicles/Common/VehicleAttachment.as b/Entities/Vehicles/Common/VehicleAttachment.as index 7701eb6a5..278ca65ea 100644 --- a/Entities/Vehicles/Common/VehicleAttachment.as +++ b/Entities/Vehicles/Common/VehicleAttachment.as @@ -30,7 +30,7 @@ void GetButtonsFor(CBlob@ this, CBlob@ caller) Vec2f button_offset = ap.offset/2; button_offset.RotateByDegrees(occBlob.getAngleDegrees()); string text = getTranslatedString("Detach {ITEM}").replace("{ITEM}", getTranslatedString(occBlob.getInventoryName())); - CButton@ button = caller.CreateGenericButton(1, button_offset, this, this.getCommandID("detach vehicle"), text); + caller.CreateGenericButton(1, button_offset, this, this.getCommandID("detach vehicle"), text); } } }