This commit is contained in:
kevinz000
2020-02-05 00:22:12 -07:00
parent 72ddaa2ded
commit 40ab6bdd41
6 changed files with 44 additions and 45 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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("<span class='boldwarning'>[user] starts to drain [src]!</span>")
draining = TRUE
if(do_after(user, 50, target = src))
reagents.remove_all(INFINITY)
visible_message("<span class='boldnotice'>[user] drains [src].</span>")
say("Reagents cleared.")
update_color()
if(!isliving(user) || !user.Adjacent(src) || !user.CanReach(src) || user.IsStun() || user.IsKnockdown() || user.incapacitated())
return FALSE
visible_message("<span class='boldwarning'>[user] starts to drain [src]!</span>")
draining = TRUE
if(!do_after(user, 50, target = src))
draining = FALSE
return TRUE
reagents.remove_all(INFINITY)
visible_message("<span class='boldnotice'>[user] drains [src].</span>")
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)

View File

@@ -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("<span class='danger'>[H] falls in and takes a drink!</span>",
"<span class='userdanger'>You fall in and swallow some water!</span>")
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("<span class='danger'>[H] falls in the drained pool!</span>",
"<span class='userdanger'>You fall in the drained pool!</span>")
@@ -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)

View File

@@ -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, "<span class='notice'>Someone else is already making a jump!</span>")
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)