From c882c098cc6b8d3e66a1c9205b9ea3cf6a2dd3e7 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 23 Oct 2019 19:24:34 +0200 Subject: [PATCH] Porting movespeed modification system updates. --- code/__DEFINES/combat.dm | 3 +- code/__DEFINES/components.dm | 3 +- code/__DEFINES/movespeed_modification.dm | 36 ++++++++++- code/__DEFINES/traits.dm | 2 - code/datums/components/mood.dm | 59 ++++--------------- code/game/atoms_movable.dm | 3 + code/game/objects/effects/mines.dm | 4 +- code/game/objects/items/tanks/jetpack.dm | 31 ++++++---- .../changeling/powers/strained_muscles.dm | 6 +- .../antagonists/revenant/revenant_blight.dm | 4 +- .../antagonists/slaughter/slaughter.dm | 13 +--- code/modules/mob/living/bloodcrawl.dm | 3 +- .../mob/living/carbon/human/physiology.dm | 2 - .../mob/living/carbon/human/species.dm | 43 +++----------- .../carbon/human/species_types/angel.dm | 6 +- .../simple_animal/hostile/giant_spider.dm | 15 +++-- .../mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/mob/living/ventcrawling.dm | 4 +- code/modules/mob/mob.dm | 4 ++ code/modules/mob/mob_movespeed.dm | 35 ++++++++--- .../chemistry/reagents/drink_reagents.dm | 4 +- .../chemistry/reagents/drug_reagents.dm | 4 +- .../chemistry/reagents/medicine_reagents.dm | 8 +-- .../chemistry/reagents/other_reagents.dm | 4 +- .../crossbreeding/_status_effects.dm | 25 +++----- code/modules/station_goals/dna_vault.dm | 2 +- code/modules/surgery/organs/augments_chest.dm | 9 ++- 27 files changed, 164 insertions(+), 170 deletions(-) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index e31d2a278e..3664da4a5d 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -104,8 +104,7 @@ #define SHOVE_KNOCKDOWN_HUMAN 30 #define SHOVE_KNOCKDOWN_TABLE 30 #define SHOVE_KNOCKDOWN_COLLATERAL 10 -//Shove slowdown -#define SHOVE_SLOWDOWN_ID "shove_slowdown" +//for the shove slowdown, see __DEFINES/movespeed_modification.dm #define SHOVE_SLOWDOWN_LENGTH 30 #define SHOVE_SLOWDOWN_STRENGTH 0.85 //multiplier //Shove disarming item list diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index c2482f6fbf..06eb2ff04f 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -231,8 +231,7 @@ //Mood #define COMSIG_ADD_MOOD_EVENT "add_mood" //Called when you send a mood event from anywhere in the code. #define COMSIG_CLEAR_MOOD_EVENT "clear_mood" //Called when you clear a mood event from anywhere in the code. -#define COMSIG_INCREASE_SANITY "decrease_sanity" //Called when you want to increase sanity from anywhere in the code. -#define COMSIG_DECREASE_SANITY "increase_sanity" //Same as above but to decrease sanity instead. +#define COMSIG_MODIFY_SANITY "modify_sanity" //Called when you want to increase or decrease sanity from anywhere in the code. //NTnet #define COMSIG_COMPONENT_NTNET_RECEIVE "ntnet_receive" //called on an object by its NTNET connection component on receive. (sending_id(number), sending_netname(text), data(datum/netdata)) diff --git a/code/__DEFINES/movespeed_modification.dm b/code/__DEFINES/movespeed_modification.dm index 12a3c331ec..50e1a10fa1 100644 --- a/code/__DEFINES/movespeed_modification.dm +++ b/code/__DEFINES/movespeed_modification.dm @@ -1,12 +1,19 @@ #define MOVESPEED_DATA_INDEX_PRIORITY 1 #define MOVESPEED_DATA_INDEX_FLAGS 2 #define MOVESPEED_DATA_INDEX_MULTIPLICATIVE_SLOWDOWN 3 +#define MOVESPEED_DATA_INDEX_MOVETYPE 4 +#define MOVESPEED_DATA_INDEX_BL_MOVETYPE 5 +#define MOVESPEED_DATA_INDEX_CONFLICT 6 -#define MOVESPEED_DATA_INDEX_MAX 3 +#define MOVESPEED_DATA_INDEX_MAX 6 //flags #define IGNORE_NOSLOW (1 << 0) +//conflict types + +#define MOVE_CONFLICT_JETPACK "JETPACK" + //ids #define MOVESPEED_ID_MOB_WALK_RUN_CONFIG_SPEED "MOB_WALK_RUN" @@ -16,15 +23,29 @@ #define MOVESPEED_ID_SLIME_HEALTHMOD "SLIME_HEALTH_MODIFIER" #define MOVESPEED_ID_SLIME_TEMPMOD "SLIME_TEMPERATURE_MODIFIER" +#define MOVESPEED_ID_SLIME_STATUS "SLIME_STATUS" + +#define MOVESPEED_ID_TARANTULA_WEB "TARANTULA_WEB" + #define MOVESPEED_ID_LIVING_TURF_SPEEDMOD "LIVING_TURF_SPEEDMOD" #define MOVESPEED_ID_CARBON_SOFTCRIT "CARBON_SOFTCRIT" #define MOVESPEED_ID_CARBON_OLDSPEED "CARBON_DEPRECATED_SPEED" +#define MOVESPEED_ID_DNA_VAULT "DNA_VAULT" + +#define MOVESPEED_ID_YELLOW_ORB "YELLOW_ORB" + +#define MOVESPEED_ID_TARFOOT "TARFOOT" + +#define MOVESPEED_ID_SEPIA "SEPIA" + #define MOVESPEED_ID_MONKEY_REAGENT_SPEEDMOD "MONKEY_REAGENT_SPEEDMOD" #define MOVESPEED_ID_MONKEY_TEMPERATURE_SPEEDMOD "MONKEY_TEMPERATURE_SPEEDMOD" #define MOVESPEED_ID_MONKEY_HEALTH_SPEEDMOD "MONKEY_HEALTH_SPEEDMOD" +#define MOVESPEED_ID_CHANGELING_MUSCLES "CHANGELING_MUSCLES" + #define MOVESPEED_ID_SIMPLEMOB_VARSPEED "SIMPLEMOB_VARSPEED_MODIFIER" #define MOVESPEED_ID_ADMIN_VAREDIT "ADMIN_VAREDIT_MODIFIER" @@ -32,7 +53,18 @@ #define MOVESPEED_ID_SANITY "MOOD_SANITY" +#define MOVESPEED_ID_SPECIES "SPECIES_SPEED_MOD" + #define MOVESPEED_ID_PRONE_DRAGGING "PRONE_DRAG" #define MOVESPEED_ID_HUMAN_CARRYING "HUMAN_CARRY" -#define MOVESPEED_ID_TASED_STATUS "TASED" \ No newline at end of file +#define MOVESPEED_ID_TASED_STATUS "TASED" + +#define MOVESPEED_ID_SLAUGHTER "SLAUGHTER" + +#define MOVESPEED_ID_CYBER_THRUSTER "CYBER_IMPLANT_THRUSTER" +#define MOVESPEED_ID_JETPACK "JETPACK" + +#define MOVESPEED_ID_SHOVE "SHOVE" + +#define MOVESPEED_ID_MKULTRA "MKULTRA" \ No newline at end of file diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index e22dcfbbe0..ef8adfcaf2 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -70,8 +70,6 @@ #define TRAIT_MONKEYLIKE "monkeylike" //sets IsAdvancedToolUser to FALSE #define TRAIT_PACIFISM "pacifism" #define TRAIT_IGNORESLOWDOWN "ignoreslow" -#define TRAIT_GOTTAGOFAST "fast" -#define TRAIT_GOTTAGOREALLYFAST "2fast" #define TRAIT_DEATHCOMA "deathcoma" //Causes death-like unconsciousness #define TRAIT_FAKEDEATH "fakedeath" //Makes the owner appear as dead to most forms of medical examination #define TRAIT_DISFIGURED "disfigured" diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index eb381af577..2b7c540058 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -10,7 +10,6 @@ var/mood_modifier = 1 //Modifier to allow certain mobs to be less affected by moodlets var/datum/mood_event/list/mood_events = list() var/insanity_effect = 0 //is the owner being punished for low mood? If so, how much? - var/holdmyinsanityeffect = 0 //before we edit our sanity lets take a look var/obj/screen/mood/screen_obj /datum/component/mood/Initialize() @@ -21,8 +20,7 @@ RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, .proc/add_event) RegisterSignal(parent, COMSIG_CLEAR_MOOD_EVENT, .proc/clear_event) - RegisterSignal(parent, COMSIG_INCREASE_SANITY, .proc/IncreaseSanity) - RegisterSignal(parent, COMSIG_DECREASE_SANITY, .proc/DecreaseSanity) + RegisterSignal(parent, COMSIG_MODIFY_SANITY, .proc/modify_sanity) RegisterSignal(parent, COMSIG_MOB_HUD_CREATED, .proc/modify_hud) var/mob/living/owner = parent @@ -131,29 +129,23 @@ switch(mood_level) if(1) - DecreaseSanity(src, 0.2) + setSanity(sanity-0.2) if(2) - DecreaseSanity(src, 0.125, SANITY_CRAZY) + setSanity(sanity-0.125, minimum=SANITY_CRAZY) if(3) - DecreaseSanity(src, 0.075, SANITY_UNSTABLE) + setSanity(sanity-0.075, minimum=SANITY_UNSTABLE) if(4) - DecreaseSanity(src, 0.025, SANITY_DISTURBED) + setSanity(sanity-0.025, minimum=SANITY_DISTURBED) if(5) - IncreaseSanity(src, 0.1) + setSanity(sanity+0.1) if(6) - IncreaseSanity(src, 0.15) + setSanity(sanity+0.15) if(7) - IncreaseSanity(src, 0.20) + setSanity(sanity+0.20) if(8) - IncreaseSanity(src, 0.25, SANITY_GREAT) + setSanity(sanity+0.25, maximum=SANITY_GREAT) if(9) - IncreaseSanity(src, 0.4, SANITY_GREAT) - - if(insanity_effect != holdmyinsanityeffect) - if(insanity_effect > holdmyinsanityeffect) - owner.crit_threshold += (insanity_effect - holdmyinsanityeffect) - else - owner.crit_threshold -= (holdmyinsanityeffect - insanity_effect) + setSanity(sanity+0.4, maximum=SANITY_GREAT) if(HAS_TRAIT(owner, TRAIT_DEPRESSION)) if(prob(0.05)) @@ -164,8 +156,6 @@ add_event(null, "jolly", /datum/mood_event/jolly) clear_event(null, "depression") - holdmyinsanityeffect = insanity_effect - HandleNutrition(owner) /datum/component/mood/proc/setSanity(amount, minimum=SANITY_INSANE, maximum=SANITY_NEUTRAL)//I'm sure bunging this in here will have no negative repercussions. @@ -187,7 +177,7 @@ sanity = amount switch(sanity) - if(SANITY_INSANE to SANITY_CRAZY) + if(-INFINITY to SANITY_CRAZY) setInsanityEffect(MAJOR_INSANITY_PEN) master.add_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE, 100, override=TRUE, multiplicative_slowdown=1.5) //Did we change something ? movetypes is runtiming, movetypes=(~FLYING)) sanity_level = 6 @@ -220,31 +210,8 @@ master.crit_threshold = (master.crit_threshold - insanity_effect) + newval insanity_effect = newval -/datum/component/mood/proc/DecreaseSanity(datum/source, amount, minimum = SANITY_INSANE) - if(sanity < minimum) //This might make KevinZ stop fucking pinging me. - IncreaseSanity(src, 0.5) - else - sanity = max(minimum, sanity - amount) - if(sanity < SANITY_UNSTABLE) - if(sanity < SANITY_CRAZY) - insanity_effect = (MAJOR_INSANITY_PEN) - else - insanity_effect = (MINOR_INSANITY_PEN) - -/datum/component/mood/proc/IncreaseSanity(datum/source, amount, maximum = SANITY_NEUTRAL) - // Disturbed stops you from getting any more sane - I'm just gonna bung this in here - var/mob/living/owner = parent - if(HAS_TRAIT(owner, TRAIT_UNSTABLE)) - return - if(sanity > maximum) - DecreaseSanity(src, 0.5) //Removes some sanity to go back to our current limit. - else - sanity = min(maximum, sanity + amount) - if(sanity > SANITY_CRAZY) - if(sanity > SANITY_UNSTABLE) - insanity_effect = 0 - else - insanity_effect = MINOR_INSANITY_PEN +/datum/component/mood/proc/modify_sanity(datum/source, amount, minimum = -INFINITY, maximum = INFINITY) + setSanity(sanity + amount, minimum, maximum) /datum/component/mood/proc/add_event(datum/source, category, type, param) //Category will override any events in the same category, should be unique unless the event is based on the same thing like hunger. var/datum/mood_event/the_event diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 83762240bc..146a1cc140 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -422,6 +422,9 @@ var/atom/movable/AM = item AM.onTransitZ(old_z,new_z) +/atom/movable/proc/setMovetype(newval) + movement_type = newval + //Called whenever an object moves and by mobs when they attempt to move themselves through space //And when an object or action applies a force on src, see newtonian_move() below //Return 0 to have src start/keep drifting in a no-grav area and 1 to stop/not start drifting diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index 32d91ee76a..08f698e018 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -170,7 +170,7 @@ if(!victim.client || !istype(victim)) return to_chat(victim, "You feel fast!") - ADD_TRAIT(victim, TRAIT_GOTTAGOREALLYFAST, "yellow_orb") + victim.add_movespeed_modifier(MOVESPEED_ID_YELLOW_ORB, update=TRUE, priority=100, multiplicative_slowdown=-2, blacklisted_movetypes=(FLYING|FLOATING)) sleep(duration) - REMOVE_TRAIT(victim, TRAIT_GOTTAGOREALLYFAST, "yellow_orb") + victim.remove_movespeed_modifier(MOVESPEED_ID_YELLOW_ORB) to_chat(victim, "You slow down.") diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm index b672eb01ca..d0151fad66 100644 --- a/code/game/objects/items/tanks/jetpack.dm +++ b/code/game/objects/items/tanks/jetpack.dm @@ -37,25 +37,33 @@ return if(!on) - turn_on() + turn_on(user) to_chat(user, "You turn the jetpack on.") else - turn_off() + turn_off(user) to_chat(user, "You turn the jetpack off.") for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() -/obj/item/tank/jetpack/proc/turn_on() +/obj/item/tank/jetpack/proc/turn_on(mob/user) on = TRUE icon_state = "[initial(icon_state)]-on" ion_trail.start() + RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/move_react) + if(full_speed) + user.add_movespeed_modifier(MOVESPEED_ID_JETPACK, priority=100, multiplicative_slowdown=-2, movetypes=FLOATING, conflict=MOVE_CONFLICT_JETPACK) -/obj/item/tank/jetpack/proc/turn_off() +/obj/item/tank/jetpack/proc/turn_off(mob/user) on = FALSE stabilizers = FALSE icon_state = initial(icon_state) ion_trail.stop() + UnregisterSignal(user, COMSIG_MOVABLE_MOVED) + user.remove_movespeed_modifier(MOVESPEED_ID_JETPACK) + +/obj/item/tank/jetpack/proc/move_react(mob/user) + allow_thrust(0.01, user) /obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user) if(!on) @@ -178,6 +186,7 @@ full_speed = FALSE var/datum/gas_mixture/temp_air_contents var/obj/item/tank/internals/tank = null + var/mob/living/carbon/human/cur_user /obj/item/tank/jetpack/suit/New() ..() @@ -198,28 +207,30 @@ return ..() -/obj/item/tank/jetpack/suit/turn_on() - if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc)) +/obj/item/tank/jetpack/suit/turn_on(mob/user) + if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc) || loc.loc != user) return - var/mob/living/carbon/human/H = loc.loc + var/mob/living/carbon/human/H = user tank = H.s_store air_contents = tank.air_contents START_PROCESSING(SSobj, src) + cur_user = user ..() -/obj/item/tank/jetpack/suit/turn_off() +/obj/item/tank/jetpack/suit/turn_off(mob/user) tank = null air_contents = temp_air_contents STOP_PROCESSING(SSobj, src) + cur_user = null ..() /obj/item/tank/jetpack/suit/process() if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc)) - turn_off() + turn_off(cur_user) return var/mob/living/carbon/human/H = loc.loc if(!tank || tank != H.s_store) - turn_off() + turn_off(cur_user) return ..() diff --git a/code/modules/antagonists/changeling/powers/strained_muscles.dm b/code/modules/antagonists/changeling/powers/strained_muscles.dm index 081b1181dc..1f25e06324 100644 --- a/code/modules/antagonists/changeling/powers/strained_muscles.dm +++ b/code/modules/antagonists/changeling/powers/strained_muscles.dm @@ -21,7 +21,7 @@ to_chat(user, "Our muscles tense and strengthen.") changeling.chem_recharge_slowdown += 0.5 else - REMOVE_TRAIT(user, TRAIT_GOTTAGOFAST, "changeling_muscles") + user.remove_movespeed_modifier(MOVESPEED_ID_CHANGELING_MUSCLES) to_chat(user, "Our muscles relax.") changeling.chem_recharge_slowdown -= 0.5 if(stacks >= 20) @@ -36,12 +36,12 @@ /obj/effect/proc_holder/changeling/strained_muscles/proc/muscle_loop(mob/living/carbon/user) var/datum/antagonist/changeling/changeling = user.mind.has_antag_datum(/datum/antagonist/changeling) while(active) - ADD_TRAIT(user, TRAIT_GOTTAGOFAST, "changeling_muscles") + user.add_movespeed_modifier(MOVESPEED_ID_CHANGELING_MUSCLES, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) if(user.stat != CONSCIOUS || user.staminaloss >= 90) active = !active to_chat(user, "Our muscles relax without the energy to strengthen them.") user.Knockdown(40) - REMOVE_TRAIT(user, TRAIT_GOTTAGOFAST, "changeling_muscles") + user.remove_movespeed_modifier(MOVESPEED_ID_CHANGELING_MUSCLES) changeling.chem_recharge_slowdown -= 0.5 break diff --git a/code/modules/antagonists/revenant/revenant_blight.dm b/code/modules/antagonists/revenant/revenant_blight.dm index 89d8de283a..dee4557043 100644 --- a/code/modules/antagonists/revenant/revenant_blight.dm +++ b/code/modules/antagonists/revenant/revenant_blight.dm @@ -45,11 +45,11 @@ if(3) if(!depression) depression = SEND_SIGNAL(affected_mob, COMSIG_ADD_MOOD_EVENT, "rev_blight", /datum/mood_event/revenant_blight) - SEND_SIGNAL(affected_mob, COMSIG_DECREASE_SANITY, 0.12, SANITY_CRAZY) + SEND_SIGNAL(affected_mob, COMSIG_MODIFY_SANITY, -0.12, SANITY_CRAZY) if(prob(10)) affected_mob.emote(pick("pale","shiver")) if(4) - SEND_SIGNAL(affected_mob, COMSIG_DECREASE_SANITY, 0.18, SANITY_CRAZY) + SEND_SIGNAL(affected_mob, COMSIG_MODIFY_SANITY, -0.18, SANITY_CRAZY) if(prob(15)) affected_mob.emote(pick("pale","shiver","cries")) if(5) diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index 03a176b054..f45555a6ee 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -34,7 +34,6 @@ melee_damage_upper = 30 see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - var/boost = 0 bloodcrawl = BLOODCRAWL_EAT var/playstyle_string = "You are a slaughter demon, a terrible creature from another realm. You have a single desire: To kill. \ You may use the \"Blood Crawl\" ability near blood pools to travel through them, appearing and disappearing from the station at will. \ @@ -54,24 +53,18 @@ if(istype(loc, /obj/effect/dummy/phased_mob/slaughter)) bloodspell.phased = TRUE -/mob/living/simple_animal/slaughter/Life() - ..() - if(boost[target.name]'s grip on \the [target_held_item] loosens!", "Your grip on \the [target_held_item] loosens!", null, COMBAT_MESSAGE_RANGE) diff --git a/code/modules/mob/living/carbon/human/species_types/angel.dm b/code/modules/mob/living/carbon/human/species_types/angel.dm index c1c848106c..7669a8c740 100644 --- a/code/modules/mob/living/carbon/human/species_types/angel.dm +++ b/code/modules/mob/living/carbon/human/species_types/angel.dm @@ -29,7 +29,7 @@ if(fly) fly.Remove(H) if(H.movement_type & FLYING) - H.movement_type &= ~FLYING + H.setMovetype(H.movement_type & ~FLYING) ToggleFlight(H,0) if(H.dna && H.dna.species && (H.dna.features["wings"] == "Angel")) if("wings" in H.dna.species.mutant_bodyparts) @@ -132,14 +132,14 @@ if(flight && CanFly(H)) stunmod = 2 speedmod = -0.35 - H.movement_type |= FLYING + H.setMovetype(H.movement_type | FLYING) override_float = TRUE H.pass_flags |= PASSTABLE H.OpenWings() else stunmod = 1 speedmod = 0 - H.movement_type &= ~FLYING + H.setMovetype(H.movement_type & ~FLYING) override_float = FALSE H.pass_flags &= ~PASSTABLE H.CloseWings() \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index f5b1706f87..2f39ae13a1 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -175,14 +175,17 @@ status_flags = NONE mob_size = MOB_SIZE_LARGE gold_core_spawnable = NO_SPAWN + var/slowed_by_webs = FALSE -/mob/living/simple_animal/hostile/poison/giant_spider/tarantula/movement_delay() - var/turf/T = get_turf(src) - if(locate(/obj/structure/spider/stickyweb) in T) - speed = 2 - else - speed = 7 +/mob/living/simple_animal/hostile/poison/giant_spider/tarantula/Moved(atom/oldloc, dir) . = ..() + if(slowed_by_webs) + if(!(locate(/obj/structure/spider/stickyweb) in loc)) + remove_movespeed_modifier(MOVESPEED_ID_TARANTULA_WEB) + slowed_by_webs = FALSE + else if(locate(/obj/structure/spider/stickyweb) in loc) + add_movespeed_modifier(MOVESPEED_ID_TARANTULA_WEB, priority=100, multiplicative_slowdown=3) + slowed_by_webs = TRUE //midwives are the queen of the spiders, can send messages to all them and web faster. That rare round where you get a queen spider and turn your 'for honor' players into 'r6siege' players will be a fun one. /mob/living/simple_animal/hostile/poison/giant_spider/nurse/midwife diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 1f81899d8a..c017543445 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -363,7 +363,7 @@ density = initial(density) lying = 0 . = 1 - movement_type = initial(movement_type) + setMovetype(initial(movement_type)) /mob/living/simple_animal/proc/make_babies() // <3 <3 <3 if(gender != FEMALE || stat || next_scan_time > world.time || !childtype || !animal_species || !SSticker.IsRoundInProgress()) diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 930656228d..cacd1c7c56 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -100,7 +100,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( A.pipe_vision_img.plane = ABOVE_HUD_PLANE client.images += A.pipe_vision_img pipes_shown += A.pipe_vision_img - movement_type |= VENTCRAWLING + setMovetype(movement_type | VENTCRAWLING) /mob/living/proc/remove_ventcrawl() @@ -108,7 +108,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( for(var/image/current_image in pipes_shown) client.images -= current_image pipes_shown.len = 0 - movement_type &= ~VENTCRAWLING + setMovetype(movement_type & ~VENTCRAWLING) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 5a7c6e21ab..f02a5abf36 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -959,3 +959,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) var/datum/language_holder/H = get_language_holder() H.open_language_menu(usr) + +/mob/setMovetype(newval) + . = ..() + update_movespeed(FALSE) \ No newline at end of file diff --git a/code/modules/mob/mob_movespeed.dm b/code/modules/mob/mob_movespeed.dm index 5114972493..9b24f72c80 100644 --- a/code/modules/mob/mob_movespeed.dm +++ b/code/modules/mob/mob_movespeed.dm @@ -1,23 +1,29 @@ /*Current movespeed modification list format: list(id = list( priority, + flags, legacy slowdown/speedup amount, + movetype_flags, + blacklisted_movetypes, + conflict )) */ //ANY ADD/REMOVE DONE IN UPDATE_MOVESPEED MUST HAVE THE UPDATE ARGUMENT SET AS FALSE! -/mob/proc/add_movespeed_modifier(id, update = TRUE, priority = 0, flags = NONE, override = FALSE, multiplicative_slowdown = 0) - var/list/temp = list(priority, flags, multiplicative_slowdown) //build the modification list +/mob/proc/add_movespeed_modifier(id, update=TRUE, priority=0, flags=NONE, override=FALSE, multiplicative_slowdown=0, movetypes=ALL, blacklisted_movetypes=NONE, conflict=FALSE) + var/list/temp = list(priority, flags, multiplicative_slowdown, movetypes, blacklisted_movetypes, conflict) //build the modification list + var/resort = TRUE if(LAZYACCESS(movespeed_modification, id)) - if(movespeed_modifier_identical_check(movespeed_modification[id], temp)) + var/list/existing_data = movespeed_modification[id] + if(movespeed_modifier_identical_check(existing_data, temp)) return FALSE if(!override) return FALSE - else - remove_movespeed_modifier(id, update) - LAZYSET(movespeed_modification, id, list(priority, flags, multiplicative_slowdown)) + if(priority == existing_data[MOVESPEED_DATA_INDEX_PRIORITY]) + resort = FALSE // We don't need to re-sort if we're replacing something already there and it's the same priority + LAZYSET(movespeed_modification, id, temp) if(update) - update_movespeed(TRUE) + update_movespeed(resort) return TRUE /mob/proc/remove_movespeed_modifier(id, update = TRUE) @@ -55,9 +61,22 @@ if(resort) sort_movespeed_modlist() . = 0 + var/list/conflict_tracker = list() for(var/id in get_movespeed_modifiers()) var/list/data = movespeed_modification[id] - . += data[MOVESPEED_DATA_INDEX_MULTIPLICATIVE_SLOWDOWN] + if(!(data[MOVESPEED_DATA_INDEX_MOVETYPE] & movement_type)) // We don't affect any of these move types, skip + continue + if(data[MOVESPEED_DATA_INDEX_BL_MOVETYPE] & movement_type) // There's a movetype here that disables this modifier, skip + var/conflict = data[MOVESPEED_DATA_INDEX_CONFLICT] + var/amt = data[MOVESPEED_DATA_INDEX_MULTIPLICATIVE_SLOWDOWN] + if(conflict) + // Conflicting modifiers prioritize the larger slowdown or the larger speedup + // We purposefuly don't handle mixing speedups and slowdowns on the same id + if(abs(conflict_tracker[conflict]) < abs(amt)) + conflict_tracker[conflict] = amt + else + continue + . += amt cached_multiplicative_slowdown = . /mob/proc/get_movespeed_modifiers() diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index dd51ce2bc7..1afbed3533 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -407,10 +407,10 @@ /datum/reagent/consumable/nuka_cola/on_mob_metabolize(mob/living/L) ..() - ADD_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.add_movespeed_modifier(id, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) /datum/reagent/consumable/nuka_cola/on_mob_end_metabolize(mob/living/L) - REMOVE_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.remove_movespeed_modifier(id) ..() /datum/reagent/consumable/nuka_cola/on_mob_life(mob/living/carbon/M) diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index f3df72cd4d..10d0405950 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -469,7 +469,7 @@ /datum/reagent/drug/skooma/on_mob_metabolize(mob/living/L) . = ..() - ADD_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.add_movespeed_modifier(id, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) L.next_move_modifier *= 2 if(ishuman(L)) var/mob/living/carbon/human/H = L @@ -480,7 +480,7 @@ /datum/reagent/drug/skooma/on_mob_end_metabolize(mob/living/L) . = ..() - REMOVE_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.remove_movespeed_modifier(id) L.next_move_modifier *= 0.5 if(ishuman(L)) var/mob/living/carbon/human/H = L diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 775308589f..4bdb22e227 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -984,10 +984,10 @@ datum/reagent/medicine/styptic_powder/overdose_start(mob/living/M) /datum/reagent/medicine/stimulants/on_mob_metabolize(mob/living/L) ..() - ADD_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.add_movespeed_modifier(id, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) /datum/reagent/medicine/stimulants/on_mob_end_metabolize(mob/living/L) - REMOVE_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.remove_movespeed_modifier(id) ..() /datum/reagent/medicine/stimulants/on_mob_life(mob/living/carbon/M) @@ -1308,10 +1308,10 @@ datum/reagent/medicine/styptic_powder/overdose_start(mob/living/M) /datum/reagent/medicine/changelinghaste/on_mob_metabolize(mob/living/L) ..() - ADD_TRAIT(L, TRAIT_GOTTAGOREALLYFAST, id) + L.add_movespeed_modifier(id, update=TRUE, priority=100, multiplicative_slowdown=-2, blacklisted_movetypes=(FLYING|FLOATING)) /datum/reagent/medicine/changelinghaste/on_mob_end_metabolize(mob/living/L) - REMOVE_TRAIT(L, TRAIT_GOTTAGOREALLYFAST, id) + L.remove_movespeed_modifier(id) ..() /datum/reagent/medicine/changelinghaste/on_mob_life(mob/living/carbon/M) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 95b4a33c0d..40a518fd6c 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -1353,10 +1353,10 @@ /datum/reagent/nitryl/on_mob_metabolize(mob/living/L) ..() - ADD_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.add_movespeed_modifier(id, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) /datum/reagent/nitryl/on_mob_end_metabolize(mob/living/L) - REMOVE_TRAIT(L, TRAIT_GOTTAGOFAST, id) + L.remove_movespeed_modifier(id) ..() /////////////////////////Coloured Crayon Powder//////////////////////////// diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index b9e7122d07..126603ce2a 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -375,15 +375,11 @@ datum/status_effect/rebreathing/tick() duration = 30 /datum/status_effect/tarfoot/on_apply() - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.physiology.speed_mod += 0.5 + owner.add_movespeed_modifier(MOVESPEED_ID_TARFOOT, update=TRUE, priority=100, multiplicative_slowdown=0.5, blacklisted_movetypes=(FLYING|FLOATING)) return ..() /datum/status_effect/tarfoot/on_remove() - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.physiology.speed_mod -= 0.5 + owner.remove_movespeed_modifier(MOVESPEED_ID_TARFOOT) /datum/status_effect/spookcookie id = "spookcookie" @@ -695,20 +691,15 @@ datum/status_effect/stabilized/blue/on_remove() /datum/status_effect/stabilized/sepia/tick() if(prob(50) && mod > -1) mod-- - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.physiology.speed_mod-- + owner.add_movespeed_modifier(MOVESPEED_ID_SEPIA, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) else if(mod < 1) mod++ - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.physiology.speed_mod++ + // yeah a value of 0 does nothing but replacing the trait in place is cheaper than removing and adding repeatedly + owner.add_movespeed_modifier(MOVESPEED_ID_SEPIA, update=TRUE, priority=100, multiplicative_slowdown=0, blacklisted_movetypes=(FLYING|FLOATING)) return ..() /datum/status_effect/stabilized/sepia/on_remove() - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.physiology.speed_mod += -mod //Reset the changes. + owner.remove_movespeed_modifier(MOVESPEED_ID_SEPIA). /datum/status_effect/stabilized/cerulean id = "stabilizedcerulean" @@ -916,7 +907,7 @@ datum/status_effect/stabilized/blue/on_remove() colour = "light pink" /datum/status_effect/stabilized/lightpink/on_apply() - ADD_TRAIT(owner, TRAIT_GOTTAGOFAST,"slimestatus") + owner.add_movespeed_modifier(MOVESPEED_ID_SLIME_STATUS, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) return ..() /datum/status_effect/stabilized/lightpink/tick() @@ -927,7 +918,7 @@ datum/status_effect/stabilized/blue/on_remove() return ..() /datum/status_effect/stabilized/lightpink/on_remove() - REMOVE_TRAIT(owner, TRAIT_GOTTAGOFAST,"slimestatus") + owner.remove_movespeed_modifier(MOVESPEED_ID_SLIME_STATUS) /datum/status_effect/stabilized/adamantine id = "stabilizedadamantine" diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index 3073a6fcc3..2aae17b0f3 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -276,7 +276,7 @@ ADD_TRAIT(H, TRAIT_PIERCEIMMUNE, "dna_vault") if(VAULT_SPEED) to_chat(H, "Your legs feel faster.") - ADD_TRAIT(H, TRAIT_GOTTAGOFAST, "dna_vault") + H.add_movespeed_modifier(MOVESPEED_ID_DNA_VAULT, update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING)) if(VAULT_QUICK) to_chat(H, "Your arms move as fast as lightning.") H.next_move_modifier = 0.5 diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 7156b8180b..8af52abc47 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -129,7 +129,7 @@ var/datum/effect_system/trail_follow/ion/ion_trail /obj/item/organ/cyberimp/chest/thrusters/Insert(mob/living/carbon/M, special = 0) - ..() + . = ..() if(!ion_trail) ion_trail = new ion_trail.set_up(M) @@ -151,10 +151,14 @@ on = TRUE if(allow_thrust(0.01)) ion_trail.start() + RegisterSignal(owner, COMSIG_MOVABLE_MOVED, .proc/move_react) + owner.add_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER, priority=100, multiplicative_slowdown=-2, movetypes=FLOATING, conflict=MOVE_CONFLICT_JETPACK) if(!silent) to_chat(owner, "You turn your thrusters set on.") else ion_trail.stop() + UnregisterSignal(owner, COMSIG_MOVABLE_MOVED) + owner.remove_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER) if(!silent) to_chat(owner, "You turn your thrusters set off.") on = FALSE @@ -169,6 +173,9 @@ var/datum/action/A = X A.UpdateButtonIcon() +/obj/item/organ/cyberimp/chest/thrusters/proc/move_react() + allow_thrust(0.01) + /obj/item/organ/cyberimp/chest/thrusters/proc/allow_thrust(num) if(!on || !owner) return 0