Rewrites how species are granted abilities + rewrites some of abilities themselves (#22366)

* guh, the work begins

* done for now hopefully

* lint

* Update maglock.dm

* Update maglock.dm

* done
This commit is contained in:
Molti
2024-07-17 14:36:50 -05:00
committed by GitHub
parent a9b828b535
commit e836e6fdac
9 changed files with 181 additions and 282 deletions

View File

@@ -223,6 +223,11 @@ GLOBAL_LIST_EMPTY(features_by_species)
/// Do we try to prevent reset_perspective() from working? Useful for Dullahans to stop perspective changes when they're looking through their head. /// Do we try to prevent reset_perspective() from working? Useful for Dullahans to stop perspective changes when they're looking through their head.
var/prevent_perspective_change = FALSE var/prevent_perspective_change = FALSE
/// List of the type path of every ability innate to this species
var/list/species_abilities = list()
/// List of the created abilities, stored for the purpose of removal later, please do not touch this if you don't need to
var/list/datum/action/instantiated_abilities = list()
/////////// ///////////
// PROCS // // PROCS //
/////////// ///////////
@@ -502,6 +507,11 @@ GLOBAL_LIST_EMPTY(features_by_species)
fly = new fly = new
fly.Grant(C) fly.Grant(C)
for(var/ability_path in species_abilities)
var/datum/action/ability = new ability_path(C)
ability.Grant(C)
instantiated_abilities += ability
C.add_movespeed_modifier(MOVESPEED_ID_SPECIES, TRUE, 100, override=TRUE, multiplicative_slowdown=speedmod, movetypes=(~FLYING)) C.add_movespeed_modifier(MOVESPEED_ID_SPECIES, TRUE, 100, override=TRUE, multiplicative_slowdown=speedmod, movetypes=(~FLYING))
C.regenerate_icons() C.regenerate_icons()
SEND_SIGNAL(C, COMSIG_SPECIES_GAIN, src, old_species) SEND_SIGNAL(C, COMSIG_SPECIES_GAIN, src, old_species)
@@ -547,6 +557,11 @@ GLOBAL_LIST_EMPTY(features_by_species)
C.dna.features["wingsdetail"] = "None" C.dna.features["wingsdetail"] = "None"
C.update_body() C.update_body()
for(var/datum/action/ability as anything in instantiated_abilities)
ability.Remove(C)
instantiated_abilities -= ability
qdel(ability)
C.remove_movespeed_modifier(MOVESPEED_ID_SPECIES) C.remove_movespeed_modifier(MOVESPEED_ID_SPECIES)
SEND_SIGNAL(C, COMSIG_SPECIES_LOSS, src) SEND_SIGNAL(C, COMSIG_SPECIES_LOSS, src)

View File

@@ -51,7 +51,7 @@
// Hats need to be 1 up // Hats need to be 1 up
offset_features = list(OFFSET_HEAD = list(0,1)) offset_features = list(OFFSET_HEAD = list(0,1))
var/datum/action/innate/change_screen/change_screen species_abilities = list(/datum/action/innate/change_screen)
smells_like = "industrial lubricant" smells_like = "industrial lubricant"
@@ -66,9 +66,6 @@
if(A) if(A)
A.Remove(C) A.Remove(C)
QDEL_NULL(A) QDEL_NULL(A)
if(ishuman(C) && !change_screen)
change_screen = new
change_screen.Grant(C)
for(var/obj/item/bodypart/O in C.bodyparts) for(var/obj/item/bodypart/O in C.bodyparts)
O.render_like_organic = TRUE // Makes limbs render like organic limbs instead of augmented limbs, check bodyparts.dm O.render_like_organic = TRUE // Makes limbs render like organic limbs instead of augmented limbs, check bodyparts.dm
var/chassis = C.dna.features["ipc_chassis"] var/chassis = C.dna.features["ipc_chassis"]
@@ -82,8 +79,6 @@
/datum/species/ipc/on_species_loss(mob/living/carbon/C) /datum/species/ipc/on_species_loss(mob/living/carbon/C)
. = ..() . = ..()
QDEL_NULL(C.particles) QDEL_NULL(C.particles)
if(change_screen)
change_screen.Remove(C)
/datum/species/ipc/proc/handle_speech(datum/source, list/speech_args) /datum/species/ipc/proc/handle_speech(datum/source, list/speech_args)
speech_args[SPEECH_SPANS] |= SPAN_ROBOT speech_args[SPEECH_SPANS] |= SPAN_ROBOT

View File

@@ -13,7 +13,6 @@
mutanttongue = /obj/item/organ/tongue/slime mutanttongue = /obj/item/organ/tongue/slime
mutantlungs = /obj/item/organ/lungs/slime mutantlungs = /obj/item/organ/lungs/slime
damage_overlay_type = "" damage_overlay_type = ""
var/datum/action/innate/regenerate_limbs/regenerate_limbs
liked_food = MEAT liked_food = MEAT
coldmod = 6 coldmod = 6
heatmod = 0.5 heatmod = 0.5
@@ -23,19 +22,17 @@
swimming_component = /datum/component/swimming/dissolve swimming_component = /datum/component/swimming/dissolve
hair_color = "mutcolor" hair_color = "mutcolor"
hair_alpha = 140 hair_alpha = 140
species_abilities = list(/datum/action/innate/regenerate_limbs)
var/soggy = FALSE var/soggy = FALSE
/datum/species/jelly/on_species_loss(mob/living/carbon/C) /datum/species/jelly/on_species_loss(mob/living/carbon/C)
if(regenerate_limbs)
regenerate_limbs.Remove(C)
C.faction -= "slime" C.faction -= "slime"
..() return ..()
/datum/species/jelly/on_species_gain(mob/living/carbon/C, datum/species/old_species) /datum/species/jelly/on_species_gain(mob/living/carbon/C, datum/species/old_species)
..() . = ..()
if(ishuman(C))
regenerate_limbs = new
regenerate_limbs.Grant(C)
C.faction |= "slime" C.faction |= "slime"
/datum/species/jelly/spec_life(mob/living/carbon/human/H) /datum/species/jelly/spec_life(mob/living/carbon/human/H)
@@ -59,8 +56,9 @@
to_chat(H, span_danger("You feel drained!")) to_chat(H, span_danger("You feel drained!"))
if(H.blood_volume < BLOOD_VOLUME_BAD(H)) if(H.blood_volume < BLOOD_VOLUME_BAD(H))
Cannibalize_Body(H) Cannibalize_Body(H)
if(regenerate_limbs) var/datum/action/innate/regenerate_limbs/ability = locate() in instantiated_abilities
regenerate_limbs.build_all_button_icons() if(ability)
ability.build_all_button_icons()
/datum/species/jelly/proc/Cannibalize_Body(mob/living/carbon/human/H) /datum/species/jelly/proc/Cannibalize_Body(mob/living/carbon/human/H)
var/list/limbs_to_consume = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) - H.get_missing_limbs() var/list/limbs_to_consume = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) - H.get_missing_limbs()
@@ -198,15 +196,15 @@
hair_color = "mutcolor" hair_color = "mutcolor"
hair_alpha = 150 hair_alpha = 150
ignored_by = list(/mob/living/simple_animal/slime) ignored_by = list(/mob/living/simple_animal/slime)
var/datum/action/innate/split_body/slime_split
species_abilities = list(
/datum/action/innate/regenerate_limbs,
/datum/action/innate/split_body,
/datum/action/innate/swap_body
)
var/list/mob/living/carbon/bodies var/list/mob/living/carbon/bodies
var/datum/action/innate/swap_body/swap_body
/datum/species/jelly/slime/on_species_loss(mob/living/carbon/C) /datum/species/jelly/slime/on_species_loss(mob/living/carbon/C)
if(slime_split)
slime_split.Remove(C)
if(swap_body)
swap_body.Remove(C)
bodies -= C // This means that the other bodies maintain a link bodies -= C // This means that the other bodies maintain a link
// so if someone mindswapped into them, they'd still be shared. // so if someone mindswapped into them, they'd still be shared.
bodies = null bodies = null
@@ -216,11 +214,6 @@
/datum/species/jelly/slime/on_species_gain(mob/living/carbon/C, datum/species/old_species) /datum/species/jelly/slime/on_species_gain(mob/living/carbon/C, datum/species/old_species)
..() ..()
if(ishuman(C)) if(ishuman(C))
slime_split = new
slime_split.Grant(C)
swap_body = new
swap_body.Grant(C)
if(!bodies || !bodies.len) if(!bodies || !bodies.len)
bodies = list(C) bodies = list(C)
else else
@@ -238,8 +231,7 @@
else if(H.nutrition >= NUTRITION_LEVEL_WELL_FED) else if(H.nutrition >= NUTRITION_LEVEL_WELL_FED)
H.blood_volume += 3 H.blood_volume += 3
H.adjust_nutrition(-2.5) H.adjust_nutrition(-2.5)
return ..()
..()
/datum/action/innate/split_body /datum/action/innate/split_body
name = "Split Body" name = "Split Body"
@@ -430,10 +422,10 @@
SS.bodies -= dupe SS.bodies -= dupe
return FALSE return FALSE
if(dupe.stat == DEAD) //Is it alive? if(H.stat != CONSCIOUS) //Are we alive and awake?
return FALSE return FALSE
if(dupe.stat != CONSCIOUS) //Is it awake? if(dupe.stat != CONSCIOUS) //Is it alive and awake?
return FALSE return FALSE
if(dupe.mind && dupe.mind.active) //Is it unoccupied? if(dupe.mind && dupe.mind.active) //Is it unoccupied?
@@ -470,10 +462,15 @@
id = SPECIES_LUMINESCENT id = SPECIES_LUMINESCENT
say_mod = "says" say_mod = "says"
var/glow_intensity = LUMINESCENT_DEFAULT_GLOW var/glow_intensity = LUMINESCENT_DEFAULT_GLOW
species_abilities = list(
/datum/action/innate/regenerate_limbs,
/datum/action/innate/integrate_extract,
/datum/action/innate/use_extract,
/datum/action/innate/use_extract/major
)
var/obj/item/slime_extract/current_extract var/obj/item/slime_extract/current_extract
var/datum/action/innate/integrate_extract/integrate_extract
var/datum/action/innate/use_extract/extract_minor
var/datum/action/innate/use_extract/major/extract_major
var/extract_cooldown = 0 var/extract_cooldown = 0
/// Internal dummy used to glow (very cool) /// Internal dummy used to glow (very cool)
@@ -489,29 +486,15 @@
current_extract.forceMove(C.drop_location()) current_extract.forceMove(C.drop_location())
current_extract = null current_extract = null
QDEL_NULL(glow) QDEL_NULL(glow)
if(integrate_extract)
integrate_extract.Remove(C)
if(extract_minor)
extract_minor.Remove(C)
if(extract_major)
extract_major.Remove(C)
/datum/species/jelly/luminescent/on_species_gain(mob/living/carbon/C, datum/species/old_species) /datum/species/jelly/luminescent/on_species_gain(mob/living/carbon/C, datum/species/old_species)
..() ..()
glow = C.mob_light(light_type = /obj/effect/dummy/lighting_obj/moblight/species) glow = C.mob_light(light_type = /obj/effect/dummy/lighting_obj/moblight/species)
update_glow(C) update_glow(C)
integrate_extract = new(src)
integrate_extract.Grant(C)
extract_minor = new(src)
extract_minor.Grant(C)
extract_major = new(src)
extract_major.Grant(C)
/datum/species/jelly/luminescent/proc/update_slime_actions() /datum/species/jelly/luminescent/proc/update_slime_actions(mob/living/carbon/C)
integrate_extract.update_name() for(var/datum/action/ability as anything in C.actions)
integrate_extract.build_all_button_icons() ability.build_all_button_icons()
extract_minor.build_all_button_icons()
extract_major.build_all_button_icons()
/datum/species/jelly/luminescent/proc/update_glow(mob/living/carbon/C, intensity) /datum/species/jelly/luminescent/proc/update_glow(mob/living/carbon/C, intensity)
if(intensity) if(intensity)
@@ -528,17 +511,12 @@
overlay_icon_state = "bg_alien_border" overlay_icon_state = "bg_alien_border"
var/datum/species/jelly/luminescent/species var/datum/species/jelly/luminescent/species
/datum/action/innate/integrate_extract/New(_species) /datum/action/innate/integrate_extract/link_to(Target)
..() . = ..()
species = _species if(ishuman(target))
var/mob/living/carbon/human/humie = target
/datum/action/innate/integrate_extract/proc/update_name() if(humie?.dna?.species)
if(!species || !species.current_extract) species = humie.dna.species
name = "Integrate Extract"
desc = "Eat a slime extract to use its properties."
else
name = "Eject Extract"
desc = "Eject your current slime extract."
/datum/action/innate/integrate_extract/update_button_name(atom/movable/screen/movable/action_button/button, force = FALSE) /datum/action/innate/integrate_extract/update_button_name(atom/movable/screen/movable/action_button/button, force = FALSE)
var/datum/species/jelly/luminescent/species = target var/datum/species/jelly/luminescent/species = target
@@ -572,7 +550,7 @@
S.forceMove(H.drop_location()) S.forceMove(H.drop_location())
species.current_extract = null species.current_extract = null
to_chat(H, span_notice("You eject [S].")) to_chat(H, span_notice("You eject [S]."))
species.update_slime_actions() species.update_slime_actions(H)
else else
var/obj/item/I = H.get_active_held_item() var/obj/item/I = H.get_active_held_item()
if(istype(I, /obj/item/slime_extract)) if(istype(I, /obj/item/slime_extract))
@@ -585,7 +563,7 @@
S.forceMove(H) S.forceMove(H)
species.current_extract = S species.current_extract = S
to_chat(H, span_notice("You consume [I], and you feel it pulse within you...")) to_chat(H, span_notice("You consume [I], and you feel it pulse within you..."))
species.update_slime_actions() species.update_slime_actions(H)
else else
to_chat(H, span_warning("You need to hold an unused slime extract in your active hand!")) to_chat(H, span_warning("You need to hold an unused slime extract in your active hand!"))
@@ -640,101 +618,99 @@
name = "Stargazer" name = "Stargazer"
plural_form = null plural_form = null
id = SPECIES_STARGAZER id = SPECIES_STARGAZER
var/datum/action/innate/project_thought/project_thought species_abilities = list(
var/datum/action/innate/link_minds/link_minds /datum/action/innate/regenerate_limbs,
var/list/mob/living/linked_mobs = list() /datum/action/cooldown/spell/touch/link_minds,
var/list/datum/action/innate/linked_speech/linked_actions = list() /datum/action/innate/project_thought
var/mob/living/carbon/human/slimelink_owner )
var/current_link_id = 0
/datum/species/jelly/stargazer/on_species_loss(mob/living/carbon/C) /datum/action/cooldown/spell/touch/link_minds
..() name = "Link Minds"
for(var/M in linked_mobs) desc = "Link someone's mind to your Slime Link, allowing them to communicate telepathically with other linked minds."
unlink_mob(M) button_icon_state = "mindlink"
if(project_thought) button_icon = 'icons/mob/actions/actions_slime.dmi'
project_thought.Remove(C) background_icon_state = "bg_alien"
if(link_minds) overlay_icon_state = "bg_alien_border"
link_minds.Remove(C) spell_requirements = NONE
invocation_type = INVOCATION_NONE
var/list/datum/action/speech_abilities = list()
/datum/species/jelly/stargazer/spec_death(gibbed, mob/living/carbon/human/H) /datum/action/cooldown/spell/touch/link_minds/Grant(mob/grant_to)
..() . = ..()
for(var/M in linked_mobs) var/datum/action/innate/slime_speech/action = new(grant_to)
unlink_mob(M) action.Grant(grant_to)
action.linkage = src
speech_abilities += action
/datum/species/jelly/stargazer/on_species_gain(mob/living/carbon/C, datum/species/old_species) /datum/action/cooldown/spell/touch/link_minds/Remove(mob/living/remove_from)
..() for(var/datum/action/ability as anything in speech_abilities)
project_thought = new(src) ability.Remove(ability.owner)
project_thought.Grant(C) qdel(ability)
link_minds = new(src) return ..()
link_minds.Grant(C)
slimelink_owner = C
link_mob(C)
/datum/species/jelly/stargazer/proc/link_mob(mob/living/M) /datum/action/cooldown/spell/touch/link_minds/cast_on_hand_hit(obj/item/melee/touch_attack/hand, atom/target, mob/living/carbon/caster)
if(QDELETED(M) || M.stat == DEAD) if(!isliving(target))
return FALSE return
if(HAS_TRAIT(M, TRAIT_MINDSHIELD)) //mindshield implant, no dice var/mob/living/victim = target
return FALSE
if(M.can_block_magic(MAGIC_RESISTANCE_MIND, charge_cost = 0)) to_chat(caster, span_notice("You begin linking [victim]'s mind to yours..."))
return FALSE to_chat(victim, span_warning("You feel a foreign presence within your mind..."))
if(M in linked_mobs)
return FALSE if(!do_after(caster, 5 SECONDS, victim))
linked_mobs.Add(M) return
to_chat(M, span_notice("You are now connected to [slimelink_owner.real_name]'s Slime Link."))
var/datum/action/innate/linked_speech/action = new(src) for(var/datum/action/ability as anything in victim.actions)
linked_actions.Add(action) if(istype(ability, /datum/action/innate/slime_speech))
action.Grant(M) var/datum/action/innate/slime_speech/speaker = ability
if(speaker.linkage == src)
speech_abilities -= speaker
speaker.Remove(victim)
qdel(speaker)
to_chat(caster, span_notice("You release [victim] from your Slime Link."))
to_chat(victim, span_notice("You are no longer connected to [caster.real_name]'s Slime Link."))
return TRUE
var/datum/action/innate/slime_speech/action = new(victim)
action.Grant(victim)
action.linkage = src
speech_abilities += action
to_chat(caster, span_notice("You connect [victim]'s mind to your slime link!"))
to_chat(victim, span_notice("You are now connected to [caster.real_name]'s Slime Link."))
return TRUE return TRUE
/datum/species/jelly/stargazer/proc/unlink_mob(mob/living/M) /datum/action/innate/slime_speech
var/link_id = linked_mobs.Find(M)
if(!(link_id))
return
var/datum/action/innate/linked_speech/action = linked_actions[link_id]
action.Remove(M)
to_chat(M, span_notice("You are no longer connected to [slimelink_owner.real_name]'s Slime Link."))
linked_mobs[link_id] = null
linked_actions[link_id] = null
/datum/action/innate/linked_speech
name = "Slimelink" name = "Slimelink"
desc = "Send a psychic message to everyone connected to your slime link." desc = "Send a psychic message to everyone connected to your slime link."
button_icon_state = "link_speech" button_icon_state = "link_speech"
button_icon = 'icons/mob/actions/actions_slime.dmi' button_icon = 'icons/mob/actions/actions_slime.dmi'
background_icon_state = "bg_alien" background_icon_state = "bg_alien"
var/datum/species/jelly/stargazer/species var/datum/action/cooldown/spell/touch/link_minds/linkage
/datum/action/innate/linked_speech/New(_species) /datum/action/innate/slime_speech/Activate()
..()
species = _species
/datum/action/innate/linked_speech/Activate()
var/mob/living/carbon/human/H = owner var/mob/living/carbon/human/H = owner
if(!species || !(H in species.linked_mobs)) if(!linkage)
to_chat(H, span_warning("The link seems to have been severed...")) to_chat(H, span_warning("The link seems to have been severed..."))
Remove(H) Remove(H)
return return
var/message = sanitize(input("Message:", "Slime Telepathy") as text|null) var/message = sanitize(input("Message:", "Slime Telepathy") as text|null)
if(!species || !(H in species.linked_mobs)) if(QDELETED(H) || H.stat == DEAD)
return
if(!linkage)
to_chat(H, span_warning("The link seems to have been severed...")) to_chat(H, span_warning("The link seems to have been severed..."))
Remove(H) Remove(H)
return return
if(QDELETED(H) || H.stat == DEAD)
species.unlink_mob(H)
return
if(message) if(message)
var/msg = "<i><font color=#008CA2>\[[species.slimelink_owner.real_name]'s Slime Link\] <b>[H]:</b> [message]</font></i>" var/msg = "<i><font color=#008CA2>\[[linkage.owner.real_name]'s Slime Link\] <b>[H]:</b> [message]</font></i>"
log_directed_talk(H, species.slimelink_owner, msg, LOG_SAY, "slime link") log_directed_talk(H, linkage.owner, msg, LOG_SAY, "slime link")
for(var/X in species.linked_mobs) for(var/X in linkage.speech_abilities)
var/mob/living/M = X var/datum/action/innate/linked_speech = X
if(QDELETED(M) || M.stat == DEAD) if(!linked_speech || !istype(linked_speech))
species.unlink_mob(M)
continue continue
to_chat(M, msg) to_chat(linked_speech.owner, msg)
for(var/X in GLOB.dead_mob_list) for(var/X in GLOB.dead_mob_list)
var/mob/M = X var/mob/M = X
@@ -780,39 +756,3 @@
var/follow_link_user = FOLLOW_LINK(dead, H) var/follow_link_user = FOLLOW_LINK(dead, H)
var/follow_link_target = FOLLOW_LINK(dead, M) var/follow_link_target = FOLLOW_LINK(dead, M)
to_chat(dead, "[follow_link_user] [span_name("[H]")] [span_alertalien("Slime Telepathy --> ")] [follow_link_target] [span_name("[M]")] [span_noticealien("[msg]")]") to_chat(dead, "[follow_link_user] [span_name("[H]")] [span_alertalien("Slime Telepathy --> ")] [follow_link_target] [span_name("[M]")] [span_noticealien("[msg]")]")
/datum/action/innate/link_minds
name = "Link Minds"
desc = "Link someone's mind to your Slime Link, allowing them to communicate telepathically with other linked minds."
button_icon_state = "mindlink"
button_icon = 'icons/mob/actions/actions_slime.dmi'
background_icon_state = "bg_alien"
overlay_icon_state = "bg_alien_border"
var/datum/species/jelly/stargazer/species
/datum/action/innate/link_minds/New(_species)
..()
species = _species
/datum/action/innate/link_minds/Activate()
var/mob/living/carbon/human/H = owner
if(!is_species(H, /datum/species/jelly/stargazer))
return
CHECK_DNA_AND_SPECIES(H)
if(!H.pulling || !isliving(H.pulling) || H.grab_state < GRAB_AGGRESSIVE)
to_chat(H, span_warning("You need to aggressively grab someone to link minds!"))
return
var/mob/living/target = H.pulling
to_chat(H, span_notice("You begin linking [target]'s mind to yours..."))
to_chat(target, span_warning("You feel a foreign presence within your mind..."))
if(do_after(H, 6 SECONDS, target))
if(H.pulling != target || H.grab_state < GRAB_AGGRESSIVE)
return
if(species.link_mob(target))
to_chat(H, span_notice("You connect [target]'s mind to your slime link!"))
else
to_chat(H, span_warning("You can't seem to link [target]'s mind..."))
to_chat(target, span_warning("The foreign presence leaves your mind."))

View File

@@ -4,23 +4,28 @@
var/active = FALSE var/active = FALSE
/datum/action/cooldown/spell/toggle/New() /datum/action/cooldown/spell/toggle/New()
..() . = ..()
START_PROCESSING(SSfastprocess, src) START_PROCESSING(SSfastprocess, src)
/datum/action/cooldown/spell/toggle/Destroy() /datum/action/cooldown/spell/toggle/Destroy()
STOP_PROCESSING(SSfastprocess, src) STOP_PROCESSING(SSfastprocess, src)
return ..() return ..()
/datum/action/cooldown/spell/toggle/Remove(mob/living/remove_from)
if(active)
Disable()
return ..()
/datum/action/cooldown/spell/toggle/process() /datum/action/cooldown/spell/toggle/process()
build_all_button_icons(ALL) //so as to be consistent with situational requirements, keep the button updated build_all_button_icons(ALL) //so as to be consistent with situational requirements, keep the button updated
/datum/action/cooldown/spell/toggle/cast(atom/cast_on) /datum/action/cooldown/spell/toggle/cast(atom/cast_on)
. = ..()
active = !active active = !active
if(active) if(active)
Enable() Enable()
else else
Disable() Disable()
return ..()
/datum/action/cooldown/spell/toggle/is_action_active(atom/movable/screen/movable/action_button/current_button) /datum/action/cooldown/spell/toggle/is_action_active(atom/movable/screen/movable/action_button/current_button)
return active return active

View File

@@ -343,7 +343,7 @@
name = "magboot implant" name = "magboot implant"
desc = "Integrated maglock implant, allows easy movement in a zero-gravity environment." desc = "Integrated maglock implant, allows easy movement in a zero-gravity environment."
implant_type = "magboot" implant_type = "magboot"
var/datum/action/innate/magboots/implant_ability var/datum/action/cooldown/spell/toggle/maglock/implant_ability
/obj/item/organ/cyberimp/leg/magboot/l /obj/item/organ/cyberimp/leg/magboot/l
zone = BODY_ZONE_L_LEG zone = BODY_ZONE_L_LEG
@@ -355,44 +355,3 @@
/obj/item/organ/cyberimp/leg/magboot/RemoveEffect() /obj/item/organ/cyberimp/leg/magboot/RemoveEffect()
if(implant_ability) if(implant_ability)
implant_ability.Remove(owner) implant_ability.Remove(owner)
owner.remove_movespeed_modifier("Magbootimplant")
/datum/action/innate/magboots
var/lockdown = FALSE
name = "Maglock"
check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "magboots0"
button_icon = 'icons/obj/clothing/shoes.dmi'
background_icon_state = "bg_default"
/datum/action/innate/magboots/Grant(mob/M)
if(!ishuman(M))
return
. = ..()
RegisterSignal(owner, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(UpdateSpeed))
/datum/action/innate/magboots/Remove(mob/M)
UnregisterSignal(owner, COMSIG_MOVABLE_PRE_MOVE)
. = ..()
/datum/action/innate/magboots/Trigger()
if(!lockdown)
ADD_TRAIT(owner, TRAIT_NOSLIPWATER, "maglock implant")
ADD_TRAIT(owner, TRAIT_NOSLIPICE, "maglock_implant")
ADD_TRAIT(owner, TRAIT_MAGBOOTS, "maglock implant")
button_icon_state = "magboots1"
else
REMOVE_TRAIT(owner, TRAIT_NOSLIPWATER, "maglock implant")
REMOVE_TRAIT(owner, TRAIT_NOSLIPICE, "maglock_implant")
REMOVE_TRAIT(owner, TRAIT_MAGBOOTS, "maglock implant")
button_icon_state = "magboots0"
build_all_button_icons()
lockdown = !lockdown
to_chat(owner, span_notice("You [lockdown ? "enable" : "disable"] your mag-pulse traction system."))
owner.update_gravity(owner.has_gravity())
/datum/action/innate/magboots/proc/UpdateSpeed()
if(lockdown && !HAS_TRAIT(owner, TRAIT_IGNORESLOWDOWN) && owner.has_gravity())
owner.add_movespeed_modifier("Magbootimplant", update=TRUE, priority=100, multiplicative_slowdown=2, blacklisted_movetypes=(FLYING|FLOATING))
else if(owner.has_movespeed_modifier("Magbootimplant"))
owner.remove_movespeed_modifier("Magbootimplant")

View File

@@ -4469,6 +4469,7 @@
#include "yogstation\code\modules\mob\living\carbon\human\species_types\plantpeople.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\plantpeople.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\szlachta.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\szlachta.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\vox.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\vox.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\maglock.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\organs.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\organs.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\power_suck.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\power_suck.dm"
#include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\preternis.dm" #include "yogstation\code\modules\mob\living\carbon\human\species_types\preternis\preternis.dm"

View File

@@ -11,16 +11,20 @@
RegisterSignal(C, COMSIG_MOB_ALTCLICKON, PROC_REF(handle_altclick)) RegisterSignal(C, COMSIG_MOB_ALTCLICKON, PROC_REF(handle_altclick))
/datum/species/jelly/slime/proc/handle_altclick(mob/living/carbon/human/M, mob/living/carbon/human/target) /datum/species/jelly/slime/proc/handle_altclick(mob/living/carbon/human/M, mob/living/carbon/human/target)
if(M && M.mind && swap_body && swap_body.can_swap(target)) if(M && M.mind)
swap_body.swap_to_dupe(M.mind, target) var/datum/action/innate/swap_body/this_swap = locate() in instantiated_abilities
if(!this_swap || !this_swap.can_swap(target))
return
this_swap.swap_to_dupe(M.mind, target)
return COMSIG_MOB_CANCEL_CLICKON return COMSIG_MOB_CANCEL_CLICKON
/datum/action/innate/swap_body/swap_to_dupe(datum/mind/M, mob/living/carbon/human/dupe) /datum/action/innate/swap_body/swap_to_dupe(datum/mind/M, mob/living/carbon/human/dupe)
var/mob/living/carbon/human/old = M.current var/mob/living/carbon/human/old = M.current
. = ..() . = ..()
if(old != M.current && dupe == M.current && isslimeperson(dupe)) if(old != M.current && dupe == M.current && isslimeperson(dupe))
var/datum/species/jelly/slime/other_spec = dupe.dna.species var/datum/action/innate/swap_body/other_swap = locate() in dupe.actions
var/datum/action/innate/swap_body/other_swap = other_spec.swap_body if(!other_swap)
return
// theoretically the transfer_to proc is supposed to transfer the ui from the mob. // theoretically the transfer_to proc is supposed to transfer the ui from the mob.
// so I try to get the UI from one of the two mobs and schlump it over to the new action button // so I try to get the UI from one of the two mobs and schlump it over to the new action button
var/datum/tgui/ui = SStgui.get_open_ui(old, src, "main") || SStgui.get_open_ui(dupe, src, "main") var/datum/tgui/ui = SStgui.get_open_ui(old, src, "main") || SStgui.get_open_ui(dupe, src, "main")
@@ -40,10 +44,10 @@
var/mob/living/carbon/human/dupe = M.current var/mob/living/carbon/human/dupe = M.current
if(old != dupe && isslimeperson(dupe) && isslimeperson(old)) if(old != dupe && isslimeperson(dupe) && isslimeperson(old))
// transfer the swap-body ui if it's open // transfer the swap-body ui if it's open
var/datum/species/jelly/slime/this_spec = old.dna.species var/datum/action/innate/swap_body/this_swap = locate() in old.actions
var/datum/species/jelly/slime/other_spec = dupe.dna.species var/datum/action/innate/swap_body/other_swap = locate() in dupe.actions
var/datum/action/innate/swap_body/this_swap = this_spec.swap_body if(!this_swap && !other_swap)
var/datum/action/innate/swap_body/other_swap = other_spec.swap_body return
var/datum/tgui/ui = SStgui.get_open_ui(old, this_swap, "main") || SStgui.get_open_ui(dupe, this_swap, "main") var/datum/tgui/ui = SStgui.get_open_ui(old, this_swap, "main") || SStgui.get_open_ui(dupe, this_swap, "main")
if(ui) if(ui)
SStgui.on_close(ui) // basically removes it from lists is all this proc does. SStgui.on_close(ui) // basically removes it from lists is all this proc does.

View File

@@ -0,0 +1,38 @@
/datum/action/cooldown/spell/toggle/maglock
name = "Maglock"
check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "magboots0"
button_icon = 'icons/obj/clothing/shoes.dmi'
background_icon_state = "bg_default"
overlay_icon_state = "bg_alien_border"
spell_requirements = NONE
/datum/action/cooldown/spell/toggle/maglock/Grant(mob/M)
. = ..()
RegisterSignal(M, COMSIG_MOB_CLIENT_PRE_MOVE, PROC_REF(UpdateSpeed))
/datum/action/cooldown/spell/toggle/maglock/Remove(mob/M)
UnregisterSignal(M, COMSIG_MOB_CLIENT_PRE_MOVE)
return ..()
/datum/action/cooldown/spell/toggle/maglock/Enable()
ADD_TRAIT(owner, TRAIT_NOSLIPWATER, type)
ADD_TRAIT(owner, TRAIT_NOSLIPICE, type)
ADD_TRAIT(owner, TRAIT_MAGBOOTS, type)
button_icon_state = "magboots1"
to_chat(owner, span_notice("You enable your mag-pulse traction system."))
UpdateSpeed()
/datum/action/cooldown/spell/toggle/maglock/Disable()
REMOVE_TRAIT(owner, TRAIT_NOSLIPWATER, type)
REMOVE_TRAIT(owner, TRAIT_NOSLIPICE, type)
REMOVE_TRAIT(owner, TRAIT_MAGBOOTS, type)
button_icon_state = "magboots0"
to_chat(owner, span_notice("You disable your mag-pulse traction system."))
UpdateSpeed()
/datum/action/cooldown/spell/toggle/maglock/proc/UpdateSpeed()
if(active && !HAS_TRAIT(owner, TRAIT_IGNORESLOWDOWN) && owner.has_gravity())
owner.add_movespeed_modifier(type, update=TRUE, priority=100, multiplicative_slowdown = 1, blacklisted_movetypes=(FLYING|FLOATING))
else
owner.remove_movespeed_modifier(type)

View File

@@ -50,9 +50,9 @@
default_features = list("weathering" = "None", "antenna" = "None", "preternis_eye" = "Standard", "preternis_core" = "Core") default_features = list("weathering" = "None", "antenna" = "None", "preternis_eye" = "Standard", "preternis_core" = "Core")
wings_icon = "Elytra" wings_icon = "Elytra"
species_abilities = list(/datum/action/cooldown/spell/toggle/maglock)
//new variables //new variables
var/datum/action/innate/maglock/maglock
var/lockdown = FALSE
var/eating_msg_cooldown = FALSE var/eating_msg_cooldown = FALSE
var/emag_lvl = 0 var/emag_lvl = 0
var/soggy = FALSE var/soggy = FALSE
@@ -77,11 +77,6 @@
RegisterSignal(C, COMSIG_MOB_ALTCLICKON, PROC_REF(drain_power_from)) RegisterSignal(C, COMSIG_MOB_ALTCLICKON, PROC_REF(drain_power_from))
if(ishuman(C))
maglock = new
maglock.Grant(C)
lockdown = FALSE
/datum/species/preternis/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load) /datum/species/preternis/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load)
. = ..() . = ..()
for (var/V in C.bodyparts) for (var/V in C.bodyparts)
@@ -95,52 +90,6 @@
C.clear_alert("preternis_emag") //this means a changeling can transform from and back to a preternis to clear the emag status but w/e i cant find a solution to not do that C.clear_alert("preternis_emag") //this means a changeling can transform from and back to a preternis to clear the emag status but w/e i cant find a solution to not do that
C.clear_fullscreen("preternis_emag") C.clear_fullscreen("preternis_emag")
C.remove_movespeed_modifier("preternis_water") C.remove_movespeed_modifier("preternis_water")
C.remove_movespeed_modifier("preternis_maglock")
if(lockdown)
maglock.Trigger(TRUE)
if(maglock)
maglock.Remove(C)
/datum/action/innate/maglock
var/datum/species/preternis/owner_species
var/lockdown = FALSE
name = "Maglock"
check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "magboots0"
button_icon = 'icons/obj/clothing/shoes.dmi'
background_icon_state = "bg_default"
/datum/action/innate/maglock/Grant(mob/M)
if(!ispreternis(M))
return
var/mob/living/carbon/human/H = M
owner_species = H.dna.species
. = ..()
/datum/action/innate/maglock/Trigger(silent = FALSE)
var/mob/living/carbon/human/H = usr
if(!lockdown)
ADD_TRAIT(H, TRAIT_NOSLIPWATER, "preternis_maglock")
ADD_TRAIT(H, TRAIT_NOSLIPICE, "preternis_maglock")
button_icon_state = "magboots1"
else
REMOVE_TRAIT(H, TRAIT_NOSLIPWATER, "preternis_maglock")
REMOVE_TRAIT(H, TRAIT_NOSLIPICE, "preternis_maglock")
button_icon_state = "magboots0"
build_all_button_icons()
lockdown = !lockdown
owner_species.lockdown = !owner_species.lockdown
if(!silent)
to_chat(H, span_notice("You [lockdown ? "enable" : "disable"] your mag-pulse traction system."))
H.update_gravity(H.has_gravity())
/datum/species/preternis/negates_gravity(mob/living/carbon/human/H)
return (..() || lockdown)
/datum/species/preternis/has_heavy_gravity()
return (..() || lockdown)
/datum/species/preternis/spec_emag_act(mob/living/carbon/human/H, mob/user, obj/item/card/emag/emag_card) /datum/species/preternis/spec_emag_act(mob/living/carbon/human/H, mob/user, obj/item/card/emag/emag_card)
. = ..() . = ..()
@@ -180,13 +129,6 @@
emag_lvl = 0 emag_lvl = 0
H.clear_alert("preternis_emag") H.clear_alert("preternis_emag")
H.clear_fullscreen("preternis_emag") H.clear_fullscreen("preternis_emag")
/datum/species/preternis/movement_delay(mob/living/carbon/human/H)
. = ..()
if(lockdown && !HAS_TRAIT(H, TRAIT_IGNORESLOWDOWN) && H.has_gravity())
H.add_movespeed_modifier("preternis_magboot", update=TRUE, priority=100, multiplicative_slowdown=1, blacklisted_movetypes=(FLYING|FLOATING))
else if(H.has_movespeed_modifier("preternis_magboot"))
H.remove_movespeed_modifier("preternis_magboot")
/datum/species/preternis/spec_life(mob/living/carbon/human/H) /datum/species/preternis/spec_life(mob/living/carbon/human/H)
. = ..() . = ..()