Merge pull request #7818 from Crazylemon64/item_stumbling

Item stumbling refactor
This commit is contained in:
Fox McCloud
2017-07-22 01:55:19 -04:00
committed by GitHub
14 changed files with 132 additions and 93 deletions
+18
View File
@@ -87,6 +87,15 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
var/sprite_sheets_obj = null //Used to override hardcoded clothing inventory object dmis in human clothing proc.
var/list/species_fit = null //This object has a different appearance when worn by these species
var/trip_verb = TV_TRIP
var/trip_chance = 0
var/trip_stun = 0
var/trip_weaken = 0
var/trip_any = FALSE
var/trip_walksafe = TRUE
var/trip_tiles = 0
/obj/item/New()
..()
for(var/path in actions_types)
@@ -530,3 +539,12 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
/obj/item/proc/is_equivalent(obj/item/I)
return I == src
/obj/item/Crossed(atom/movable/AM)
if(prob(trip_chance) && ishuman(AM))
var/mob/living/carbon/human/H = AM
on_trip(H)
/obj/item/proc/on_trip(mob/living/carbon/human/H)
if(H.slip(src, trip_stun, trip_weaken, trip_tiles, trip_walksafe, trip_any, trip_verb))
return TRUE
@@ -5,49 +5,6 @@
* Bike Horns
*/
/*
* Soap
*/
/obj/item/weapon/soap/Crossed(AM as mob|obj) //EXACTLY the same as bananapeel for now, so it makes sense to put it in the same dm -- Urist
if(istype(AM, /mob/living/carbon))
var/mob/living/carbon/M = AM
M.slip("soap", 4, 2)
/obj/item/weapon/soap/afterattack(atom/target, mob/user, proximity)
if(!proximity) return
//I couldn't feasibly fix the overlay bugs caused by cleaning items we are wearing.
//So this is a workaround. This also makes more sense from an IC standpoint. ~Carn
if(user.client && (target in user.client.screen))
to_chat(user, "<span class='notice'>You need to take that [target.name] off before cleaning it.</span>")
else if(target == user && user.a_intent == INTENT_GRAB && ishuman(target))
var/mob/living/carbon/human/muncher = user
if(muncher && muncher.get_species() == "Drask")
to_chat(user, "You take a bite of the [src.name]. Delicious!")
playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0)
user.nutrition += 2
else if(istype(target,/obj/effect/decal/cleanable))
user.visible_message("<span class='warning'>[user] begins to scrub \the [target.name] out with [src].</span>")
if(do_after(user, src.cleanspeed, target = target) && target)
to_chat(user, "<span class='notice'>You scrub \the [target.name] out.</span>")
qdel(target)
else
user.visible_message("<span class='warning'>[user] begins to clean \the [target.name] with [src].</span>")
if(do_after(user, src.cleanspeed, target = target))
to_chat(user, "<span class='notice'>You clean \the [target.name].</span>")
var/obj/effect/decal/cleanable/C = locate() in target
qdel(C)
target.clean_blood()
if(istype(target, /turf/simulated))
var/turf/simulated/T = target
T.dirt = 0
return
/obj/item/weapon/soap/attack(mob/target as mob, mob/user as mob)
if(target && user && ishuman(target) && ishuman(user) && !target.stat && !user.stat && user.zone_sel &&user.zone_sel.selecting == "mouth" )
user.visible_message("<span class='warning'>\the [user] washes \the [target]'s mouth out with [src.name]!</span>")
return
..()
/*
* Bike Horns
*/
@@ -50,24 +50,20 @@
*/
/obj/item/weapon/grown/bananapeel/traitorpeel
trip_stun = 0
trip_weaken = 7
trip_tiles = 4
trip_walksafe = FALSE
trip_chance = 100
/obj/item/weapon/grown/bananapeel/traitorpeel/Crossed(AM as mob|obj)
var/burned = rand(2,5)
if(istype(AM, /mob/living/carbon))
var/mob/living/carbon/M = AM
if(ishuman(M))
if(isobj(M:shoes))
if(M:shoes.flags & NOSLIP)
return
else
to_chat(M, "<span class='warning'>Your feet feel like they're on fire!</span>")
M.take_overall_damage(0, max(0, (burned - 2)))
if(!istype(M, /mob/living/carbon/slime) && !isrobot(M))
M.slip("banana peel!", 0, 7, 4)
M.take_organ_damage(2) // Was 5 -- TLE
M.take_overall_damage(0, burned)
/obj/item/weapon/grown/bananapeel/traitorpeel/on_trip(mob/living/carbon/human/H)
. = ..()
if(.)
to_chat(H, "<span class='warning'>Your feet feel like they're on fire!</span>")
H.take_overall_damage(0, rand(2,8))
H.take_organ_damage(2) // Was 5 -- TLE
/obj/item/weapon/grown/bananapeel/traitorpeel/throw_impact(atom/hit_atom)
var/burned = rand(1,3)
+43
View File
@@ -9,8 +9,51 @@
throw_speed = 4
throw_range = 20
discrete = 1
trip_stun = 4
trip_weaken = 2
trip_chance = 100
trip_walksafe = FALSE
trip_verb = TV_SLIP
var/cleanspeed = 50 //slower than mop
/obj/item/weapon/soap/afterattack(atom/target, mob/user, proximity)
if(!proximity) return
//I couldn't feasibly fix the overlay bugs caused by cleaning items we are wearing.
//So this is a workaround. This also makes more sense from an IC standpoint. ~Carn
if(user.client && (target in user.client.screen))
to_chat(user, "<span class='notice'>You need to take that [target.name] off before cleaning it.</span>")
else if(target == user && user.a_intent == INTENT_GRAB && ishuman(target))
var/mob/living/carbon/human/muncher = user
if(muncher && muncher.get_species() == "Drask")
to_chat(user, "You take a bite of the [src.name]. Delicious!")
playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0)
user.nutrition += 2
else if(istype(target,/obj/effect/decal/cleanable))
user.visible_message("<span class='warning'>[user] begins to scrub \the [target.name] out with [src].</span>")
if(do_after(user, src.cleanspeed, target = target) && target)
to_chat(user, "<span class='notice'>You scrub \the [target.name] out.</span>")
qdel(target)
else
user.visible_message("<span class='warning'>[user] begins to clean \the [target.name] with [src].</span>")
if(do_after(user, src.cleanspeed, target = target))
to_chat(user, "<span class='notice'>You clean \the [target.name].</span>")
var/obj/effect/decal/cleanable/C = locate() in target
qdel(C)
target.clean_blood()
if(istype(target, /turf/simulated))
var/turf/simulated/T = target
T.dirt = 0
/obj/item/weapon/soap/attack(mob/target as mob, mob/user as mob)
if(target && user && ishuman(target) && ishuman(user) && !target.stat && !user.stat && user.zone_sel &&user.zone_sel.selecting == "mouth" )
user.visible_message("<span class='warning'>\the [user] washes \the [target]'s mouth out with [src.name]!</span>")
return
..()
/obj/item/weapon/soap/nanotrasen
desc = "A Nanotrasen brand bar of soap. Smells of plasma."
icon_state = "soapnt"