mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 03:52:31 +00:00
* Basic skeletons (#79206) ## About The Pull Request Turns skeletons (the simple animal version) into basic mobs. This was another incredibly simple conversion, since skeletons don't really do anything but walk at you and beat you to death. Because I thought it was funny, though, skeletons will now seek out cartons of milk and drink them. Real milk will heal them for a significant amount, but soymilk, being false milk, will deal them grievous injury instead! Skeletons beware... I didn't add any other sorts of milk due to limited ability with existing AI behaviors to identify milk containers (they actually only look for the carton items). Other than that, I've done some flavor adjustment for skeletons' attacks - their effects and sounds will now suit the weapon they're actually holding - for example, skeleton templars now actually use their swords instead of slashing you with their horrible fingers. Along with this I gave the basic skeletons a normal slashing sound, instead of the weird, impactless hallucination sound they used to use for some reason. I never liked that sound. Finally, I've reflavored the spear-wielding skeleton mobs to "undead settlers", following the naming of the corpses dropped by snow legions as of #76898, rather than being named after an offensive term for Inuit people. These skeletons do, after all, appear in settlements on alien worlds. To enable the flavor of milk drinking, I expanded the `basic_eating` component to allow drinking rather than eating flavor, with a different sound and its own set of verbs. This deletes whatever they drink from, but c'est la vie. ## Why It's Good For The Game Ticks 6 more entries off the simple animal freeze. While skeletons are still extremely simple, being largely-identical mobs that only exist to beat you to death, being basic mobs should make them slightly better at this job. Also, again, I think it's really funny that you can distract skeleton mobs with milk, or even hurt them. ## Changelog 🆑 refactor: Hostile skeleton NPCs now use the basic mob framework. They're a little smarter, and they also have a slightly improved set of attack effects and sounds. They love to drink milk, but will be harmed greatly if any heartless spaceman tricks them into drinking soymilk instead. Please report any bugs. /🆑 * Basic skeletons * updatepaths --------- Co-authored-by: lizardqueenlexi <105025397+lizardqueenlexi@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
87 lines
2.8 KiB
Plaintext
87 lines
2.8 KiB
Plaintext
/**
|
|
* ## basic eating element!
|
|
*
|
|
* Small behavior for non-carbons to eat certain stuff they interact with
|
|
*/
|
|
/datum/element/basic_eating
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// Amount to heal
|
|
var/heal_amt
|
|
/// Amount to hurt
|
|
var/damage_amount
|
|
/// Type of hurt to apply
|
|
var/damage_type
|
|
/// Whether to flavor it as drinking rather than eating.
|
|
var/drinking
|
|
/// Types the animal can eat.
|
|
var/list/food_types
|
|
|
|
/datum/element/basic_eating/Attach(datum/target, heal_amt = 0, damage_amount = 0, damage_type = null, drinking = FALSE, food_types = list())
|
|
. = ..()
|
|
|
|
if(!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.heal_amt = heal_amt
|
|
src.damage_amount = damage_amount
|
|
src.damage_type = damage_type
|
|
src.drinking = drinking
|
|
src.food_types = food_types
|
|
|
|
//this lets players eat
|
|
RegisterSignal(target, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_unarm_attack))
|
|
//this lets ai eat. yes, i'm serious
|
|
RegisterSignal(target, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(on_pre_attackingtarget))
|
|
|
|
/datum/element/basic_eating/Detach(datum/target)
|
|
UnregisterSignal(target, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_HOSTILE_PRE_ATTACKINGTARGET))
|
|
return ..()
|
|
|
|
/datum/element/basic_eating/proc/on_unarm_attack(mob/living/eater, atom/target, proximity, modifiers)
|
|
SIGNAL_HANDLER
|
|
if(!proximity)
|
|
return NONE
|
|
|
|
if(try_eating(eater, target))
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN
|
|
return NONE
|
|
|
|
/datum/element/basic_eating/proc/on_pre_attackingtarget(mob/living/eater, atom/target)
|
|
SIGNAL_HANDLER
|
|
try_eating(eater, target)
|
|
|
|
/datum/element/basic_eating/proc/try_eating(mob/living/eater, atom/target)
|
|
if(!is_type_in_list(target, food_types))
|
|
return FALSE
|
|
var/eat_verb
|
|
if(drinking)
|
|
eat_verb = pick("slurp","sip","guzzle","drink","quaff","suck")
|
|
else
|
|
eat_verb = pick("bite","chew","nibble","gnaw","gobble","chomp")
|
|
|
|
if (heal_amt > 0)
|
|
var/healed = heal_amt && eater.health < eater.maxHealth
|
|
if(heal_amt)
|
|
eater.heal_overall_damage(heal_amt)
|
|
eater.visible_message(span_notice("[eater] [eat_verb]s [target]."), span_notice("You [eat_verb] [target][healed ? ", restoring some health" : ""]."))
|
|
finish_eating(eater, target)
|
|
return TRUE
|
|
|
|
if (damage_amount > 0 && damage_type)
|
|
eater.apply_damage(damage_amount, damage_type)
|
|
eater.visible_message(span_notice("[eater] [eat_verb]s [target], and seems to hurt itself."), span_notice("You [eat_verb] [target], hurting yourself in the process."))
|
|
finish_eating(eater, target)
|
|
return TRUE
|
|
|
|
eater.visible_message(span_notice("[eater] [eat_verb]s [target]."), span_notice("You [eat_verb] [target]."))
|
|
finish_eating(eater, target)
|
|
return TRUE
|
|
|
|
/datum/element/basic_eating/proc/finish_eating(mob/living/eater, atom/target)
|
|
if(drinking)
|
|
playsound(eater.loc,'sound/items/drink.ogg', rand(10,50), TRUE)
|
|
else
|
|
playsound(eater.loc,'sound/items/eatfood.ogg', rand(10,50), TRUE)
|
|
qdel(target)
|