Files
GS13NG/code/game/objects/items/stunbaton.dm
deathride58 1c0b13ecfb [READY FOR MERGE] The Giant Combat Reworks - Part 1: Goodbye stuns, hello staminacrit (#5463)
* part 1 - resist out of resting, move and interact with the world while resting, and stamina regen nerf

* makes beepsky check for stuns instead of knockdowns, adds message for getting up, makes gravity reduce standup time, and more

* sprinting, staminacrit, balance changes, and more

* adds stamina modifier to clickdelay, makes items deal stamina damage to the user when attacking, buffs resting stamina regen

* combat mode, ability to toggle right-click context menu on/off, basic combat mode QOL, lays groundwork for 2-handing any item

combat mode toggle sound is from Interbay.

* commits dme changes

* unarmed combat stamina, ability to right click in combat mode, balance changes

* tosses in the HUD icons for later-ish

* rolls back admin.txt

* lotsa UI stuff

* stamina checks, some balance stuff

* adds support for best ui, adds right click to flush disposals, removes aggressive grab pinning in favor of neckgrab chokeholding

* quick dogborg patch while i figure out what do do with them

* oops - fixes prefbreaking for screenshake

* trying to sprint from an elevated surface onto lower ground will now knock you down

* right click to pull fire alarm, lets you bully people by pulling chairs out form under them, makes attacking objects cost stamina

* makes accidents during slipping less likely to occur while combat mode is active, makes tripping off elevated surfaces cause accidents

* makes pumping shotguns cost a tiiiny bit of stamina

* makes eyestabbing and batoning cost stamina

* makes failing stamina checks error out properly, adds stamina check to shotgun pumping

* adds stamina check for chair pulling

* readds aggressive grab pinning

* fixes bug with being buckled preventing interaction

* adds recoveringstam check to incapacitated

* reduces stamina cost for attacking

* oh this too

* fixes bug where you can get stuck in recoveringstam if your stamina suddenly becomes 0 while you're in staminacrit

* makes monkey transformation inherit staminaloss

* adds the ability to wave or shake your fist at someone via right click

* grammar and span closing

* 99 annoying little bugs on the wall, 99 annoying little bugs. take one down, pass it around, 864 gamebreaking bugs on the wall

* more distant right-click emotes.

* buffs standing stamina regen a tiiiiiiny bit

* adds aiming down sights for guns, makes firing guns cause trace amounts of staminaloss

* crusher powercreep - gives crushers the ability to heal staminaloss

* item throwing buff

* adds 1:1 HUD layout

* hopefully fixes issue with recoveringstamcrit not updating

* giant hipfire nerf

* halves the effect of staminaloss on movement speed

* makes stamina recover faster in staminacrit, makes it easier to get disarmed out of combat mode

* get_weight(), movedelay health_deficiency tweaking, combat and resting checks for item attacking

* makes staminacrit automatically disable combat mode, it's now impossible to enter combat mode while in stamcrit

* adds stamina buffer, halves the time needed to stand up after resting, increases stam penalty for firing weapons, and more

* tweaks stamina buffer drain rate a little

* makes buffered staminaloss redirect stamina to the actual stamloss proc when empty, makes stamina buffer stat() more precise

* removes stamina modifier for clickdelays, makes stunbatons deal extra staminaloss

* makes electrodes deal a lil extra staminaloss

* drones cannot resist a rest, so now only carbons are forced to rest

* restricts aiming down sights to carbon mobs, adds stamina display to stat()

* makes gun accuracy and stamcosts more flexible, decreases base inaccuracy penalty, makes borgs immune to inaccuracy penalties

* nerfs inaccuracy penalties just a lil more, fixes blooddrunk miner eye depleting all your stamina

* getting used to tortoisegit

* readds temp dogborg buff

* stamina and stamina buffer HUD displays. Stamina sprite from hippiestation

* makes afterattack call properly again

* decreases stamina buffer regen time to 3 seconds

* Yknow what? decreases it to 2 seconds. That's 3 entire attacks worth of waiting

* makes stamina buffer influence movespeed a lil

* nerfs compiling errors

* tweaks the icons a little

* adds autostanding, adds delimiters to attempts to stand

* makes automatic standup attempts a little clearer

* rest button now toggles intent to rest, fixes perma rest

* oop - quick fixes

* Makes crushers ignore recoil stamina on lavaland, makes burstfiring weapons deal less staminaloss

* buffs highlander sword

* makes stamina have less of an impact on the health display

* fixes dogborgs shoving other borgs into infinite stuns

* You can no longer shoot over tables or shoot through windows while resting. Also buffs turrets
2018-03-11 13:32:44 -07:00

208 lines
6.4 KiB
Plaintext

/obj/item/melee/baton
name = "stunbaton"
desc = "A stun baton for incapacitating people with."
icon_state = "stunbaton"
item_state = "baton"
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
slot_flags = SLOT_BELT
force = 10
throwforce = 7
w_class = WEIGHT_CLASS_NORMAL
attack_verb = list("beaten")
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 50, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
var/stunforce = 140
var/status = 0
var/obj/item/stock_parts/cell/high/cell
var/hitcost = 1000
var/throw_hit_chance = 35
/obj/item/melee/baton/get_cell()
return cell
/obj/item/melee/baton/suicide_act(mob/user)
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)
/obj/item/melee/baton/Initialize()
. = ..()
update_icon()
/obj/item/melee/baton/throw_impact(atom/hit_atom)
..()
//Only mob/living types have stun handling
if(status && prob(throw_hit_chance) && iscarbon(hit_atom))
baton_stun(hit_atom)
/obj/item/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed.
cell = new(src)
update_icon()
. = ..()
/obj/item/melee/baton/proc/deductcharge(chrgdeductamt)
if(cell)
//Note this value returned is significant, as it will determine
//if a stun is applied or not
. = cell.use(chrgdeductamt)
if(status && cell.charge < hitcost)
//we're below minimum, turn off
status = 0
update_icon()
playsound(loc, "sparks", 75, 1, -1)
/obj/item/melee/baton/update_icon()
if(status)
icon_state = "[initial(name)]_active"
else if(!cell)
icon_state = "[initial(name)]_nocell"
else
icon_state = "[initial(name)]"
/obj/item/melee/baton/examine(mob/user)
..()
if(cell)
to_chat(user, "<span class='notice'>\The [src] is [round(cell.percent())]% charged.</span>")
else
to_chat(user, "<span class='warning'>\The [src] does not have a power source installed.</span>")
/obj/item/melee/baton/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/cell))
var/obj/item/stock_parts/cell/C = W
if(cell)
to_chat(user, "<span class='notice'>[src] already has a cell.</span>")
else
if(C.maxcharge < hitcost)
to_chat(user, "<span class='notice'>[src] requires a higher capacity cell.</span>")
return
if(!user.transferItemToLoc(W, src))
return
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon()
else if(istype(W, /obj/item/screwdriver))
if(cell)
cell.update_icon()
cell.forceMove(get_turf(src))
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
status = 0
update_icon()
else
return ..()
/obj/item/melee/baton/attack_self(mob/user)
if(cell && cell.charge > hitcost)
status = !status
to_chat(user, "<span class='notice'>[src] is now [status ? "on" : "off"].</span>")
playsound(loc, "sparks", 75, 1, -1)
else
status = 0
if(!cell)
to_chat(user, "<span class='warning'>[src] does not have a power source!</span>")
else
to_chat(user, "<span class='warning'>[src] is out of charge.</span>")
update_icon()
add_fingerprint(user)
/obj/item/melee/baton/attack(mob/M, mob/living/carbon/human/user)
if(status && user.has_trait(TRAIT_CLUMSY) && prob(50))
user.visible_message("<span class='danger'>[user] accidentally hits themself with [src]!</span>", \
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
user.Knockdown(stunforce*3)
deductcharge(hitcost)
return
if(user.staminaloss >= 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>")//CIT CHANGE - ditto
return //CIT CHANGE - ditto
if(iscyborg(M))
..()
return
if(ishuman(M))
var/mob/living/carbon/human/L = M
if(check_martial_counter(L, user))
return
if(user.a_intent != INTENT_HARM)
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(ishuman(L))
var/mob/living/carbon/human/H = L
if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
return 0
if(iscyborg(loc))
var/mob/living/silicon/robot/R = loc
if(!R || !R.cell || !R.cell.use(hitcost))
return 0
else
if(!deductcharge(hitcost))
return 0
L.Knockdown(stunforce)
L.adjustStaminaLoss(stunforce*0.1)//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented.
L.apply_effect(STUTTER, stunforce)
if(user)
L.lastattacker = user.real_name
L.lastattackerckey = user.ckey
L.visible_message("<span class='danger'>[user] has stunned [L] with [src]!</span>", \
"<span class='userdanger'>[user] has stunned you with [src]!</span>")
add_logs(user, L, "stunned")
playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1)
if(ishuman(L))
var/mob/living/carbon/human/H = L
H.forcesay(GLOB.hit_appends)
return 1
/obj/item/melee/baton/emp_act(severity)
deductcharge(1000 / severity)
..()
//Makeshift stun baton. Replacement for stun gloves.
/obj/item/melee/baton/cattleprod
name = "stunprod"
desc = "An improvised stun baton."
icon_state = "stunprod_nocell"
item_state = "prod"
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
w_class = WEIGHT_CLASS_BULKY
force = 3
throwforce = 5
stunforce = 100
hitcost = 2000
throw_hit_chance = 10
slot_flags = SLOT_BACK
var/obj/item/device/assembly/igniter/sparkler = 0
/obj/item/melee/baton/cattleprod/Initialize()
. = ..()
sparkler = new (src)
/obj/item/melee/baton/cattleprod/baton_stun()
if(sparkler.activate())
..()