diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index b79e7e1f69..3d54c723e9 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -31,70 +31,94 @@ if(C) // Sometimes we get things without cells in it. . += "Current charge: [C.charge] / [C.maxcharge]" +//CHOMPEdit Start - Let borgs clickdrag things into chargers +/obj/machinery/recharger/proc/do_allowed_checks(obj/item/G, mob/user) + . = FALSE + if(charging) + to_chat(user, "\A [charging] is already charging here.") + return + // Checks to make sure he's not in space doing it, and that the area got proper power. + if(!powered()) + to_chat(user, "\The [src] blinks red as you try to insert [G]!") + return + if(istype(G, /obj/item/weapon/gun/energy)) + var/obj/item/weapon/gun/energy/E = G + if(E.self_recharge) + to_chat(user, "\The [E] has no recharge port.") + return + if(istype(G, /obj/item/modular_computer)) + var/obj/item/modular_computer/C = G + if(!C.battery_module) + to_chat(user, "\The [C] does not have a battery installed. ") + return + if(istype(G, /obj/item/weapon/melee/baton)) + var/obj/item/weapon/melee/baton/B = G + if(B.use_external_power) + to_chat(user, "\The [B] has no recharge port.") + return + if(istype(G, /obj/item/device/flash)) + var/obj/item/device/flash/F = G + if(F.use_external_power) + to_chat(user, "\The [F] has no recharge port.") + return + if(istype(G, /obj/item/weapon/weldingtool/electric)) + var/obj/item/weapon/weldingtool/electric/EW = G + if(EW.use_external_power) + to_chat(user, "\The [EW] has no recharge port.") + return + else if(istype(G, /obj/item/ammo_magazine/cell_mag)) // CHOMPedit start + var/obj/item/ammo_magazine/cell_mag/maggy = G + if(maggy.stored_ammo.len < 1) + to_chat(user, "\The [G] does not have any cells installed.") + return + else if(istype(G, /obj/item/weapon/gun/projectile/cell_loaded)) + var/obj/item/weapon/gun/projectile/cell_loaded/gunny = G + if(gunny.ammo_magazine) + var/obj/item/ammo_magazine/cell_mag/maggy = gunny.ammo_magazine + if(maggy.stored_ammo.len < 1) + to_chat(user, "\The [G] does not have any cell in its magazine installed.") + return + else + to_chat(user, "\The [G] does not have a magazine installed..") // CHOMPedit end + if(istype(G, /obj/item/device/paicard)) + var/obj/item/device/paicard/ourcard = G + if(ourcard.panel_open) + to_chat(user, "\The [ourcard] won't fit in the recharger with its panel open.") + return + if(ourcard.pai) + if(ourcard.pai.stat == CONSCIOUS) + to_chat(user, "\The [ourcard] boops... it doesn't need to be recharged!") + return + else + to_chat(user, "\The [ourcard] doesn't have a personality!") + return + return TRUE + +/obj/machinery/recharger/MouseDrop_T(obj/item/weapon/G as obj, mob/user as mob) + var/allowed = 0 + for (var/allowed_type in allowed_devices) + if(istype(G, allowed_type)) allowed = 1 + + if(allowed) + if(!do_allowed_checks(G, user)) + return + + G.loc = src + charging = G + update_icon() + user.visible_message("[user] inserts [charging] into [src].", "You insert [charging] into [src].") +//CHOMPEdit End + /obj/machinery/recharger/attackby(obj/item/weapon/G as obj, mob/user as mob) var/allowed = 0 for (var/allowed_type in allowed_devices) if(istype(G, allowed_type)) allowed = 1 if(allowed) - if(charging) - to_chat(user, "\A [charging] is already charging here.") + //CHOMPEdit Start - move checks into their own proc + if(!do_allowed_checks(G, user)) return - // Checks to make sure he's not in space doing it, and that the area got proper power. - if(!powered()) - to_chat(user, "\The [src] blinks red as you try to insert [G]!") - return - if(istype(G, /obj/item/weapon/gun/energy)) - var/obj/item/weapon/gun/energy/E = G - if(E.self_recharge) - to_chat(user, "\The [E] has no recharge port.") - return - if(istype(G, /obj/item/modular_computer)) - var/obj/item/modular_computer/C = G - if(!C.battery_module) - to_chat(user, "\The [C] does not have a battery installed. ") - return - if(istype(G, /obj/item/weapon/melee/baton)) - var/obj/item/weapon/melee/baton/B = G - if(B.use_external_power) - to_chat(user, "\The [B] has no recharge port.") - return - if(istype(G, /obj/item/device/flash)) - var/obj/item/device/flash/F = G - if(F.use_external_power) - to_chat(user, "\The [F] has no recharge port.") - return - if(istype(G, /obj/item/weapon/weldingtool/electric)) - var/obj/item/weapon/weldingtool/electric/EW = G - if(EW.use_external_power) - to_chat(user, "\The [EW] has no recharge port.") - return - else if(istype(G, /obj/item/ammo_magazine/cell_mag)) // CHOMPedit start - var/obj/item/ammo_magazine/cell_mag/maggy = G - if(maggy.stored_ammo.len < 1) - to_chat(user, "\The [G] does not have any cells installed.") - return - else if(istype(G, /obj/item/weapon/gun/projectile/cell_loaded)) - var/obj/item/weapon/gun/projectile/cell_loaded/gunny = G - if(gunny.ammo_magazine) - var/obj/item/ammo_magazine/cell_mag/maggy = gunny.ammo_magazine - if(maggy.stored_ammo.len < 1) - to_chat(user, "\The [G] does not have any cell in its magazine installed.") - return - else - to_chat(user, "\The [G] does not have a magazine installed..") // CHOMPedit end - if(istype(G, /obj/item/device/paicard)) - var/obj/item/device/paicard/ourcard = G - if(ourcard.panel_open) - to_chat(user, "\The [ourcard] won't fit in the recharger with its panel open.") - return - if(ourcard.pai) - if(ourcard.pai.stat == CONSCIOUS) - to_chat(user, "\The [ourcard] boops... it doesn't need to be recharged!") - return - else - to_chat(user, "\The [ourcard] doesn't have a personality!") - return + //CHOMPEdit End user.drop_item() G.loc = src diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index ebf5380669..5623f104e2 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -311,13 +311,15 @@ if(!canremove) return + //CHOMPEdit start - move these around so that nonhumans can actually click-drag guns at all + if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why? + return + + if (!( istype(over_object, /obj/screen) )) + return ..() + if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist - - if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why? - return - - if (!( istype(over_object, /obj/screen) )) - return ..() + //CHOMPEdit End //makes sure that the thing is equipped, so that we can't drag it into our hand from miles away. //there's got to be a better way of doing this. @@ -438,7 +440,7 @@ else set_light(0) //VOREStation Edit End - + //YAWNEDIT: Recoil knockdown for micros, ported from CHOMPStation if(recoil_mode && iscarbon(user)) var/mob/living/carbon/nerd = user @@ -451,9 +453,9 @@ to_chat(nerd, "You're so tiny that you drop the gun and hurt yourself from the recoil!") else to_chat(nerd, "You're so tiny that the pull of the trigger causes you to drop the gun!") - + //YAWNEDIT: Knockdown code end - + user.hud_used.update_ammo_hud(user, src) // Similar to the above proc, but does not require a user, which is ideal for things like turrets. @@ -804,16 +806,16 @@ /obj/item/weapon/gun/proc/get_ammo_count() return FALSE - + /obj/item/weapon/gun/equipped(mob/living/user, slot) // When a gun is equipped to your hands, we'll add the HUD to the user. Pending porting over TGMC guncode where wielding is far more sensible. if(slot == slot_l_hand || slot == slot_r_hand) user.hud_used.add_ammo_hud(user, src) else user.hud_used.remove_ammo_hud(user, src) - + return ..() /obj/item/weapon/gun/dropped(mob/living/user) // Ditto as above, we remove the HUD. Pending porting TGMC code to clean up this fucking nightmare of spaghetti. user.hud_used.remove_ammo_hud(user, src) - + ..()