Merge pull request #11080 from kevinz000/surubatons
hey someone gave me this idea for stunbatons (and I sort of expanded it) and it's worth a test
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
throw_range = 14
|
throw_range = 14
|
||||||
w_class = WEIGHT_CLASS_SMALL
|
w_class = WEIGHT_CLASS_SMALL
|
||||||
|
|
||||||
/obj/item/toy/tennis/pre_altattackby(atom/A, mob/living/user, params) //checks if it can do right click memes
|
/obj/item/toy/tennis/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
|
||||||
altafterattack(A, user, TRUE, params)
|
altafterattack(A, user, TRUE, params)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
light_color = "#37FFF7"
|
light_color = "#37FFF7"
|
||||||
actions_types = list()
|
actions_types = list()
|
||||||
|
|
||||||
/obj/item/melee/transforming/energy/sword/cx/pre_altattackby(atom/A, mob/living/user, params) //checks if it can do right click memes
|
/obj/item/melee/transforming/energy/sword/cx/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
|
||||||
altafterattack(A, user, TRUE, params)
|
altafterattack(A, user, TRUE, params)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,18 @@
|
|||||||
attack_verb = list("beaten")
|
attack_verb = list("beaten")
|
||||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 50, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
|
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 50, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
|
||||||
|
|
||||||
var/stunforce = 70
|
var/stamforce = 25
|
||||||
var/status = FALSE
|
var/status = FALSE
|
||||||
|
var/knockdown = TRUE
|
||||||
var/obj/item/stock_parts/cell/cell
|
var/obj/item/stock_parts/cell/cell
|
||||||
var/hitcost = 1000
|
var/hitcost = 750
|
||||||
var/throw_hit_chance = 35
|
var/throw_hit_chance = 35
|
||||||
var/preload_cell_type //if not empty the baton starts with this type of cell
|
var/preload_cell_type //if not empty the baton starts with this type of cell
|
||||||
|
|
||||||
|
/obj/item/melee/baton/examine(mob/user)
|
||||||
|
. = ..()
|
||||||
|
. += "<span class='notice'>Right click attack while in combat mode to disarm instead of stun.</span>"
|
||||||
|
|
||||||
/obj/item/melee/baton/get_cell()
|
/obj/item/melee/baton/get_cell()
|
||||||
. = cell
|
. = cell
|
||||||
if(iscyborg(loc))
|
if(iscyborg(loc))
|
||||||
@@ -32,7 +37,7 @@
|
|||||||
user.visible_message("<span class='suicide'>[user] is putting the live [name] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
user.visible_message("<span class='suicide'>[user] is putting the live [name] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||||
return (FIRELOSS)
|
return (FIRELOSS)
|
||||||
|
|
||||||
/obj/item/melee/baton/Initialize()
|
/obj/item/melee/baton/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(preload_cell_type)
|
if(preload_cell_type)
|
||||||
if(!ispath(preload_cell_type,/obj/item/stock_parts/cell))
|
if(!ispath(preload_cell_type,/obj/item/stock_parts/cell))
|
||||||
@@ -48,7 +53,7 @@
|
|||||||
baton_stun(hit_atom)
|
baton_stun(hit_atom)
|
||||||
|
|
||||||
/obj/item/melee/baton/loaded //this one starts with a cell pre-installed.
|
/obj/item/melee/baton/loaded //this one starts with a cell pre-installed.
|
||||||
preload_cell_type = /obj/item/stock_parts/cell/high
|
preload_cell_type = /obj/item/stock_parts/cell/high/plus
|
||||||
|
|
||||||
/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE, explode = TRUE)
|
/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE, explode = TRUE)
|
||||||
var/obj/item/stock_parts/cell/copper_top = get_cell()
|
var/obj/item/stock_parts/cell/copper_top = get_cell()
|
||||||
@@ -134,44 +139,41 @@
|
|||||||
add_fingerprint(user)
|
add_fingerprint(user)
|
||||||
|
|
||||||
/obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user)
|
/obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user)
|
||||||
|
var/interrupt = common_baton_melee(M, user, FALSE)
|
||||||
|
if(!interrupt)
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/melee/baton/alt_pre_attack(atom/A, mob/living/user, params)
|
||||||
|
. = common_baton_melee(A, user, TRUE) //return true (attackchain interrupt) if this also returns true. no harm-disarming.
|
||||||
|
user.changeNext_move(CLICK_CD_MELEE)
|
||||||
|
|
||||||
|
//return TRUE to interrupt attack chain.
|
||||||
|
/obj/item/melee/baton/proc/common_baton_melee(mob/M, mob/living/user, disarming = FALSE)
|
||||||
|
if(iscyborg(M) || !isliving(M)) //can't baton cyborgs
|
||||||
|
return FALSE
|
||||||
if(status && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
if(status && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
||||||
clowning_around(user)
|
clowning_around(user)
|
||||||
return
|
if(user.getStaminaLoss() >= STAMINA_SOFTCRIT) //CIT CHANGE - makes it impossible to baton in stamina softcrit
|
||||||
|
to_chat(user, "<span class='danger'>You're too exhausted for that.</span>")
|
||||||
if(user.getStaminaLoss() >= STAMINA_SOFTCRIT)//CIT CHANGE - makes it impossible to baton in stamina softcrit
|
return TRUE
|
||||||
to_chat(user, "<span class='danger'>You're too exhausted for that.</span>")//CIT CHANGE - ditto
|
|
||||||
return //CIT CHANGE - ditto
|
|
||||||
|
|
||||||
if(iscyborg(M))
|
|
||||||
..()
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if(ishuman(M))
|
if(ishuman(M))
|
||||||
var/mob/living/carbon/human/L = M
|
var/mob/living/carbon/human/L = M
|
||||||
if(check_martial_counter(L, user))
|
if(check_martial_counter(L, user))
|
||||||
return
|
return TRUE
|
||||||
|
if(status)
|
||||||
|
if(baton_stun(M, user, disarming))
|
||||||
|
user.do_attack_animation(M)
|
||||||
|
user.adjustStaminaLossBuffered(getweight()) //CIT CHANGE - makes stunbatonning others cost stamina
|
||||||
|
else if(user.a_intent != INTENT_HARM) //they'll try to bash in the last proc.
|
||||||
|
M.visible_message("<span class='warning'>[user] has prodded [M] with [src]. Luckily it was off.</span>", \
|
||||||
|
"<span class='warning'>[user] has prodded you with [src]. Luckily it was off</span>")
|
||||||
|
return disarming || (user.a_intent != INTENT_HARM)
|
||||||
|
|
||||||
if(user.a_intent != INTENT_HARM)
|
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user, disarming = FALSE)
|
||||||
if(status)
|
|
||||||
if(baton_stun(M, user))
|
|
||||||
user.do_attack_animation(M)
|
|
||||||
user.adjustStaminaLossBuffered(getweight())//CIT CHANGE - makes stunbatonning others cost stamina
|
|
||||||
return
|
|
||||||
else
|
|
||||||
M.visible_message("<span class='warning'>[user] has prodded [M] with [src]. Luckily it was off.</span>", \
|
|
||||||
"<span class='warning'>[user] has prodded you with [src]. Luckily it was off</span>")
|
|
||||||
else
|
|
||||||
if(status)
|
|
||||||
baton_stun(M, user)
|
|
||||||
..()
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user)
|
|
||||||
if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
|
if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
|
||||||
playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
|
playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
|
||||||
return FALSE
|
return FALSE
|
||||||
var/stunpwr = stunforce
|
var/stunpwr = stamforce
|
||||||
var/obj/item/stock_parts/cell/our_cell = get_cell()
|
var/obj/item/stock_parts/cell/our_cell = get_cell()
|
||||||
if(!our_cell)
|
if(!our_cell)
|
||||||
switch_status(FALSE)
|
switch_status(FALSE)
|
||||||
@@ -187,17 +189,21 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
stunpwr *= round(stuncharge/hitcost, 0.1)
|
stunpwr *= round(stuncharge/hitcost, 0.1)
|
||||||
|
|
||||||
|
if(!disarming)
|
||||||
|
if(knockdown)
|
||||||
|
L.Knockdown(50, override_stamdmg = 0) //knockdown
|
||||||
|
L.adjustStaminaLoss(stunpwr)
|
||||||
|
else
|
||||||
|
L.drop_all_held_items() //no knockdown/stamina damage, instead disarm.
|
||||||
|
|
||||||
L.Knockdown(stunpwr, override_stamdmg = 0)
|
L.apply_effect(EFFECT_STUTTER, stamforce)
|
||||||
L.apply_damage(stunpwr*0.5, STAMINA, user.zone_selected)
|
|
||||||
L.apply_effect(EFFECT_STUTTER, stunforce)
|
|
||||||
SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK)
|
SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK)
|
||||||
if(user)
|
if(user)
|
||||||
L.lastattacker = user.real_name
|
L.lastattacker = user.real_name
|
||||||
L.lastattackerckey = user.ckey
|
L.lastattackerckey = user.ckey
|
||||||
L.visible_message("<span class='danger'>[user] has stunned [L] with [src]!</span>", \
|
L.visible_message("<span class='danger'>[user] has [disarming? "disarmed" : "stunned"] [L] with [src]!</span>", \
|
||||||
"<span class='userdanger'>[user] has stunned you with [src]!</span>")
|
"<span class='userdanger'>[user] has [disarming? "disarmed" : "stunned"] you with [src]!</span>")
|
||||||
log_combat(user, L, "stunned")
|
log_combat(user, L, disarming? "disarmed" : "stunned")
|
||||||
|
|
||||||
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
||||||
|
|
||||||
@@ -212,7 +218,7 @@
|
|||||||
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
|
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
|
||||||
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
|
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
|
||||||
SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK)
|
SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK)
|
||||||
user.Knockdown(stunforce*3)
|
user.Knockdown(stamforce*6)
|
||||||
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
||||||
deductcharge(hitcost)
|
deductcharge(hitcost)
|
||||||
|
|
||||||
@@ -274,8 +280,9 @@
|
|||||||
w_class = WEIGHT_CLASS_BULKY
|
w_class = WEIGHT_CLASS_BULKY
|
||||||
force = 3
|
force = 3
|
||||||
throwforce = 5
|
throwforce = 5
|
||||||
stunforce = 60
|
stamforce = 25
|
||||||
hitcost = 2000
|
hitcost = 1000
|
||||||
|
knockdown = FALSE
|
||||||
throw_hit_chance = 10
|
throw_hit_chance = 10
|
||||||
slot_flags = ITEM_SLOT_BACK
|
slot_flags = ITEM_SLOT_BACK
|
||||||
var/obj/item/assembly/igniter/sparkler
|
var/obj/item/assembly/igniter/sparkler
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
|
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
|
||||||
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
|
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
|
||||||
SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK)
|
SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK)
|
||||||
user.Knockdown(stunforce*3)
|
user.Knockdown(stamforce * 6)
|
||||||
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
|
||||||
if(do_teleport(user, get_turf(user), 50, channel = TELEPORT_CHANNEL_BLUESPACE))
|
if(do_teleport(user, get_turf(user), 50, channel = TELEPORT_CHANNEL_BLUESPACE))
|
||||||
deductcharge(hitcost)
|
deductcharge(hitcost)
|
||||||
|
|||||||
@@ -289,7 +289,7 @@
|
|||||||
var/light_brightness = 3
|
var/light_brightness = 3
|
||||||
actions_types = list()
|
actions_types = list()
|
||||||
|
|
||||||
/obj/item/toy/sword/cx/pre_altattackby(atom/A, mob/living/user, params) //checks if it can do right click memes
|
/obj/item/toy/sword/cx/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
|
||||||
altafterattack(A, user, TRUE, params)
|
altafterattack(A, user, TRUE, params)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -510,7 +510,7 @@
|
|||||||
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/IsReflect()
|
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/IsReflect()
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/obj/item/twohanded/dualsaber/hypereutactic/pre_altattackby(atom/A, mob/living/user, params) //checks if it can do right click memes
|
/obj/item/twohanded/dualsaber/hypereutactic/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
|
||||||
altafterattack(A, user, TRUE, params)
|
altafterattack(A, user, TRUE, params)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -528,8 +528,8 @@
|
|||||||
if(B.cell)
|
if(B.cell)
|
||||||
if(B.cell.charge > 0 && B.status == 1)
|
if(B.cell.charge > 0 && B.status == 1)
|
||||||
flick("baton_active", src)
|
flick("baton_active", src)
|
||||||
var/stunforce = B.stunforce
|
var/stunforce = B.stamforce
|
||||||
user.Knockdown(stunforce)
|
user.Knockdown(stunforce * 2)
|
||||||
user.stuttering = stunforce/20
|
user.stuttering = stunforce/20
|
||||||
B.deductcharge(B.hitcost)
|
B.deductcharge(B.hitcost)
|
||||||
user.visible_message("<span class='warning'>[user] shocks [user.p_them()]self while attempting to wash the active [B.name]!</span>", \
|
user.visible_message("<span class='warning'>[user] shocks [user.p_them()]self while attempting to wash the active [B.name]!</span>", \
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
SEND_SIGNAL(A, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_MEDIUM)
|
SEND_SIGNAL(A, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_MEDIUM)
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/reagent_containers/rag/pre_altattackby(mob/living/M, mob/living/user, params)
|
/obj/item/reagent_containers/rag/alt_pre_attack(mob/living/M, mob/living/user, params)
|
||||||
if(istype(M) && user.a_intent == INTENT_HELP)
|
if(istype(M) && user.a_intent == INTENT_HELP)
|
||||||
user.changeNext_move(CLICK_CD_MELEE)
|
user.changeNext_move(CLICK_CD_MELEE)
|
||||||
if(M.on_fire)
|
if(M.on_fire)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/obj/item/proc/rightclick_melee_attack_chain(mob/user, atom/target, params)
|
/obj/item/proc/rightclick_melee_attack_chain(mob/user, atom/target, params)
|
||||||
if(!pre_altattackby(target, user, params)) //Hey, does this item have special behavior that should override all normal right-click functionality?
|
if(!alt_pre_attack(target, user, params)) //Hey, does this item have special behavior that should override all normal right-click functionality?
|
||||||
if(!target.altattackby(src, user, params)) //Does the target do anything special when we right-click on it?
|
if(!target.altattackby(src, user, params)) //Does the target do anything special when we right-click on it?
|
||||||
melee_attack_chain(user, target, params) //Ugh. Lame! I'm filing a legal complaint about the discrimination against the right mouse button!
|
melee_attack_chain(user, target, params) //Ugh. Lame! I'm filing a legal complaint about the discrimination against the right mouse button!
|
||||||
else
|
else
|
||||||
altafterattack(target, user, TRUE, params)
|
altafterattack(target, user, TRUE, params)
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/proc/pre_altattackby(atom/A, mob/living/user, params)
|
/obj/item/proc/alt_pre_attack(atom/A, mob/living/user, params)
|
||||||
return FALSE //return something other than false if you wanna override attacking completely
|
return FALSE //return something other than false if you wanna override attacking completely
|
||||||
|
|
||||||
/atom/proc/altattackby(obj/item/W, mob/user, params)
|
/atom/proc/altattackby(obj/item/W, mob/user, params)
|
||||||
|
|||||||
Reference in New Issue
Block a user