diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 7e5d318214..faf71a45fb 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -331,10 +331,6 @@ /*******Element signals*******/ -// /datum/element/swimming -#define COMSIG_IS_SWIMMING "has_swimming_element" - #define IS_SWIMMING 1 - /*******Non-Signal Component Related Defines*******/ //Redirection component init flags diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index d707f7e58a..608144da26 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -135,7 +135,7 @@ #define TRAIT_NOMARROW "nomarrow" // You don't make blood, with chemicals or nanites. #define TRAIT_NOPULSE "nopulse" // Your heart doesn't beat. #define TRAIT_EXEMPT_HEALTH_EVENTS "exempt-health-events" - +#define TRAIT_SWIMMING "swimming" //only applied by /datum/element/swimming, for checking //non-mob traits #define TRAIT_PARALYSIS "paralysis" //Used for limb-based paralysis, where replacing the limb will fix it diff --git a/code/datums/elements/swimming.dm b/code/datums/elements/swimming.dm index 62a1f1840d..d16ef6625f 100644 --- a/code/datums/elements/swimming.dm +++ b/code/datums/elements/swimming.dm @@ -7,16 +7,13 @@ return if(!isliving(target)) return ELEMENT_INCOMPATIBLE - RegisterSignal(target, COMSIG_IS_SWIMMING, .proc/is_swimming) RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/check_valid) + ADD_TRAIT(target, TRAIT_SWIMMING, TRAIT_SWIMMING) //seriously there's only one way to get this /datum/element/swimming/Detach(datum/target) . = ..() - UnregisterSignal(target, COMSIG_IS_SWIMMING) UnregisterSignal(target, COMSIG_MOVABLE_MOVED) - -/datum/element/swimming/proc/is_swimming() - return IS_SWIMMING + REMOVE_TRAIT(target, TRAIT_SWIMMING, TRAIT_SWIMMING) /datum/element/swimming/proc/check_valid(datum/source) var/mob/living/L = source diff --git a/code/modules/pool/pool_controller.dm b/code/modules/pool/pool_controller.dm index 1167a0943b..9c6d976343 100644 --- a/code/modules/pool/pool_controller.dm +++ b/code/modules/pool/pool_controller.dm @@ -69,7 +69,7 @@ START_PROCESSING(SSfastprocess, src) create_reagents(1000) if(noreact_reagents) - reagents.reagents_holder_flags |= NO_REACTION + reagents.reagents_holder_flags |= NO_REACT wires = new /datum/wires/poolcontroller(src) scan_things() @@ -111,15 +111,19 @@ /obj/machinery/pool/controller/AltClick(mob/user) . = ..() - if(isliving(user) && user.Adjacent(src) && user.CanReach(src) && !user.IsStun() && !user.IsKnockdown() && !user.incapacitated()) - visible_message("[user] starts to drain [src]!") - draining = TRUE - if(do_after(user, 50, target = src)) - reagents.remove_all(INFINITY) - visible_message("[user] drains [src].") - say("Reagents cleared.") - update_color() + if(!isliving(user) || !user.Adjacent(src) || !user.CanReach(src) || user.IsStun() || user.IsKnockdown() || user.incapacitated()) + return FALSE + visible_message("[user] starts to drain [src]!") + draining = TRUE + if(!do_after(user, 50, target = src)) draining = FALSE + return TRUE + reagents.remove_all(INFINITY) + visible_message("[user] drains [src].") + say("Reagents cleared.") + update_color() + draining = FALSE + return TRUE /obj/machinery/pool/controller/attackby(obj/item/W, mob/user) if(shocked && !(stat & NOPOWER)) @@ -196,27 +200,29 @@ /obj/machinery/pool/controller/proc/process_reagents() if(last_reagent_process > world.time + reagent_tick_interval) return - if(length(reagents.reagent_list) > 0) - for(var/turf/open/pool/W in linked_turfs) - for(var/mob/living/carbon/human/swimee in W) - for(var/datum/reagent/R in reagents.reagent_list) - if(R.reagent_state == SOLID) - R.reagent_state = LIQUID - if(!swimee.reagents.has_reagent(POOL_NO_OVERDOSE_MEDICINE_MAX)) - swimee.reagents.add_reagent(R.type, 0.5) //osmosis - reagents.reaction(swimee, VAPOR, 0.03) //3 percent. Need to find a way to prevent this from stacking chems at some point like the above. - for(var/obj/objects in W) - if(W.reagents) - W.reagents.reaction(objects, VAPOR, 1) + if(!length(reagents.reagent_list)) + return + for(var/turf/open/pool/W in linked_turfs) + for(var/mob/living/carbon/human/swimee in W) + for(var/datum/reagent/R in reagents.reagent_list) + if(R.reagent_state == SOLID) + R.reagent_state = LIQUID + if(!swimee.reagents.has_reagent(POOL_NO_OVERDOSE_MEDICINE_MAX)) + swimee.reagents.add_reagent(R.type, 0.5) //osmosis + reagents.reaction(swimee, VAPOR, 0.03) //3 percent. Need to find a way to prevent this from stacking chems at some point like the above. + for(var/obj/objects in W) + if(W.reagents) + W.reagents.reaction(objects, VAPOR, 1) last_reagent_process = world.time /obj/machinery/pool/controller/process() updateUsrDialog() if(stat & (NOPOWER|BROKEN)) return - if (!drained) - process_pool() - process_reagents() + if(drained) + return + process_pool() + process_reagents() /obj/machinery/pool/controller/proc/process_pool() if(!drained) diff --git a/code/modules/pool/pool_main.dm b/code/modules/pool/pool_main.dm index b7406606c9..9f867df31e 100644 --- a/code/modules/pool/pool_main.dm +++ b/code/modules/pool/pool_main.dm @@ -50,7 +50,7 @@ // Mousedrop hook to normal turfs to get out of pools. /turf/open/MouseDrop_T(atom/from, mob/user) // I could make this /open/floor and not have the !istype but ehh - kev - if(isliving(from) && SEND_SIGNAL(from, COMSIG_IS_SWIMMING) && isliving(user) && ((user == from) || user.CanReach(from)) && !user.IsStun() && !user.IsKnockdown() && !user.incapacitated() && !istype(src, /turf/open/pool)) + if(isliving(from) && HAS_TRAIT(from, TRAIT_SWIMMING) && isliving(user) && ((user == from) || user.CanReach(from)) && !user.IsStun() && !user.IsKnockdown() && !user.incapacitated() && !istype(src, /turf/open/pool)) var/mob/living/L = from //The element only exists if you're on water and a living mob, so let's skip those checks. var/pre_msg @@ -81,7 +81,7 @@ return ..() //human weak, monkey (and anyone else) ook ook eek eek strong if(isliving(AM) && (locate(/obj/structure/pool/ladder) in src)) return ..() //climbing out - return istype(newloc, type) + return istype(newloc, /turf/open/pool) return ..() // Exited logic @@ -105,7 +105,7 @@ return ..() if(isliving(AM)) var/mob/living/victim = AM - if(!SEND_SIGNAL(victim, COMSIG_IS_SWIMMING)) //poor guy not swimming time to dunk them! + if(!HAS_TRAIT(victim, TRAIT_SWIMMING)) //poor guy not swimming time to dunk them! victim.AddElement(/datum/element/swimming) controller.mobs_in_pool += victim if(locate(/obj/structure/pool/ladder) in src) //safe climbing @@ -126,7 +126,7 @@ H.visible_message("[H] falls in and takes a drink!", "You fall in and swallow some water!") playsound(src, 'sound/effects/splash.ogg', 60, TRUE, 1) - else if(!istype(H.head, /obj/item/clothing/head/helmet)) + else if(!H.head || !(H.head.armor.getRating(melee) > 20)) if(prob(75)) H.visible_message("[H] falls in the drained pool!", "You fall in the drained pool!") @@ -155,7 +155,7 @@ if(!isliving(from)) return var/mob/living/victim = from - if(user.stat || user.lying || !Adjacent(user) || !from.Adjacent(user) || !iscarbon(user) || !victim.has_gravity(src) || SEND_SIGNAL(victim, COMSIG_IS_SWIMMING)) + if(user.stat || user.lying || !Adjacent(user) || !from.Adjacent(user) || !iscarbon(user) || !victim.has_gravity(src) || HAS_TRAIT(victim, TRAIT_SWIMMING)) return var/victimname = victim == user? "themselves" : "[victim]" var/starttext = victim == user? "[user] is descending into [src]." : "[user] is lowering [victim] into [src]." @@ -177,7 +177,7 @@ . = ..() if(.) return - if((user.loc != src) && !user.IsStun() && !user.IsKnockdown() && !user.incapacitated() && Adjacent(user) && SEND_SIGNAL(user, COMSIG_IS_SWIMMING) && filled && (next_splash < world.time)) + if((user.loc != src) && !user.IsStun() && !user.IsKnockdown() && !user.incapacitated() && Adjacent(user) && HAS_TRAIT(user, TRAIT_SWIMMING) && filled && (next_splash < world.time)) playsound(src, 'sound/effects/watersplash.ogg', 8, TRUE, 1) next_splash = world.time + 25 var/obj/effect/splash/S = new(src) diff --git a/code/modules/pool/pool_structures.dm b/code/modules/pool/pool_structures.dm index 40db1553a5..27f16d4008 100644 --- a/code/modules/pool/pool_structures.dm +++ b/code/modules/pool/pool_structures.dm @@ -15,8 +15,7 @@ . = ..() if(.) return - var/is_swimming = SEND_SIGNAL(user, COMSIG_IS_SWIMMING) - if(!is_swimming) + if(!HAS_TRAIT(user, TRAIT_SWIMMING)) if(user.CanReach(src)) user.AddElement(/datum/element/swimming) user.forceMove(get_step(src, dir)) @@ -44,7 +43,8 @@ if(jumping) for(var/mob/living/jumpee in loc) //hackzors. playsound(jumpee, 'sound/effects/splash.ogg', 60, TRUE, 1) - jumpee.AddElement(/datum/element/swimming) + if(!HAS_TRAIT(jumpee, TRAIT_SWIMMING)) + jumpee.AddElement(/datum/element/swimming) jumpee.Stun(2) /obj/structure/pool/Lboard/proc/reset_position(mob/user, initial_layer, initial_px, initial_py) @@ -59,7 +59,7 @@ to_chat(user, "Someone else is already making a jump!") return var/turf/T = get_turf(src) - if(SEND_SIGNAL(user, COMSIG_IS_SWIMMING)) + if(HAS_TRAIT(user, TRAIT_SWIMMING)) return else if(Adjacent(jumper)) @@ -73,7 +73,7 @@ jumper.layer = RIPPLE_LAYER jumper.pixel_x = 3 jumper.pixel_y = 7 - jumper.dir = 8 + jumper.dir = WEST sleep(1) jumper.forceMove(T) addtimer(CALLBACK(src, .proc/dive, jumper, original_layer, original_px, original_py), 10)