adds snake coiling (#15514)

* new signals for resting and stop pulling

these are to be used as signals that will cancel the coiling

* Create coiling.dm

* Update coiling.dm

* adds sprite accessory for coiled naga

* main changes that apply the actual visuals to the coiling mechanics

* adds message to coiling, fixes offset, adds action icon

* coil offset was using old direction

* reordering

* fixes coil sprite not disappearing

* fixes offsets, solves loadout issue

* follows lin's suggestion and adds support for slimes by making it entirely handled in handle mutant
This commit is contained in:
Timothy Teakettle
2022-02-24 05:01:13 +00:00
committed by GitHub
parent 8bfbe427d3
commit f6b9858f4f
11 changed files with 124 additions and 6 deletions
+1
View File
@@ -3066,6 +3066,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
save_character()
character.dna.features = features.Copy()
character.set_species(chosen_species, icon_update = FALSE, pref_load = TRUE)
character.dna.species.eye_type = eye_type
if(chosen_limb_id && (chosen_limb_id in character.dna.species.allowed_limb_ids))
@@ -28,10 +28,9 @@
for(var/path in typesof(prototype))
if(path == prototype && skip_prototype)
continue
if(roundstart)
var/datum/sprite_accessory/P = path
if(initial(P.locked))
continue
var/datum/sprite_accessory/P = path
if((roundstart && initial(P.locked)) || initial(P.ignore))
continue
var/datum/sprite_accessory/D = new path()
if(D.icon_state)
@@ -64,6 +63,7 @@
var/mutant_part_string //Also used in species.handle_mutant_bodyparts() to generate the overlay icon state.
var/alpha_mask_state
var/matrixed_sections = MATRIX_NONE //if color_src is MATRIXED, how many sections does it have? 1-3
var/ignore = FALSE //NEVER include in customization if set to TRUE
//Special / holdover traits for Citadel specific sprites.
var/extra = FALSE
@@ -126,6 +126,11 @@
hide_legs = USE_SNEK_CLIP_MASK
matrixed_sections = MATRIX_RED_GREEN
/datum/sprite_accessory/taur/naga/coiled
name = "Naga (coiled)"
icon_state = "naga_coiled"
ignore = TRUE
/datum/sprite_accessory/taur/otie
name = "Otie"
icon_state = "otie"
@@ -0,0 +1,89 @@
/datum/action/innate/ability/coiling
name = "Coil Grabbed Mob"
check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "coil_icon"
icon_icon = 'icons/mob/actions/actions_snake.dmi'
background_icon_state = "bg_alien"
required_mobility_flags = MOBILITY_STAND
var/currently_coiling = FALSE
var/mob/living/carbon/human/currently_coiled
var/mutable_appearance/tracked_overlay
/datum/action/innate/ability/coiling/Activate()
// make sure they meet the mobility/check flags
if(IsAvailable())
// check that the user has grabbed someone and they are not currently coiling someone
if(ishuman(owner.pulling) && !currently_coiling)
coil_mob(owner.pulling)
/datum/action/innate/ability/coiling/proc/update_coil_offset(atom/source, old_dir, new_dir)
// update the coiling offset on the coiled user depending on the way the owner is facing
switch(new_dir)
if(NORTH)
currently_coiled.pixel_x = -12
if(EAST)
currently_coiled.pixel_x = -12
if(SOUTH)
currently_coiled.pixel_x = 12
if(WEST)
currently_coiled.pixel_x = 12
/datum/action/innate/ability/coiling/proc/coil_mob(var/mob/living/carbon/human/H)
// begin the coiling action
H.visible_message("<span class='warning'>[owner] coils [H] with their tail!</span>", \
"<span class='userdanger'>[owner] coils you with their tail!</span>")
currently_coiling = TRUE
currently_coiled = H
H.layer -= 0.1 // LISTEN I HATE TOUCHING MOB LAYERS TOO BUT THIS IS JUST SO THEY RENDER UNDER THE OTHER PLAYER SDFHSDFHDSFHDSH
// move user to same tile
H.forceMove(get_turf(owner))
// cancel the coiling action if certain things are done
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, .proc/cancel_coil)
RegisterSignal(owner, COMSIG_LIVING_RESTING, .proc/cancel_coil)
RegisterSignal(owner, COMSIG_LIVING_STOPPED_PULLING, .proc/cancel_coil)
// update the coil offset, update again if owner changes direction
RegisterSignal(owner, COMSIG_ATOM_DIR_CHANGE, .proc/update_coil_offset)
update_coil_offset(null, null, owner.dir)
// set our overlay to new image
var/mob/living/carbon/human/user = owner
user.dna.species.mutant_bodyparts["taur"] = "Naga (coiled)"
user.dna.features["taur"] = "Naga (coiled)"
user.update_mutant_bodyparts()
/datum/action/innate/ability/coiling/proc/cancel_coil()
var/mob/living/carbon/human/H = owner
// cancel the coiling action by removing the overlay
currently_coiled.pixel_x = 0
currently_coiling = FALSE
currently_coiled = null
// unregister signals
UnregisterSignal(owner, COMSIG_MOVABLE_MOVED)
UnregisterSignal(owner, COMSIG_LIVING_RESTING)
UnregisterSignal(owner, COMSIG_LIVING_STOPPED_PULLING)
UnregisterSignal(owner, COMSIG_ATOM_DIR_CHANGE)
// change overlay back to original image
H.dna.species.mutant_bodyparts["taur"] = "Naga"
H.dna.features["taur"] = "Naga"
H.update_mutant_bodyparts()
H.update_body()
H.layer += 0.1
// remove the added overlay
owner.cut_overlay(tracked_overlay)
tracked_overlay = null
/datum/action/innate/ability/coiling/Remove(mob/M)
cancel_coil()
..(M)
@@ -612,7 +612,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(Q.type in blacklisted_quirks)
removed_quirks += Q.type
. += 1
qdel(Q)
qdel(Q)
else
var/point_overhead = 0
for(var/datum/quirk/Q as anything in C.roundstart_quirks)
@@ -906,6 +906,22 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
var/tauric = mutant_bodyparts["taur"] && H.dna.features["taur"] && H.dna.features["taur"] != "None"
// stuff for adding/removing the coiling ability if you have a taur part
// if another action is ever based on mutant parts we should probably make a system for it so it's all done in one proc with less overhead
var/datum/action/found_action
for(var/datum/action/A in H.actions)
if(A.type == /datum/action/innate/ability/coiling)
found_action = A
if(found_action && (!tauric || (H.dna.features["taur"] != "Naga" && H.dna.features["taur"] != "Naga (coiled)")))
found_action.Remove(H)
if(!found_action && tauric && H.dna.features["taur"] == "Naga")
found_action = new /datum/action/innate/ability/coiling()
found_action.Grant(H)
for(var/mutant_part in mutant_bodyparts)
var/reference_list = GLOB.mutant_reference_list[mutant_part]
if(reference_list)
@@ -1220,7 +1236,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(!HAS_TRAIT(H, TRAIT_ROBOTIC_ORGANISM))
H.adjustBruteLoss(1)
else
H.adjustFireLoss(1) //Robots melt instead of taking brute.
H.adjustFireLoss(1) //Robots melt instead of taking brute.
/datum/species/proc/spec_death(gibbed, mob/living/carbon/human/H)
if(H)
+1
View File
@@ -395,6 +395,7 @@
..()
update_pull_movespeed()
update_pull_hud_icon()
SEND_SIGNAL(src, COMSIG_LIVING_STOPPED_PULLING)
/mob/living/verb/stop_pulling1()
set name = "Stop Pulling"
@@ -9,6 +9,8 @@
resting = new_resting
if(!silent)
to_chat(src, "<span class='notice'>You are now [resting? "resting" : "getting up"].</span>")
if(resting == 1)
SEND_SIGNAL(src, COMSIG_LIVING_RESTING)
update_resting(updating)
/mob/living/proc/update_resting(update_mobility = TRUE)