mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 04:21:42 +00:00
Simple_animals / mobs are the biggest lie in this code-base. They're far from simple and have an extreme god-object problem. Especially when you get to /hostile, where there is so many procs, vars, and what not, that you can't make any interesting additions without snowflaking the hell out of the code. This PR hopes to help kill this problem by introducing a new /living subtype, /living/basic. The idea of this refactor is to slowly start moving all old simple_animals to this new system, moving over behaviors like charging and more extravagant mobs like megafauna over bit by bit similar to how newfood was implemented. One of the other big goals of this refactor is to move many of the fringe simple animal behaviors into either AI datums, or components/elements. (Some of which still needs to be done in this PR). As a proof of concept, I created the base mob/living/basic, and moved cockroaches over to the system. Since cockroaches have both a passive, melee and ranged mob. This PR does slightly affect balance as the behavior isn't 1-on-1 due to it no longer running on the janky /hostile behavior, but I tried to keep the effects to a minimum, and the glockroach and hauberoach are not spawnable through many means as far as I know.
187 lines
6.5 KiB
Plaintext
187 lines
6.5 KiB
Plaintext
/mob/living/basic/attack_hand(mob/living/carbon/human/user, list/modifiers)
|
|
// so that martial arts don't double dip
|
|
if (..())
|
|
return TRUE
|
|
|
|
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
|
user.do_attack_animation(src, ATTACK_EFFECT_DISARM)
|
|
playsound(src, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
|
|
var/shove_dir = get_dir(user, src)
|
|
if(!Move(get_step(src, shove_dir), shove_dir))
|
|
log_combat(user, src, "shoved", "failing to move it")
|
|
user.visible_message(span_danger("[user.name] shoves [src]!"),
|
|
span_danger("You shove [src]!"), span_hear("You hear aggressive shuffling!"), COMBAT_MESSAGE_RANGE, list(src))
|
|
to_chat(src, span_userdanger("You're shoved by [user.name]!"))
|
|
return TRUE
|
|
log_combat(user, src, "shoved", "pushing it")
|
|
user.visible_message(span_danger("[user.name] shoves [src], pushing [p_them()]!"),
|
|
span_danger("You shove [src], pushing [p_them()]!"), span_hear("You hear aggressive shuffling!"), COMBAT_MESSAGE_RANGE, list(src))
|
|
to_chat(src, span_userdanger("You're pushed by [user.name]!"))
|
|
return TRUE
|
|
|
|
if(!user.combat_mode)
|
|
if (stat == DEAD)
|
|
return
|
|
visible_message(span_notice("[user] [response_help_continuous] [src]."), \
|
|
span_notice("[user] [response_help_continuous] you."), null, null, user)
|
|
to_chat(user, span_notice("You [response_help_simple] [src]."))
|
|
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
|
|
else
|
|
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
|
to_chat(user, span_warning("You don't want to hurt [src]!"))
|
|
return
|
|
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
|
|
visible_message(span_danger("[user] [response_harm_continuous] [src]!"),\
|
|
span_userdanger("[user] [response_harm_continuous] you!"), null, COMBAT_MESSAGE_RANGE, user)
|
|
to_chat(user, span_danger("You [response_harm_simple] [src]!"))
|
|
playsound(loc, attacked_sound, 25, TRUE, -1)
|
|
|
|
var/damage = rand(user.dna.species.punchdamagelow, user.dna.species.punchdamagehigh)
|
|
|
|
attack_threshold_check(damage)
|
|
log_combat(user, src, "attacked")
|
|
updatehealth()
|
|
return TRUE
|
|
|
|
/mob/living/basic/attack_hulk(mob/living/carbon/human/user)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
playsound(loc, "punch", 25, TRUE, -1)
|
|
visible_message(span_danger("[user] punches [src]!"), \
|
|
span_userdanger("You're punched by [user]!"), null, COMBAT_MESSAGE_RANGE, user)
|
|
to_chat(user, span_danger("You punch [src]!"))
|
|
adjustBruteLoss(15)
|
|
|
|
/mob/living/basic/attack_paw(mob/living/carbon/human/user, list/modifiers)
|
|
if(..()) //successful monkey bite.
|
|
if(stat != DEAD)
|
|
var/damage = rand(1, 3)
|
|
attack_threshold_check(damage)
|
|
return 1
|
|
if (!user.combat_mode)
|
|
if (health > 0)
|
|
visible_message(span_notice("[user.name] [response_help_continuous] [src]."), \
|
|
span_notice("[user.name] [response_help_continuous] you."), null, COMBAT_MESSAGE_RANGE, user)
|
|
to_chat(user, span_notice("You [response_help_simple] [src]."))
|
|
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
|
|
|
|
|
|
/mob/living/basic/attack_alien(mob/living/carbon/alien/humanoid/user, list/modifiers)
|
|
if(..()) //if harm or disarm intent.
|
|
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
|
playsound(loc, 'sound/weapons/pierce.ogg', 25, TRUE, -1)
|
|
visible_message(span_danger("[user] [response_disarm_continuous] [name]!"), \
|
|
span_userdanger("[user] [response_disarm_continuous] you!"), null, COMBAT_MESSAGE_RANGE, user)
|
|
to_chat(user, span_danger("You [response_disarm_simple] [name]!"))
|
|
log_combat(user, src, "disarmed")
|
|
else
|
|
var/damage = rand(15, 30)
|
|
visible_message(span_danger("[user] slashes at [src]!"), \
|
|
span_userdanger("You're slashed at by [user]!"), null, COMBAT_MESSAGE_RANGE, user)
|
|
to_chat(user, span_danger("You slash at [src]!"))
|
|
playsound(loc, 'sound/weapons/slice.ogg', 25, TRUE, -1)
|
|
attack_threshold_check(damage)
|
|
log_combat(user, src, "attacked")
|
|
return 1
|
|
|
|
/mob/living/basic/attack_larva(mob/living/carbon/alien/larva/L)
|
|
. = ..()
|
|
if(. && stat != DEAD) //successful larva bite
|
|
var/damage = rand(5, 10)
|
|
. = attack_threshold_check(damage)
|
|
if(.)
|
|
L.amount_grown = min(L.amount_grown + damage, L.max_grown)
|
|
|
|
/mob/living/basic/attack_basic_mob(mob/living/basic/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
var/damage = rand(user.melee_damage_lower, user.melee_damage_upper)
|
|
return attack_threshold_check(damage, user.melee_damage_type)
|
|
|
|
/mob/living/basic/attack_animal(mob/living/simple_animal/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
var/damage = rand(user.melee_damage_lower, user.melee_damage_upper)
|
|
return attack_threshold_check(damage, user.melee_damage_type)
|
|
|
|
/mob/living/basic/attack_slime(mob/living/simple_animal/slime/M)
|
|
if(..()) //successful slime attack
|
|
var/damage = rand(15, 25)
|
|
if(M.is_adult)
|
|
damage = rand(20, 35)
|
|
return attack_threshold_check(damage)
|
|
|
|
/mob/living/basic/attack_drone(mob/living/simple_animal/drone/M)
|
|
if(M.combat_mode) //No kicking dogs even as a rogue drone. Use a weapon.
|
|
return
|
|
return ..()
|
|
|
|
/mob/living/basic/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = MELEE, actuallydamage = TRUE)
|
|
var/temp_damage = damage
|
|
if(!damage_coeff[damagetype])
|
|
temp_damage = 0
|
|
else
|
|
temp_damage *= damage_coeff[damagetype]
|
|
|
|
if(actuallydamage)
|
|
apply_damage(damage, damagetype, null, getarmor(null, armorcheck))
|
|
return TRUE
|
|
|
|
/mob/living/basic/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE)
|
|
apply_damage(Proj.damage, Proj.damage_type)
|
|
Proj.on_hit(src, 0, piercing_hit)
|
|
return BULLET_ACT_HIT
|
|
|
|
/mob/living/basic/ex_act(severity, target, origin)
|
|
if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src))
|
|
return FALSE
|
|
|
|
. = ..()
|
|
if(QDELETED(src))
|
|
return
|
|
var/bomb_armor = getarmor(null, BOMB)
|
|
switch (severity)
|
|
if (EXPLODE_DEVASTATE)
|
|
if(prob(bomb_armor))
|
|
adjustBruteLoss(500)
|
|
else
|
|
gib()
|
|
return
|
|
if (EXPLODE_HEAVY)
|
|
var/bloss = 60
|
|
if(prob(bomb_armor))
|
|
bloss = bloss / 1.5
|
|
adjustBruteLoss(bloss)
|
|
|
|
if (EXPLODE_LIGHT)
|
|
var/bloss = 30
|
|
if(prob(bomb_armor))
|
|
bloss = bloss / 1.5
|
|
adjustBruteLoss(bloss)
|
|
|
|
/mob/living/basic/blob_act(obj/structure/blob/B)
|
|
adjustBruteLoss(20)
|
|
return
|
|
|
|
/mob/living/basic/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect)
|
|
if(!no_effect && !visual_effect_icon && melee_damage_upper)
|
|
if(attack_vis_effect && !iswallturf(A)) // override the standard visual effect.
|
|
visual_effect_icon = attack_vis_effect
|
|
else if(melee_damage_upper < 10)
|
|
visual_effect_icon = ATTACK_EFFECT_PUNCH
|
|
else
|
|
visual_effect_icon = ATTACK_EFFECT_SMASH
|
|
..()
|
|
|
|
|
|
/mob/living/basic/update_stat()
|
|
if(status_flags & GODMODE)
|
|
return
|
|
if(stat != DEAD)
|
|
if(health <= 0)
|
|
death()
|
|
else
|
|
set_stat(CONSCIOUS)
|
|
med_hud_set_status()
|