diff --git a/code/__defines/footsteps.dm b/code/__defines/footsteps.dm index d467d8f99e6..c9ad6500b4c 100644 --- a/code/__defines/footsteps.dm +++ b/code/__defines/footsteps.dm @@ -28,7 +28,7 @@ #define FOOTSTEP_MOB_SHOE "footstep_shoe" #define FOOTSTEP_MOB_HUMAN "footstep_human" #define FOOTSTEP_MOB_SLIME "footstep_slime" -#define FOOTSTEP_MOB_SLITHER "foostep_slither" +#define FOOTSTEP_MOB_SLITHER "footstep_slither" #define FOOTSTEP_OBJ_MACHINE "footstep_machine" #define FOOTSTEP_OBJ_ROBOT "footstep_robot" diff --git a/code/__defines/traits/_traits.dm b/code/__defines/traits/_traits.dm index 3258db96f27..46fef90160a 100644 --- a/code/__defines/traits/_traits.dm +++ b/code/__defines/traits/_traits.dm @@ -5,59 +5,118 @@ #define ADD_TRAIT(target, trait, source) \ do { \ var/list/_L; \ - if (!target.status_traits) { \ - target.status_traits = list(); \ - _L = target.status_traits; \ + if (!target._status_traits) { \ + target._status_traits = list(); \ + _L = target._status_traits; \ _L[trait] = list(source); \ + SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \ } else { \ - _L = target.status_traits; \ + _L = target._status_traits; \ if (_L[trait]) { \ _L[trait] |= list(source); \ } else { \ _L[trait] = list(source); \ + SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \ } \ } \ } while (0) #define REMOVE_TRAIT(target, trait, sources) \ do { \ - var/list/_L = target.status_traits; \ + var/list/_L = target._status_traits; \ var/list/_S; \ if (sources && !islist(sources)) { \ _S = list(sources); \ } else { \ _S = sources\ }; \ - if (_L && _L[trait]) { \ + if (_L?[trait]) { \ for (var/_T in _L[trait]) { \ if ((!_S && (_T != ROUNDSTART_TRAIT)) || (_T in _S)) { \ _L[trait] -= _T \ } \ };\ if (!length(_L[trait])) { \ - _L -= trait \ + _L -= trait; \ + SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \ }; \ if (!length(_L)) { \ - target.status_traits = null \ + target._status_traits = null \ + }; \ + } \ + } while (0) +#define REMOVE_TRAIT_NOT_FROM(target, trait, sources) \ + do { \ + var/list/_traits_list = target._status_traits; \ + var/list/_sources_list; \ + if (sources && !islist(sources)) { \ + _sources_list = list(sources); \ + } else { \ + _sources_list = sources\ + }; \ + if (_traits_list?[trait]) { \ + for (var/_trait_source in _traits_list[trait]) { \ + if (!(_trait_source in _sources_list)) { \ + _traits_list[trait] -= _trait_source \ + } \ + };\ + if (!length(_traits_list[trait])) { \ + _traits_list -= trait; \ + SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \ + }; \ + if (!length(_traits_list)) { \ + target._status_traits = null \ }; \ } \ } while (0) #define REMOVE_TRAITS_NOT_IN(target, sources) \ do { \ - var/list/_L = target.status_traits; \ + var/list/_L = target._status_traits; \ var/list/_S = sources; \ if (_L) { \ for (var/_T in _L) { \ _L[_T] &= _S;\ if (!length(_L[_T])) { \ - _L -= _T } \ - };\ - if (!length(_L)) { \ - target.status_traits = null\ + _L -= _T; \ + SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \ + }; \ };\ + if (!length(_L)) { \ + target._status_traits = null\ + };\ }\ } while (0) -#define HAS_TRAIT(target, trait) (target.status_traits ? (target.status_traits[trait] ? TRUE : FALSE) : FALSE) -#define HAS_TRAIT_FROM(target, trait, source) (target.status_traits ? (target.status_traits[trait] ? (source in target.status_traits[trait]) : FALSE) : FALSE) -#define HAS_TRAIT_FROM_ONLY(target, trait, source) (HAS_TRAIT(target, trait) && (source in target.status_traits[trait]) && (length(target.status_traits[trait]) == 1)) -#define HAS_TRAIT_NOT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (length(target.status_traits[trait] - source) > 0)) +#define REMOVE_TRAITS_IN(target, sources) \ + do { \ + var/list/_L = target._status_traits; \ + var/list/_S = sources; \ + if (sources && !islist(sources)) { \ + _S = list(sources); \ + } else { \ + _S = sources\ + }; \ + if (_L) { \ + for (var/_T in _L) { \ + _L[_T] -= _S;\ + if (!length(_L[_T])) { \ + _L -= _T; \ + SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \ + }; \ + };\ + if (!length(_L)) { \ + target._status_traits = null\ + };\ + }\ + } while (0) + +#define HAS_TRAIT(target, trait) (target._status_traits?[trait] ? TRUE : FALSE) +#define HAS_TRAIT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait])) +#define HAS_TRAIT_FROM_ONLY(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]) && (length(target._status_traits[trait]) == 1)) +#define HAS_TRAIT_NOT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (length(target._status_traits[trait] - source) > 0)) +/// Returns a list of trait sources for this trait. Only useful for wacko cases and internal futzing +/// You should not be using this +#define GET_TRAIT_SOURCES(target, trait) (target._status_traits?[trait] || list()) +/// Returns the amount of sources for a trait. useful if you don't want to have a "thing counter" stuck around all the time +#define COUNT_TRAIT_SOURCES(target, trait) length(GET_TRAIT_SOURCES(target, trait)) +/// A simple helper for checking traits in a mob's mind +#define HAS_MIND_TRAIT(target, trait) (HAS_TRAIT(target, trait) || (target.mind ? HAS_TRAIT(target.mind, trait) : FALSE)) diff --git a/code/datums/elements/slosh.dm b/code/datums/elements/slosh.dm index 8e58536f025..0b72323c1a0 100644 --- a/code/datums/elements/slosh.dm +++ b/code/datums/elements/slosh.dm @@ -19,7 +19,6 @@ /datum/element/slosh/Detach(datum/source) UnregisterSignal(source, COMSIG_MOVABLE_MOVED) - step_count -= source return ..() /datum/element/slosh/proc/handle_sloshstep(mob/living/source) @@ -27,9 +26,9 @@ if(ishuman(source)) var/mob/living/carbon/human/source_human = source - if(source_human.m_intent == "walk" && step_count++ % 20 == 0) + if(source_human.m_intent == I_WALK && step_count++ % 20 == 0) return - if(source_human.m_intent == "run" && step_count++ % 2 != 0) + if(source_human.m_intent == I_RUN && step_count++ % 2 != 0) return choose_vorefootstep(source) if(issilicon(source)) @@ -59,11 +58,11 @@ step_count = 0 - if(!vore_footstep_volume || !vore_footstep_chance) - return + if(!vore_footstep_volume || !vore_footstep_chance) + return - if(prob(vore_footstep_chance)) - handle_vorefootstep(source) + if(prob(vore_footstep_chance)) + handle_vorefootstep(source) /datum/element/slosh/proc/handle_vorefootstep(mob/living/source) if(!CONFIG_GET(number/vorefootstep_volume) || !vore_footstep_volume) @@ -76,7 +75,7 @@ if(ishuman(source)) var/mob/living/carbon/human/human_source = source - if(!human_source.shoes || human_source.m_intent == "walk") + if(!human_source.shoes || human_source.m_intent == I_WALK) volume = CONFIG_GET(number/vorefootstep_volume) * (vore_footstep_volume/100) * 0.75 else if(human_source.shoes) var/obj/item/clothing/shoes/feet = human_source.shoes @@ -85,10 +84,10 @@ if(!human_source.has_organ(BP_L_FOOT) && !human_source.has_organ(BP_R_FOOT)) return - if(source.buckled || source.lying || source.throwing) + if(source.buckled || source.lying || source.throwing || source.is_incorporeal()) return - if(!has_gravity(source) && prob(75)) + if(!get_gravity(source) && prob(75)) return - playsound(source.loc, S, volume, FALSE, preference = /datum/client_preference/digestion_noises) + playsound(source.loc, S, volume, FALSE, preference = /datum/preference/toggle/digestion_noises) return diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index ebf0c54b15b..f9c0a4ba401 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -34,6 +34,7 @@ var/list/dangerous_objects // List of 'dangerous' objs that the turf holds that can cause something bad to happen when stepped on, used for AI mobs. var/tmp/changing_turf + var/blocks_nonghost_incorporeal = FALSE var/footstep var/barefootstep var/heavyfootstep diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index cb80e2af888..ed564bd2e53 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -37,7 +37,7 @@ init_id() init_subsystems() - AddElement(/datum/element/footstep, FOOTSTEP_MOB_SHOE, 0.75, -6) + AddElement(/datum/element/footstep, FOOTSTEP_MOB_SHOE, 1, -6) /mob/living/silicon/Destroy() silicon_mob_list -= src diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index b096d1b0620..41d51e77b59 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -205,7 +205,7 @@ if(CONFIG_GET(flag/allow_simple_mob_recolor)) add_verb(src, /mob/living/simple_mob/proc/ColorMate) - AddElement(/datum/element/footstep, FOOTSTEP_MOB_SHOE, 0.5, -6) // Need to go through all of the mobs to give them proper footsteps... + AddElement(/datum/element/footstep, FOOTSTEP_MOB_SHOE, 1, -6) // Need to go through all of the mobs to give them proper footsteps... return ..() diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index f2f3d285fd1..2992b3a8675 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -367,6 +367,8 @@ if(mob.check_holy(T)) to_chat(mob, span_warning("You cannot get past holy grounds while you are in this plane of existence!")) return + else if(!istype(mob, /mob/observer/dead) && T.blocks_nonghost_incorporeal) + return //RS Port #658 Start if(!holder) if(isliving(mob) && A.flag_check(AREA_BLOCK_PHASE_SHIFT)) diff --git a/code/modules/organs/subtypes/machine.dm b/code/modules/organs/subtypes/machine.dm index 2f133ff9a6d..689366a359f 100644 --- a/code/modules/organs/subtypes/machine.dm +++ b/code/modules/organs/subtypes/machine.dm @@ -47,9 +47,8 @@ return ..() /obj/item/organ/internal/mmi_holder/Initialize(mapload, var/internal, var/obj/item/mmi/installed) - ..(mapload, internal) - var/mob/living/carbon/human/dummy/mannequin/M = loc - if(istype(M)) + . = ..(mapload, internal) + if(!ishuman(loc) || istype(loc, /mob/living/carbon/human/dummy/mannequin)) return if(installed) stored_mmi = installed