|
169 | 169 | if(user.a_intent == INTENT_HARM)
|
170 | 170 | return ..()
|
171 | 171 |
|
172 |
| - try_switch_state(user) |
| 172 | + return try_switch_state(user) |
| 173 | + |
| 174 | +/obj/structure/alien/resin/door/attack_animal(mob/living/simple_animal/M) |
| 175 | + if(M.a_intent == INTENT_HARM) |
| 176 | + return ..() |
| 177 | + |
| 178 | + return try_switch_state(M) |
173 | 179 |
|
174 | 180 |
|
175 | 181 | /obj/structure/alien/resin/door/attack_hand(mob/living/user)
|
|
206 | 212 |
|
207 | 213 | /obj/structure/alien/resin/door/proc/try_switch_state(atom/movable/user)
|
208 | 214 | if(operating)
|
209 |
| - return |
| 215 | + return FALSE |
210 | 216 |
|
211 | 217 | add_fingerprint(user)
|
212 |
| - |
213 |
| - if(!isalien(user)) |
214 |
| - return |
| 218 | + if(!isliving(user)) |
| 219 | + return FALSE |
| 220 | + var/mob/living/mob = user |
| 221 | + if(!isalien(user) && !("alien" in mob.faction)) |
| 222 | + return FALSE |
215 | 223 |
|
216 | 224 | var/mob/living/carbon/alien/alien = user
|
217 | 225 | if(alien.incapacitated())
|
218 |
| - return |
| 226 | + return FALSE |
219 | 227 |
|
220 | 228 | switch_state()
|
| 229 | + return TRUE |
221 | 230 |
|
222 | 231 |
|
223 | 232 | /obj/structure/alien/resin/door/proc/switch_state()
|
|
442 | 451 | #define GROWN 3
|
443 | 452 | #define MIN_GROWTH_TIME 1200 //time it takes to grow a hugger
|
444 | 453 | #define MAX_GROWTH_TIME 1800
|
| 454 | +#define PROXIMITY_RADIUS 5 |
445 | 455 |
|
446 | 456 | /obj/structure/alien/egg
|
447 | 457 | name = "egg"
|
|
468 | 478 | update_icon(UPDATE_ICON_STATE)
|
469 | 479 | switch(status)
|
470 | 480 | if(GROWING)
|
471 |
| - new /obj/item/clothing/mask/facehugger(src) |
| 481 | + var/mob/living/simple_animal/hostile/facehugger/hugger = new(src) |
| 482 | + hugger.LoseTarget() |
472 | 483 | addtimer(CALLBACK(src, PROC_REF(Grow)), rand(MIN_GROWTH_TIME, MAX_GROWTH_TIME))
|
473 | 484 | if(GROWN)
|
474 |
| - new /obj/item/clothing/mask/facehugger(src) |
475 |
| - AddComponent(/datum/component/proximity_monitor) |
| 485 | + var/mob/living/simple_animal/hostile/facehugger/hugger = new(src) |
| 486 | + hugger.LoseTarget() |
| 487 | + AddComponent(/datum/component/proximity_monitor, PROXIMITY_RADIUS) |
476 | 488 | if(BURST)
|
477 | 489 | obj_integrity = integrity_failure
|
478 | 490 |
|
|
512 | 524 |
|
513 | 525 |
|
514 | 526 | /obj/structure/alien/egg/proc/GetFacehugger()
|
515 |
| - return locate(/obj/item/clothing/mask/facehugger) in contents |
| 527 | + return locate(/mob/living/simple_animal/hostile/facehugger) in contents |
516 | 528 |
|
517 | 529 |
|
518 | 530 | /obj/structure/alien/egg/proc/Grow()
|
519 | 531 | status = GROWN
|
520 | 532 | update_icon(UPDATE_ICON_STATE)
|
521 |
| - AddComponent(/datum/component/proximity_monitor) |
522 |
| - |
| 533 | + AddComponent(/datum/component/proximity_monitor, PROXIMITY_RADIUS) |
523 | 534 |
|
524 | 535 | ///Need to carry the kill from Burst() to Hatch(), this section handles the alien opening the egg
|
525 |
| -/obj/structure/alien/egg/proc/Burst(kill = TRUE) //drops and kills the hugger if any is remaining |
| 536 | +/obj/structure/alien/egg/proc/Burst(kill = TRUE, atom/movable/trigger) //drops and kills the hugger if any is remaining |
526 | 537 | if(status == GROWN || status == GROWING)
|
527 | 538 | playsound(get_turf(src), 'sound/creatures/alien/xeno_egg_crack.ogg', 50)
|
528 | 539 | flick("egg_opening", src)
|
529 | 540 | status = BURSTING
|
530 | 541 | qdel(GetComponent(/datum/component/proximity_monitor))
|
531 |
| - addtimer(CALLBACK(src, PROC_REF(Hatch), kill), 1.5 SECONDS) |
| 542 | + addtimer(CALLBACK(src, PROC_REF(Hatch), kill, trigger), 1.5 SECONDS) |
532 | 543 |
|
533 | 544 |
|
534 | 545 | ///We now check HOW the hugger is hatching, kill carried from Burst() and obj_break()
|
535 |
| -/obj/structure/alien/egg/proc/Hatch(kill) |
| 546 | +/obj/structure/alien/egg/proc/Hatch(kill, atom/movable/trigger) |
536 | 547 | status = BURST
|
537 | 548 | update_icon(UPDATE_ICON_STATE)
|
538 |
| - var/obj/item/clothing/mask/facehugger/child = GetFacehugger() |
| 549 | + var/mob/living/simple_animal/hostile/facehugger/child = GetFacehugger() |
| 550 | + |
539 | 551 | if(!child)
|
540 | 552 | return
|
| 553 | + |
541 | 554 | child.forceMove(get_turf(src))
|
| 555 | + child.AddComponent(\ |
| 556 | + /datum/component/ghost_direct_control,\ |
| 557 | + ban_type = ROLE_ALIEN,\ |
| 558 | + poll_candidates = FALSE,\ |
| 559 | + after_assumed_control = CALLBACK(child, TYPE_PROC_REF(/mob/living/simple_animal/hostile/facehugger, add_datum_if_not_exist)),\ |
| 560 | + ) |
542 | 561 | if(kill)
|
543 |
| - child.Die() |
| 562 | + child.death() |
544 | 563 | return
|
| 564 | + |
545 | 565 | for(var/mob/living/victim in range(1, src))
|
546 | 566 | if(CanHug(victim))
|
547 |
| - child.Attach(victim) |
| 567 | + child.try_hug(victim) |
548 | 568 | break
|
549 | 569 |
|
| 570 | + if(!CanHug(trigger)) |
| 571 | + return |
| 572 | + |
| 573 | + child.GiveTarget(trigger) |
| 574 | + child.MoveToTarget(list(trigger)) |
| 575 | + |
550 | 576 |
|
551 | 577 | /obj/structure/alien/egg/obj_break(damage_flag)
|
552 | 578 | if(!(obj_flags & NODECONSTRUCT) && status != BURST)
|
|
567 | 593 | var/mob/living/carbon/target = AM
|
568 | 594 | if(iscarbon(target) && target.stat == CONSCIOUS && target.get_int_organ(/obj/item/organ/internal/body_egg/alien_embryo))
|
569 | 595 | return
|
| 596 | + if(isalien(target)) |
| 597 | + return |
570 | 598 |
|
571 |
| - Burst(kill = FALSE) |
| 599 | + Burst(kill = FALSE, trigger = AM) |
572 | 600 |
|
573 | 601 |
|
574 | 602 | #undef BURST
|
|
577 | 605 | #undef GROWN
|
578 | 606 | #undef MIN_GROWTH_TIME
|
579 | 607 | #undef MAX_GROWTH_TIME
|
| 608 | +#undef PROXIMITY_RADIUS |
580 | 609 |
|
581 | 610 | #undef ALIEN_RESIN_BURN_MOD
|
582 | 611 | #undef ALIEN_RESIN_BRUTE_MOD
|
|
0 commit comments