Skip to content

Commit

Permalink
Merge branch 'fixes/borers' of github.com:MistakeNot4892/Nebula into …
Browse files Browse the repository at this point in the history
…rework/hud
  • Loading branch information
MistakeNot4892 committed Jan 23, 2025
2 parents 8d63ef2 + 3fccc7e commit fe6a427
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 48 deletions.
14 changes: 0 additions & 14 deletions code/modules/mob/living/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@ meteor_act
// Add inherent armor to the end of list so that protective equipment is checked first
. += ..()

/mob/living/human/proc/check_head_coverage()
for(var/slot in global.standard_headgear_slots)
var/obj/item/clothing/clothes = get_equipped_item(slot)
if(istype(clothes) && (clothes.body_parts_covered & SLOT_HEAD))
return TRUE
return FALSE

//Used to check if they can be fed food/drinks/pills
/mob/living/human/check_mouth_coverage()
for(var/slot in global.standard_headgear_slots)
var/obj/item/gear = get_equipped_item(slot)
if(istype(gear) && (gear.body_parts_covered & SLOT_FACE) && !(gear.item_flags & ITEM_FLAG_FLEXIBLEMATERIAL))
return gear

/mob/living/human/resolve_item_attack(obj/item/I, mob/living/user, var/target_zone)

for (var/obj/item/grab/grab as anything in grabbed_by)
Expand Down
13 changes: 11 additions & 2 deletions code/modules/mob/mob_eating.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
// mobs do not have blocked mouths by default
// overridden in human_defense.dm
//Used to check if they can be fed food/drinks/pills
/mob/proc/check_mouth_coverage()
return get_covering_head_item(SLOT_FACE)

/mob/proc/check_head_coverage()
return !!get_covering_head_item(SLOT_HEAD)

/mob/proc/get_covering_head_item(slot_flags)
for(var/slot in global.standard_headgear_slots)
var/obj/item/clothes = get_equipped_item(slot)
if(istype(clothes) && (clothes.body_parts_covered & slot_flags) && !(clothes.item_flags & ITEM_FLAG_FLEXIBLEMATERIAL))
return clothes
return null

/mob/proc/get_eaten_transfer_amount(var/default)
Expand Down
58 changes: 26 additions & 32 deletions mods/mobs/borers/mob/borer/borer_attacks.dm
Original file line number Diff line number Diff line change
@@ -1,50 +1,44 @@
/mob/living/simple_animal/borer/UnarmedAttack(atom/A, proximity)

. = ..()
if(.)
return
if(host)
return TRUE // We cannot click things outside of our host.

if(!isliving(A) || !check_intent(I_FLAG_GRAB))
return FALSE
if(!isliving(A) || !check_intent(I_FLAG_GRAB) || stat || !proximity)
return ..()

if(host || !can_use_borer_ability(requires_host_value = FALSE, check_last_special = FALSE))
return FALSE
if(!can_use_borer_ability(requires_host_value = FALSE, check_last_special = FALSE))
return TRUE

var/mob/living/M = A
if(M.has_brain_worms())
var/mob/living/victim = A
if(victim.has_brain_worms())
to_chat(src, SPAN_WARNING("You cannot take a host who already has a passenger!"))
return TRUE

//TODO generalize borers to enter any mob. Until then, return early.
if(!ishuman(M))
to_chat(src, SPAN_WARNING("This creature is not sufficiently intelligent to host you."))
var/obj/item/organ/external/limb = GET_EXTERNAL_ORGAN(victim, BP_HEAD)
if(!limb)
to_chat(src, SPAN_WARNING("\The [victim] does not have anatomy compatible with your lifecycle!"))
return TRUE
// end TODO

var/mob/living/human/H = M
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, BP_HEAD)
if(!E)
to_chat(src, SPAN_WARNING("\The [H] does not have a head!"))
if(BP_IS_PROSTHETIC(limb))
to_chat(src, SPAN_WARNING("\The [victim]'s head is prosthetic and cannot support your lifecycle!"))
return TRUE
if(!H.should_have_organ(BP_BRAIN))
to_chat(src, SPAN_WARNING("\The [H] does not seem to have a brain cavity to enter."))
if(!victim.should_have_organ(BP_BRAIN))
to_chat(src, SPAN_WARNING("\The [victim] does not seem to have a brain cavity to enter."))
return TRUE
if(H.check_head_coverage())
if(victim.check_head_coverage())
to_chat(src, SPAN_WARNING("You cannot get through that host's protective gear."))
return TRUE

to_chat(M, SPAN_WARNING("Something slimy begins probing at the opening of your ear canal..."))
to_chat(src, SPAN_NOTICE("You slither up [M] and begin probing at their ear canal..."))
to_chat(victim, SPAN_WARNING("Something slimy begins probing at the opening of your ear canal..."))
to_chat(src, SPAN_NOTICE("You slither up [victim] and begin probing at their ear canal..."))
set_ability_cooldown(5 SECONDS)

if(!do_after(src, 3 SECONDS, M))
if(!do_after(src, 3 SECONDS, victim) || host || GET_EXTERNAL_ORGAN(victim, BP_HEAD) != limb || BP_IS_PROSTHETIC(limb) || victim.check_head_coverage())
return TRUE

to_chat(src, SPAN_NOTICE("You wiggle into \the [M]'s ear."))
if(M.stat == CONSCIOUS)
to_chat(M, SPAN_DANGER("Something wet, cold and slimy wiggles into your ear!"))
to_chat(src, SPAN_NOTICE("You wiggle into \the [victim]'s ear."))
if(victim.stat == CONSCIOUS)
to_chat(victim, SPAN_DANGER("Something wet, cold and slimy wiggles into your ear!"))

host = M
host = victim
host.status_flags |= PASSEMOTES
forceMove(host)

Expand All @@ -60,9 +54,9 @@
borers.add_antagonist_mind(host.mind, 1, borers.faction_name, borers.faction_welcome)

if(ishuman(host))
var/obj/item/organ/internal/I = GET_INTERNAL_ORGAN(H, BP_BRAIN)
var/obj/item/organ/internal/I = GET_INTERNAL_ORGAN(victim, BP_BRAIN)
if(!I) // No brain organ, so the borer moves in and replaces it permanently.
replace_brain()
else if(E) // If they're in normally, implant removal can get them out.
LAZYDISTINCTADD(E.implants, src)
else if(limb) // If they're in normally, implant removal can get them out.
LAZYDISTINCTADD(limb.implants, src)
return TRUE
1 change: 1 addition & 0 deletions mods/mobs/borers/mob/borer/borer_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

/obj/screen/borer
icon = 'mods/mobs/borers/icons/borer_ui.dmi'
requires_ui_style = FALSE

/obj/screen/borer/handle_click(mob/user, params)
if(!isborer(user))
Expand Down

0 comments on commit fe6a427

Please sign in to comment.