diff --git a/code/datums/components/turfslip.dm b/code/datums/components/turfslip.dm index fff67336c8..d1d6d71a33 100644 --- a/code/datums/components/turfslip.dm +++ b/code/datums/components/turfslip.dm @@ -1,12 +1,14 @@ /datum/component/turfslip var/mob/living/owner - var/slip_dist = TURFSLIP_WET + var/slipping_dir = null + var/slip_dist = 1 var/dirtslip = FALSE /datum/component/turfslip/Initialize() if (!isliving(parent)) return COMPONENT_INCOMPATIBLE owner = parent + slipping_dir = owner.dir RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(move_react)) /datum/component/turfslip/proc/start_slip(var/turf/simulated/start, var/is_dirt) @@ -23,18 +25,32 @@ else if(start.is_outdoors()) floor_type = "uneven" - // Proper sliding behavior - switch(start.wet) - if(TURFSLIP_LUBE) - floor_type = "slippery" - slip_dist = 99 //Skill issue. - slip_stun = 10 - dirtslip = FALSE - if(TURFSLIP_ICE) - floor_type = "icy" - slip_stun = 4 - slip_dist = rand(1,3) - dirtslip = FALSE + // Unlucky behavior + if(HAS_TRAIT(owner, TRAIT_UNLUCKY) && start.wet) + slip_dist = rand(5,9) // Random longer distances on slip + slip_stun = 10 + dirtslip = FALSE + + else + // Proper sliding behavior + switch(start.wet) + if(TURFSLIP_WET) + // Slipping on wet turf doesn't push you a turf + owner.slip("the [floor_type] floor", slip_stun) + qdel(src) + return + + if(TURFSLIP_LUBE) + floor_type = "slippery" + slip_dist = 99 //Skill issue. + slip_stun = 10 + dirtslip = FALSE + + if(TURFSLIP_ICE) + floor_type = "icy" + slip_dist = 1 + slip_stun = 4 + dirtslip = FALSE // Only start the slip timer if we are not already sliding if(!already_slipping) @@ -60,8 +76,8 @@ qdel(src) return // reduce absurd slip distances to something reasonable if we are no longer standing on lube - if(slip_dist > 5) - slip_dist = rand(2,4) + if(slip_dist > 4) + slip_dist = 4 else if(ground.wet == TURFSLIP_LUBE) // Lube slips forever, if we re-enter the lube then restore our slip @@ -72,7 +88,7 @@ /datum/component/turfslip/proc/next_slip() // check tile for next slip owner.is_slipping = TRUE - if(!step(owner, owner.dir) || dirtslip) // done sliding, failed to move, dirt also only slips once + if(!step(owner, slipping_dir) || dirtslip) // done sliding, failed to move, dirt also only slips once slip_dist = 0 qdel(src) return @@ -93,18 +109,23 @@ //////////////////////////////////////////////////////////////////////////////////////// // Helper proc //////////////////////////////////////////////////////////////////////////////////////// -/turf/proc/check_slipping(var/mob/living/M) +/turf/proc/check_slipping(mob/living/M,dirtslip) return FALSE -/turf/simulated/check_slipping(var/mob/living/M,var/dirtslip) +/turf/simulated/check_slipping(mob/living/M,dirtslip) if(M.buckled) return FALSE if(M.is_incorporeal()) // Mar! return FALSE if(ishuman(M)) - var/mob/living/carbon/human/H = M - if(H.shoes && (H.shoes.item_flags & NOSLIP)) // Includes activated magboots too + var/mob/living/carbon/human/humie = M + if(humie.shoes && (humie.shoes.item_flags & NOSLIP)) // Includes activated magboots too return FALSE + if(humie.species && (humie.species.flags & NO_SLIP)) + return FALSE + if(isanimal(M)) // Simplemobs have their own slip logic + var/mob/living/simple_mob/simple = M + return simple.animal_slip(wet, dirtslip) if(!wet && !(dirtslip && (dirt > 50 || is_outdoors() == OUTDOORS_YES))) return FALSE if(wet == TURFSLIP_WET && M.m_intent == I_WALK) diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index 65443cf1f3..423f6861dc 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -471,3 +471,7 @@ to_chat(src,span_warning("Vore sprite enabled.")) update_icon() + +/// Simple mob slip logic, should be overriden if you want the simple mob to slip under certain conditions +/mob/living/simple_mob/proc/animal_slip(wet_level, dirtslip) + return FALSE