diff --git a/code/modules/dropships/attach_points/attach_point.dm b/code/modules/dropships/attach_points/attach_point.dm index 7230e67e0af1..6fef4d58e785 100644 --- a/code/modules/dropships/attach_points/attach_point.dm +++ b/code/modules/dropships/attach_points/attach_point.dm @@ -27,44 +27,45 @@ /obj/effect/attach_point/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/powerloader_clamp)) - var/obj/item/powerloader_clamp/PC = I - install_equipment(PC, user) + var/obj/item/powerloader_clamp/clamp = I + install_equipment(clamp, user) return TRUE return ..() /// Called when a real user with a powerloader attempts to install an equipment on the attach point -/obj/effect/attach_point/proc/install_equipment(obj/item/powerloader_clamp/PC, mob/living/user) - if(!istype(PC.loaded, /obj/structure/dropship_equipment)) +/obj/effect/attach_point/proc/install_equipment(obj/item/powerloader_clamp/clamp, mob/living/user) + if(!istype(clamp.loaded, /obj/structure/dropship_equipment)) + return + var/obj/structure/dropship_equipment/ds_equipment = clamp.loaded + if(!(base_category in ds_equipment.equip_categories)) + to_chat(user, SPAN_WARNING("[ds_equipment] doesn't fit on [src].")) return - var/obj/structure/dropship_equipment/SE = PC.loaded - if(!(base_category in SE.equip_categories)) - to_chat(user, SPAN_WARNING("[SE] doesn't fit on [src].")) - return TRUE if(installed_equipment) - return TRUE - playsound(loc, 'sound/machines/hydraulics_1.ogg', 40, 1) + return + playsound(loc, 'sound/machines/hydraulics_1.ogg', 40, TRUE) var/point_loc = loc if(!user || !do_after(user, (7 SECONDS) * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_NO_NEEDHAND|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) - return TRUE + return if(loc != point_loc)//dropship flew away - return TRUE - if(installed_equipment || PC.loaded != SE) - return TRUE - to_chat(user, SPAN_NOTICE("You install [SE] on [src].")) - SE.forceMove(loc) - PC.loaded = null - playsound(loc, 'sound/machines/hydraulics_2.ogg', 40, 1) - PC.update_icon() - installed_equipment = SE - SE.ship_base = src + return + if(installed_equipment || clamp.loaded != ds_equipment) + return + to_chat(user, SPAN_NOTICE("You install [ds_equipment] on [src].")) + ds_equipment.forceMove(loc) + clamp.loaded = null + playsound(loc, 'sound/machines/hydraulics_2.ogg', 40, TRUE) + clamp.update_icon() + installed_equipment = ds_equipment + ds_equipment.ship_base = src + ds_equipment.plane = plane for(var/obj/docking_port/mobile/marine_dropship/shuttle in SSshuttle.mobile) if(shuttle.id == ship_tag) - SE.linked_shuttle = shuttle - SEND_SIGNAL(shuttle, COMSIG_DROPSHIP_ADD_EQUIPMENT, SE) + ds_equipment.linked_shuttle = shuttle + SEND_SIGNAL(shuttle, COMSIG_DROPSHIP_ADD_EQUIPMENT, ds_equipment) break - SE.update_equipment() + ds_equipment.update_equipment() /// Weapon specific attachment point /obj/effect/attach_point/weapon