Skip to content

Commit

Permalink
Implement bloodfledge emag
Browse files Browse the repository at this point in the history
- Adds the Hemorrhagic Sanguinizer
- Adds proc get_blood_prefix()
- Adds new bloodmag sprite
  • Loading branch information
LeDrascol committed Nov 9, 2024
1 parent c5a2581 commit 10a92e4
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 54 deletions.
45 changes: 45 additions & 0 deletions code/__HELPERS/~splurt_helpers/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,48 @@
if(istype(I) && (I.body_parts_covered & body_part))
return FALSE
return TRUE

/mob/living/carbon/proc/get_blood_prefix()
// Check for hemophage
if(ishemophage(src))
return "Hemo"

// Check for Synthetic
else if(issynthetic(src))
return "Oil"

// Check for Teshari
else if(isteshari(src))
return "Ammonia"

// Check for Shadekin
else if(isshadekin(src))
return "Shade"

// Check for round-start Slime
else if(isroundstartslime(src))
return "Slime"

// Check for Snail
else if(issnail(src))
return "Lube"

// Check for Skrell
else if(is_species(src,/datum/species/skrell))
return "Copper"

// Check for Xenomorph Hybrid
else if(isxenohybrid(src))
return "Acid"

// Check for Ethreal
else if(isethereal(src))
return "Electro"

// Check for Podperson
else if(ispodperson(src))
return "Hydro"

// Check for Plasmaman
else if(isplasmaman(src))
return "Plasma"
33 changes: 33 additions & 0 deletions modular_zzplurt/code/datums/components/crafting/equipment.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Bloodfledge exclusive emag
/datum/crafting_recipe/emag_bloodfledge
name = "Hemorrhagic Sanguinizer"
desc = "A modified Bloodfledge ID card capable of channeling technopathic blood magic."
reqs = list(
/obj/item/card/id/vampire = 1,
/obj/item/assembly/signaler = 1,
/obj/item/reagent_containers/syringe = 1,
/obj/item/reagent_containers/blood = 1,
/obj/item/stack/cable_coil = 5,
)
result = /obj/item/card/emag/bloodfledge
tool_behaviors = list(TOOL_SCREWDRIVER, TOOL_WIRECUTTER, TOOL_MULTITOOL)
category = CAT_EQUIPMENT
crafting_flags = CRAFT_MUST_BE_LEARNED

// Bloodfledge emag post-crafting
/datum/crafting_recipe/emag_bloodfledge/on_craft_completion(mob/user, atom/result)
// Define carbon holder
var/mob/living/carbon/item_mob = user

// Check for valid holder
if(!item_mob)
// Do nothing
return

// Get blood prefix
var/blood_name = item_mob?.get_blood_prefix()

// Check if blood prefix exists
if(blood_name)
// Rename the card
result.name = LOWER_TEXT("[blood_name]rrhagic Sanguinizer")
64 changes: 10 additions & 54 deletions modular_zzplurt/code/datums/quirks/positive_quirks/bloodfledge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
// Register examine text
RegisterSignal(quirk_holder, COMSIG_ATOM_EXAMINE, PROC_REF(quirk_examine_bloodfledge))

// Teach how to make the Hemorrhagic Sanguinizer
quirk_mob.mind?.teach_crafting_recipe(/datum/crafting_recipe/emag_bloodfledge)

/datum/quirk/item_quirk/bloodfledge/post_add()
. = ..()

Expand Down Expand Up @@ -167,60 +170,13 @@
// Define default card type name
var/card_name_type = "Blood"

// Beginning of species blood type checks
// These are mostly based on unique species blood

// Check for hemophage
if(ishemophage(quirk_mob))
card_name_type = "Hemo"

// Check for real vampire
/*
else if(isvampire(quirk_mob))
card_name_type = "Vamp"
*/

// Check for Synthetic
else if(issynthetic(quirk_mob))
card_name_type = "Oil"

// Check for Teshari
else if(isteshari(quirk_mob))
card_name_type = "Ammonia"

// Check for Shadekin
else if(isshadekin(quirk_mob))
card_name_type = "Shade"

// Check for round-start Slime
else if(isroundstartslime(quirk_mob))
card_name_type = "Slime"

// Check for Snail
else if(issnail(quirk_mob))
card_name_type = "Lube"

// Check for Skrell
else if(is_species(quirk_mob,/datum/species/skrell))
card_name_type = "Copper"

// Check for Xenomorph Hybrid
else if(isxenohybrid(quirk_mob))
card_name_type = "Acid"

// Check for Ethreal
else if(isethereal(quirk_mob))
card_name_type = "Electro"

// Check for Podperson
else if(ispodperson(quirk_mob))
card_name_type = "Hydro"

// Check for Plasmaman
else if(isplasmaman(quirk_mob))
card_name_type = "Plasma"
// Define possible blood prefix
var/blood_prefix = quirk_mob.get_blood_prefix()

// End of species blood type checks
// Check if species blood prefix was returned
if(blood_prefix)
// Set new card type
card_name_type = blood_prefix

// Define operative alias
var/operative_alias = client_source?.prefs?.read_preference(/datum/preference/name/operative_alias)
Expand Down Expand Up @@ -304,7 +260,7 @@
return

// Check if examiner shares the quirk
if(isbloodfledge(examiner))
if((examiner))
// Add detection text
examine_list += span_info("[quirk_holder.p_their(TRUE)] hunger makes it easy to identify [quirk_holder.p_them()] as a fellow sanguine!")

Expand Down
184 changes: 184 additions & 0 deletions modular_zzplurt/code/game/objects/items/emags.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#define BLOODMAG_USE_COST (BLOOD_VOLUME_NORMAL * 0.10) // 10% of standard blood
#define BLOODMAG_USE_COST_FAKE (BLOOD_VOLUME_NORMAL * 0.01) // 1% of standard blood
#define BLOODMAG_CD_TIME 3 SECONDS

//
// Bloodfledge exclusive emag
//
/obj/item/card/emag/bloodfledge
name = "hemorrhagic sanguinizer"
desc = "A card with a blood seal attached to some circuitry. Requires special training to use properly."
icon = 'modular_zzplurt/icons/obj/card.dmi'
icon_state = "bloodmag"
// List of allowed types - Unused!
//var/type_whitelist

// Can this actually emag things?
var/unlocked = FALSE

// Cooldown between uses
COOLDOWN_DECLARE(bloodmag_cooldown)

// On creation
// Unused feature: type whitelist
/*
/obj/item/card/emag/bloodfledge/Initialize(mapload)
. = ..()
// List of object types this emag can affect
type_whitelist = list(
typesof(/obj/machinery/chem_dispenser), // Unlocks more reagents
typesof(/obj/structure/bodycontainer/morgue), // Changes status light
)
*/

// Emag the bloodmag
/obj/item/card/emag/bloodfledge/emag_act(mob/user, obj/item/card/emag/emag_card)
// Check if valid
if(isnull(user) || !istype(emag_card))
return FALSE

// Check if already unlocked
if(unlocked)
// Alert user and return
balloon_alert(user, "already upgraded!")
return FALSE

// Unlock full functionality
unlocked = TRUE

// Alert user
balloon_alert(user, "sanguinizer upgraded!")

// Examine text
/obj/item/card/emag/bloodfledge/examine(mob/user)
. = ..()

// Check for bloodfledge
if(HAS_TRAIT(user, TRAIT_BLOODFLEDGE))
// Check if unlocked
if(unlocked)
// Add unlocked text
. += span_notice("It's been switched to hemorrhagic sequencing mode.")

// Item is not unlocked
else
// Add fake usage text
. += span_notice("You know exactly how to sanguinize things with this!")

// Can use check
/obj/item/card/emag/bloodfledge/can_emag(atom/target, mob/user)
. = ..()

// Check parent return
if(!.)
return FALSE

// Check for bloodfledge
if(!HAS_TRAIT(user, TRAIT_BLOODFLEDGE))
// Warn user and return
to_chat(user, span_warning("You can't figure out what to do with [src]. Maybe you should ask someone more qualified."))
return FALSE

// Check for bloodless
if(HAS_TRAIT(user, TRAIT_NOBLOOD))
// Warn user and return
to_chat(user, span_warning("Your body is incapable of utilizing [src]!"))
return FALSE

// Check cooldown
if(!COOLDOWN_FINISHED(src, bloodmag_cooldown))
// Warn user and return
balloon_alert(user, "still recharging!")
return FALSE

// Check for unlocked state
if(!unlocked)
// Give false alerts
user.visible_message(span_danger("[user] sanguinizes [target] with [user.p_their()] [src]! Never before has [target] been more sanguine!"), span_warning("You sanguinize [target]! Never before has [target] been more sanguine!"))
balloon_alert(user, "target sanguinized!")

// Start cooldown to prevent spam
COOLDOWN_START(src, bloodmag_cooldown, BLOODMAG_CD_TIME)

// Apply color named "Sanguine"
//target.add_atom_colour("#6D0C0D", WASHABLE_COLOUR_PRIORITY)

// Define carbon holder
var/mob/living/carbon/item_mob = user

// Check if holder exists
if(item_mob)
// Cause user to bleed
item_mob.bleed(BLOODMAG_USE_COST_FAKE)

// Apply blood to the target
target.add_mob_blood(item_mob)

// Return failure
return FALSE

// Allow use
return TRUE

// Unused feature: type whitelist
/*
// Check for compatible object type
for (var/list/subtypelist in type_whitelist)
if (target.type in subtypelist)
return TRUE
// Interaction is not valid
// Warn user and return
balloon_alert(user, "incompatible target!")
return FALSE
*/

// Trigger on using
/obj/item/card/emag/bloodfledge/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
. = ..()

// Check if successful
if(. != ITEM_INTERACT_SUCCESS)
// Do nothing
return

// Start cooldown
COOLDOWN_START(src, bloodmag_cooldown, BLOODMAG_CD_TIME)

// Define carbon holder
var/mob/living/carbon/item_mob = user

// Check if holder exists
if(item_mob)
// Cause target to bleed
item_mob.bleed(BLOODMAG_USE_COST)

// Apply blood to the target
interacting_with.add_mob_blood(item_mob)

// Warn user
to_chat(user, span_boldwarning("You can feel [src] draining your life force."))

// Suicide action
/obj/item/card/emag/bloodfledge/suicide_act(mob/living/carbon/user)
// Alert in chat
user.visible_message(span_suicide("[user] hacks themselves with [src], unlocking ultra gore mode!"))

// Gib the user
user.gib(DROP_ALL_REMAINS)

// Check if unlocked
if(unlocked)
// Explode
explosion(src, light_impact_range = 1, explosion_cause = src)

// Delete item
qdel(src)

// Return success
return MANUAL_SUICIDE

#undef BLOODMAG_USE_COST
#undef BLOODMAG_USE_COST_FAKE
#undef BLOODMAG_CD_TIME
Binary file modified modular_zzplurt/icons/obj/card.dmi
Binary file not shown.
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -9390,6 +9390,7 @@
#include "modular_zzplurt\code\datums\outfit.dm"
#include "modular_zzplurt\code\datums\sprite_accessories.dm"
#include "modular_zzplurt\code\datums\components\crafting\crafting.dm"
#include "modular_zzplurt\code\datums\components\crafting\equipment.dm"
#include "modular_zzplurt\code\datums\elements\headpat.dm"
#include "modular_zzplurt\code\datums\elements\holder_micro.dm"
#include "modular_zzplurt\code\datums\elements\mob_holder.dm"
Expand Down Expand Up @@ -9442,6 +9443,7 @@
#include "modular_zzplurt\code\game\objects\items.dm"
#include "modular_zzplurt\code\game\objects\effects\effect_system\effects_sparks.dm"
#include "modular_zzplurt\code\game\objects\items\cards_ids.dm"
#include "modular_zzplurt\code\game\objects\items\emags.dm"
#include "modular_zzplurt\code\game\objects\items\holy_weapons.dm"
#include "modular_zzplurt\code\game\objects\items\devices\transfer_valve.dm"
#include "modular_zzplurt\code\game\objects\items\implants\implant_disrobe.dm"
Expand Down

0 comments on commit 10a92e4

Please sign in to comment.