MAGPULSE clothing flag instead of hard magboot checks (#23022)

This commit is contained in:
SonixApache
2019-05-26 12:11:14 +02:00
committed by jknpj
parent d214e7c3d8
commit b82d367101
7 changed files with 62 additions and 56 deletions

View File

@@ -4,7 +4,7 @@
//clothing flags //clothing flags
#define MASKINTERNALS 1 // mask allows internals #define MASKINTERNALS 1 // mask allows internals
#define NOSLIP 2 //prevents from slipping on wet floors, in space etc #define NOSLIP 2 //prevents from slipping on wet floors, etc
#define BLOCK_GAS_SMOKE_EFFECT 4 //blocks the effect that chemical clouds would have on a mob #define BLOCK_GAS_SMOKE_EFFECT 4 //blocks the effect that chemical clouds would have on a mob
#define ONESIZEFITSALL 8 #define ONESIZEFITSALL 8
#define PLASMAGUARD 16 //Does not get contaminated by plasma. #define PLASMAGUARD 16 //Does not get contaminated by plasma.
@@ -13,3 +13,4 @@
#define CANEXTINGUISH 128 #define CANEXTINGUISH 128
#define CONTAINPLASMAMAN 256 #define CONTAINPLASMAMAN 256
#define IGNORE_LUBE 512 #define IGNORE_LUBE 512
#define MAGPULSE 1024 //prevents slipping in space, singulo pulling, etc

View File

@@ -448,6 +448,7 @@
var/chaintype = null // Type of chain. var/chaintype = null // Type of chain.
var/bonus_kick_damage = 0 var/bonus_kick_damage = 0
var/footprint_type = /obj/effect/decal/cleanable/blood/tracks/footprints //The type of footprint left by someone wearing these var/footprint_type = /obj/effect/decal/cleanable/blood/tracks/footprints //The type of footprint left by someone wearing these
var/mag_slow = MAGBOOTS_SLOWDOWN_HIGH //how slow are they when the magpulse is on?
siemens_coefficient = 0.9 siemens_coefficient = 0.9
body_parts_covered = FEET body_parts_covered = FEET
@@ -477,6 +478,18 @@
. = ..() . = ..()
track_blood = 0 track_blood = 0
/obj/item/clothing/shoes/proc/togglemagpulse(var/mob/user = usr)
if(user.isUnconscious())
return
if((clothing_flags & MAGPULSE))
clothing_flags &= ~(NOSLIP | MAGPULSE)
slowdown = NO_SLOWDOWN
return 0
else
clothing_flags |= (NOSLIP | MAGPULSE)
slowdown = mag_slow
return 1
//Suit //Suit
/obj/item/clothing/suit /obj/item/clothing/suit
icon = 'icons/obj/clothing/suits.dmi' icon = 'icons/obj/clothing/suits.dmi'

View File

@@ -3,8 +3,6 @@
name = "magboots" name = "magboots"
icon_state = "magboots0" icon_state = "magboots0"
var/base_state = "magboots" var/base_state = "magboots"
var/magpulse = 0
var/mag_slow = MAGBOOTS_SLOWDOWN_HIGH
// clothing_flags = NOSLIP //disabled by default // clothing_flags = NOSLIP //disabled by default
actions_types = list(/datum/action/item_action/toggle_magboots) actions_types = list(/datum/action/item_action/toggle_magboots)
species_fit = list(VOX_SHAPED) species_fit = list(VOX_SHAPED)
@@ -22,7 +20,7 @@
set category = "Object" set category = "Object"
if (!usr || loc != usr) if (!usr || loc != usr)
return return
return toggle(usr) // Sanity is handled there. return togglemagpulse(usr) // Sanity is handled there.
/obj/item/clothing/shoes/magboots/on_kick(mob/living/carbon/human/user, mob/living/victim) /obj/item/clothing/shoes/magboots/on_kick(mob/living/carbon/human/user, mob/living/victim)
if(!stomp_attack_power) if(!stomp_attack_power)
@@ -31,14 +29,14 @@
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
var/datum/organ/external/affecting = victim.get_organ(user.get_unarmed_damage_zone(victim)) var/datum/organ/external/affecting = victim.get_organ(user.get_unarmed_damage_zone(victim))
if(magpulse && victim.lying && T == victim.loc && !istype(T, /turf/space)) //To stomp on somebody, you have to be on the same tile as them. You can't be in space, and they have to be lying if((clothing_flags & MAGPULSE) && victim.lying && T == victim.loc && !istype(T, /turf/space)) //To stomp on somebody, you have to be on the same tile as them. You can't be in space, and they have to be lying
//NUCLEAR MAGBOOT STUMP INCOMING (it takes 3 seconds) //NUCLEAR MAGBOOT STUMP INCOMING (it takes 3 seconds)
user.visible_message("<span class='danger'>\The [user] slowly raises \his [stomp_boot] above the lying [victim.name], preparing to stomp on \him.</span>") user.visible_message("<span class='danger'>\The [user] slowly raises \his [stomp_boot] above the lying [victim.name], preparing to stomp on \him.</span>")
toggle(user) togglemagpulse(user)
if(do_after(user, src, stomp_delay)) if(do_after(user, src, stomp_delay))
if(magpulse) if((clothing_flags & MAGPULSE))
return //Magboots enabled return //Magboots enabled
if(!victim.lying || (victim.loc != T)) if(!victim.lying || (victim.loc != T))
return //Victim moved return //Victim moved
@@ -52,35 +50,33 @@
else else
return return
toggle(user) togglemagpulse(user)
playsound(victim, 'sound/mecha/mechstep.ogg', 100, 1) playsound(victim, 'sound/mecha/mechstep.ogg', 100, 1)
/obj/item/clothing/shoes/magboots/proc/toggle(var/mob/user = usr) /obj/item/clothing/shoes/magboots/attack_self()
src.togglemagpulse()
..()
return
/obj/item/clothing/shoes/magboots/togglemagpulse(var/mob/user = usr)
if(user.isUnconscious()) if(user.isUnconscious())
return return
if(src.magpulse) if(clothing_flags & MAGPULSE)
src.clothing_flags &= ~NOSLIP clothing_flags &= ~(NOSLIP | MAGPULSE)
src.slowdown = NO_SLOWDOWN slowdown = NO_SLOWDOWN
src.magpulse = 0
icon_state = "[base_state]0" icon_state = "[base_state]0"
to_chat(user, "You disable the mag-pulse traction system.") to_chat(user, "You disable the mag-pulse traction system.")
else else
src.clothing_flags |= NOSLIP clothing_flags |= (NOSLIP | MAGPULSE)
src.slowdown = mag_slow slowdown = mag_slow
src.magpulse = 1
icon_state = "[base_state]1" icon_state = "[base_state]1"
to_chat(user, "You enable the mag-pulse traction system.") to_chat(user, "You enable the mag-pulse traction system.")
user.update_inv_shoes() //so our mob-overlays update user.update_inv_shoes() //so our mob-overlays update
/obj/item/clothing/shoes/magboots/attack_self()
src.toggle()
..()
return
/obj/item/clothing/shoes/magboots/examine(mob/user) /obj/item/clothing/shoes/magboots/examine(mob/user)
..() ..()
var/state = " disabled." var/state = " disabled."
if(src.clothing_flags&NOSLIP) if(src.clothing_flags&MAGPULSE)
state = " enabled." state = " enabled."
to_chat(user, "<span class='info'>[anchoring_system_examine][state]</span>") to_chat(user, "<span class='info'>[anchoring_system_examine][state]</span>")
@@ -136,22 +132,22 @@
icon_state = "MAGNIFICENTboots0" icon_state = "MAGNIFICENTboots0"
base_state = "MAGNIFICENTboots" base_state = "MAGNIFICENTboots"
/obj/item/clothing/shoes/magboots/captain/toggle(var/mob/user = usr) /obj/item/clothing/shoes/magboots/captain/togglemagpulse(var/mob/user = usr)
//set name = "Toggle Floor Grip" //set name = "Toggle Floor Grip"
if(user.isUnconscious()) if(user.isUnconscious())
return return
if(src.magpulse) if((clothing_flags & MAGPULSE))
src.clothing_flags &= ~NOSLIP clothing_flags &= ~(NOSLIP | MAGPULSE)
src.slowdown = NO_SLOWDOWN slowdown = NO_SLOWDOWN
src.magpulse = 0
icon_state = "[base_state]0" icon_state = "[base_state]0"
to_chat(user, "You stop ruining the carpet.") to_chat(user, "You stop ruining the carpet.")
return 0
else else
src.clothing_flags |= NOSLIP clothing_flags |= (NOSLIP | MAGPULSE)
src.slowdown = mag_slow slowdown = mag_slow
src.magpulse = 1
icon_state = "[base_state]1" icon_state = "[base_state]1"
to_chat(user, "Small spikes shoot from your shoes and dig into the flooring, bracing you.") to_chat(user, "Small spikes shoot from your shoes and dig into the flooring, bracing you.")
return 1
/obj/item/clothing/shoes/magboots/funk /obj/item/clothing/shoes/magboots/funk
@@ -162,7 +158,7 @@
var/funk_level = 0 var/funk_level = 0
canremove = 0 canremove = 0
/obj/item/clothing/shoes/magboots/funk/toggle(var/mob/user = usr) /obj/item/clothing/shoes/magboots/funk/togglemagpulse(var/mob/user = usr)
if(user.isUnconscious()) if(user.isUnconscious())
return return
if(funk_level >= 11) //WE HAVE GONE TOO FAR, COMRADE if(funk_level >= 11) //WE HAVE GONE TOO FAR, COMRADE
@@ -170,8 +166,7 @@
user.visible_message("<span class = 'warning'>[usr] dials up \the [src]'s funk level to [funk_level+1]</span>") user.visible_message("<span class = 'warning'>[usr] dials up \the [src]'s funk level to [funk_level+1]</span>")
funk_level++ funk_level++
if(funk_level >= 2) if(funk_level >= 2)
clothing_flags |= NOSLIP clothing_flags |= (NOSLIP | MAGPULSE)
magpulse = 1
/obj/item/clothing/shoes/magboots/funk/step_action() /obj/item/clothing/shoes/magboots/funk/step_action()
..() ..()
@@ -214,12 +209,11 @@
explosion(get_turf(src), round(((1*funk_level)+russian)*0.25), round(((1*funk_level)+russian)*0.5), round((1*funk_level)+russian)) explosion(get_turf(src), round(((1*funk_level)+russian)*0.25), round(((1*funk_level)+russian)*0.5), round((1*funk_level)+russian))
if(prob((funk_level/russian)*2)) //IT WAS ALWAYS TOO LATE if(prob((funk_level/russian)*2)) //IT WAS ALWAYS TOO LATE
toggle(H) togglemagpulse(H)
/obj/item/clothing/shoes/magboots/funk/OnMobDeath(var/mob/living/carbon/human/wearer) /obj/item/clothing/shoes/magboots/funk/OnMobDeath(var/mob/living/carbon/human/wearer)
var/mob/living/carbon/human/W = wearer var/mob/living/carbon/human/W = wearer
W.drop_from_inventory(src) W.drop_from_inventory(src)
funk_level = 0 funk_level = 0
canremove = 1 canremove = 1
clothing_flags &= ~NOSLIP clothing_flags &= ~(NOSLIP | MAGPULSE)
magpulse = 0

View File

@@ -138,20 +138,20 @@
footprint_type = /obj/effect/decal/cleanable/blood/tracks/footprints/vox //They're like those five-toed shoes except for vox and with only three toes footprint_type = /obj/effect/decal/cleanable/blood/tracks/footprints/vox //They're like those five-toed shoes except for vox and with only three toes
/obj/item/clothing/shoes/magboots/vox/toggle() /obj/item/clothing/shoes/magboots/vox/togglemagpulse()
//set name = "Toggle Floor Grip" //set name = "Toggle Floor Grip"
if(usr.isUnconscious()) if(usr.isUnconscious())
return return
if(src.magpulse) if(clothing_flags & MAGPULSE)
src.clothing_flags &= ~NOSLIP clothing_flags &= ~(NOSLIP | MAGPULSE)
src.magpulse = 0 slowdown = NO_SLOWDOWN
src.slowdown = NO_SLOWDOWN
to_chat(usr, "You retract the razor-sharp talons of your boots.") to_chat(usr, "You retract the razor-sharp talons of your boots.")
return 0
else else
src.clothing_flags |= NOSLIP clothing_flags |= (NOSLIP | MAGPULSE)
src.magpulse = 1 slowdown = mag_slow
src.slowdown = mag_slow
to_chat(usr, "You extend the razor-sharp talons of your boots.") to_chat(usr, "You extend the razor-sharp talons of your boots.")
return 1
// Vox Trader -- Same stats as civ gear, but looks like raiders. /////////////////////////////// // Vox Trader -- Same stats as civ gear, but looks like raiders. ///////////////////////////////

View File

@@ -1271,9 +1271,7 @@
/mob/living/carbon/human/canSingulothPull(var/obj/machinery/singularity/singulo) /mob/living/carbon/human/canSingulothPull(var/obj/machinery/singularity/singulo)
if(!..()) if(!..())
return 0 return 0
if(istype(shoes,/obj/item/clothing/shoes/magboots)) if((shoes.clothing_flags & MAGPULSE) && singulo.current_size <= STAGE_FOUR)
var/obj/item/clothing/shoes/magboots/M = shoes
if(M.magpulse && singulo.current_size <= STAGE_FOUR)
return 0 return 0
return 1 return 1
// Get ALL accesses available. // Get ALL accesses available.

View File

@@ -155,7 +155,7 @@
else else
shoes_slip_factor = TRUE // Shoes are of no interest for this. shoes_slip_factor = TRUE // Shoes are of no interest for this.
var/magboots_slip_factor = (!slip_on_magbooties && shoes_slip_factor && istype(shoes, /obj/item/clothing/shoes/magboots)) var/magboots_slip_factor = (!slip_on_magbooties && shoes_slip_factor && (shoes.clothing_flags & MAGPULSE))
. = ..() . = ..()
// We have magboots, and magboots can protect us // We have magboots, and magboots can protect us

View File

@@ -50,7 +50,7 @@
if (RESULT_MAGBOOTS) if (RESULT_MAGBOOTS)
var/obj/item/clothing/shoes/magboots/M = new var/obj/item/clothing/shoes/magboots/M = new
H.equip_or_collect(M, slot_shoes) H.equip_or_collect(M, slot_shoes)
M.toggle(H) M.togglemagpulse(H)
H.Move(T_test, NORTH) H.Move(T_test, NORTH)
if (H.isStunned() != items_and_result_humans[type][i]) if (H.isStunned() != items_and_result_humans[type][i])
fail("Slipping test failed at [type], step [i] ; expected [items_and_result_humans[type][i]], got [H.isStunned()]") fail("Slipping test failed at [type], step [i] ; expected [items_and_result_humans[type][i]], got [H.isStunned()]")
@@ -74,7 +74,7 @@
if (RESULT_MAGBOOTS) if (RESULT_MAGBOOTS)
var/obj/item/clothing/shoes/magboots/M = new var/obj/item/clothing/shoes/magboots/M = new
H.equip_or_collect(M, slot_shoes) H.equip_or_collect(M, slot_shoes)
M.toggle(H) M.togglemagpulse(H)
H.Move(T_test, NORTH) H.Move(T_test, NORTH)
if (H.isStunned() != overlays_and_results[wetness][j]) if (H.isStunned() != overlays_and_results[wetness][j])
fail("Slipping test failed at [wetness], step [j] ; expected [overlays_and_results[wetness][j]], got [H.isStunned()]") fail("Slipping test failed at [wetness], step [j] ; expected [overlays_and_results[wetness][j]], got [H.isStunned()]")