diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index ae82c94b4e..605e04fcfd 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -20,6 +20,8 @@ tint = 3 flags_cover = MASKCOVERSEYES | MASKCOVERSMOUTH layer = MOB_LAYER + obj_integrity = 100 + max_integrity = 100 var/stat = CONSCIOUS //UNCONSCIOUS is the idle state in this case @@ -43,20 +45,28 @@ item_state = "facehugger_impregnated" stat = DEAD +/obj/item/clothing/mask/facehugger/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) + ..() + if(obj_integrity < 90) + Die() + +/obj/item/clothing/mask/facehugger/attackby(obj/item/O, mob/user, params) + return O.attack_obj(src, user) + /obj/item/clothing/mask/facehugger/attack_alien(mob/user) //can be picked up by aliens attack_hand(user) return /obj/item/clothing/mask/facehugger/attack_hand(mob/user) if((stat == CONSCIOUS && !sterile) && !isalien(user)) - if(Attach(user)) + if(Leap(user)) return ..() /obj/item/clothing/mask/facehugger/attack(mob/living/M, mob/user) ..() - if(user.temporarilyRemoveItemFromInventory(src)) - Attach(M) + if(user.transferItemToLoc(src, get_turf(M))) + Leap(M) /obj/item/clothing/mask/facehugger/examine(mob/user) ..() @@ -70,19 +80,10 @@ if (sterile) to_chat(user, "It looks like the proboscis has been removed.") -/obj/item/clothing/mask/facehugger/attackby(obj/item/O,mob/m, params) - if(O.force) - Die() - return - -/obj/item/clothing/mask/facehugger/bullet_act(obj/item/projectile/P) - if(P.damage) - Die() /obj/item/clothing/mask/facehugger/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) Die() - return /obj/item/clothing/mask/facehugger/equipped(mob/M) Attach(M) @@ -98,7 +99,7 @@ /obj/item/clothing/mask/facehugger/HasProximity(atom/movable/AM as mob|obj) if(CanHug(AM) && Adjacent(AM)) - return Attach(AM) + return Leap(AM) return 0 /obj/item/clothing/mask/facehugger/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback) @@ -116,7 +117,7 @@ ..() if(stat == CONSCIOUS) icon_state = "[initial(icon_state)]" - Attach(hit_atom) + Leap(hit_atom) /obj/item/clothing/mask/facehugger/proc/valid_to_attach(mob/living/M) // valid targets: corgis, carbons except aliens and devils @@ -144,9 +145,13 @@ // corgi: valid return TRUE -/obj/item/clothing/mask/facehugger/proc/Attach(mob/living/M) +/obj/item/clothing/mask/facehugger/proc/Leap(mob/living/M) if(!valid_to_attach(M)) return FALSE + if(iscarbon(M)) + var/mob/living/carbon/target = M + if(target.wear_mask && istype(target.wear_mask, /obj/item/clothing/mask/facehugger)) + return FALSE // passed initial checks - time to leap! M.visible_message("[src] leaps at [M]'s face!", \ "[src] leaps at [M]'s face!") @@ -165,11 +170,15 @@ if(target.wear_mask) var/obj/item/clothing/W = target.wear_mask - if(!istype(W,/obj/item/clothing/mask/facehugger) && target.dropItemToGround(W)) + if(target.dropItemToGround(W)) target.visible_message("[src] tears [W] off of [target]'s face!", \ "[src] tears [W] off of [target]'s face!") - forceMove(target) target.equip_to_slot_if_possible(src, slot_wear_mask, 0, 1, 1) + return TRUE // time for a smoke + +/obj/item/clothing/mask/facehugger/proc/Attach(mob/living/M) + if(!valid_to_attach(M)) + return // early returns and validity checks done: attach. attached++ //ensure we detach once we no longer need to be attached @@ -189,8 +198,6 @@ addtimer(CALLBACK(src, .proc/Impregnate, M), rand(MIN_IMPREGNATION_TIME, MAX_IMPREGNATION_TIME)) - return TRUE // time for a smoke - /obj/item/clothing/mask/facehugger/proc/detach() attached = 0