refactors the code to be less awful

i was told my code was bad so maybe its less bad now
This commit is contained in:
timothyteakettle
2020-03-31 00:20:44 +01:00
parent c6163e2349
commit e2d02beedf

View File

@@ -17,12 +17,9 @@
var/datum/action/strike/strike = new/datum/action/strike()
var/datum/action/drop/drop = new/datum/action/drop()
/datum/martial_art/wrestling/proc/check_streak(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D, holodeck_mode)
//Stop people using holodeck wrestling on those not wearing the holodeck wrestling belt
if(holodeck_mode == 1)
if(!(istype(D.mind?.martial_art, /datum/martial_art/wrestling/holodeck)))
streak = ""
return 0
/datum/martial_art/wrestling/proc/check_streak(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D)
if(!can_use(A, D))
return 0
switch(streak)
if("drop")
streak = ""
@@ -140,7 +137,7 @@
strike.Remove(H)
/datum/martial_art/wrestling/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,0))
if(check_streak(A,D))
return 1
log_combat(A, D, "punched with wrestling")
..()
@@ -445,14 +442,16 @@
return
/datum/martial_art/wrestling/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,0))
if(check_streak(A,D))
return 1
log_combat(A, D, "wrestling-disarmed")
..()
/datum/martial_art/wrestling/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,0))
if(check_streak(A,D))
return 1
if(!can_use(A,D))
return ..()
if(A.pulling == D || A == D) // don't stun grab yoursel
return FALSE
A.start_pulling(D)
@@ -491,30 +490,9 @@
style = new /datum/martial_art/wrestling/holodeck
//Make sure that moves can only be used on people wearing the holodeck belt
/datum/martial_art/wrestling/holodeck/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,1))
return 1
/datum/martial_art/wrestling/holodeck/can_use(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D)
if(!(istype(D.mind?.martial_art, /datum/martial_art/wrestling/holodeck)))
return FALSE
if(A.pulling == D || A == D) // don't stun grab yoursel
return FALSE
A.start_pulling(D)
D.visible_message("<span class='danger'>[A] gets [D] in a cinch!</span>", \
"<span class='userdanger'>[A] gets [D] in a cinch!</span>")
D.Stun(rand(60,100))
log_combat(A, D, "cinched")
return 1
/datum/martial_art/wrestling/holodeck/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,1))
return 1
log_combat(A, D, "punched with wrestling")
..()
/datum/martial_art/wrestling/holodeck/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(check_streak(A,D,1))
return 1
log_combat(A, D, "wrestling-disarmed")
..()
return 0
else
return ..()