Glove update

Integrates gloves into click code.  Gloves now have a proc/Touch(atom, proximity) which is called before humans do an attack_hand().  It can also occur when you click on something at range, so be sure to check the proximity flag.

Adds code to make ninja gloves work properly with this and pulls it out of the various attack_hand() procs.

Other suggested uses: secret society rings, magic/cult gloves, weaponized gloves (chemical, electric, needles, etc), powered exosuit hands (for picking up crates), I dunno, there are options
This commit is contained in:
supersayu
2013-09-17 18:19:13 -04:00
parent 65ba47d872
commit 4c44e7cd89
18 changed files with 174 additions and 100 deletions
+20 -16
View File
@@ -155,32 +155,36 @@
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1: clicking something Adjacent
else
UnarmedAttack(A)
UnarmedAttack(A, 1)
return
else // non-adjacent click
if(W)
W.afterattack(A,src,0,params) // 0: not Adjacent
else
if((LASER in mutations) && a_intent == "harm")
LaserEyes(A) // moved into a proc below
else if(TK in mutations)
switch(get_dist(src,A))
if(1 to 5) // not adjacent may mean blocked by window
next_move += 2
if(5 to 7)
next_move += 5
if(8 to 15)
next_move += 10
if(16 to 128)
return
A.attack_tk(src)
RangedAttack(A, params)
return
// attack_hand, attack_paw, etc
/mob/proc/UnarmedAttack(var/atom/A)
// translates into attack_hand, attack_paw, etc. proximity_flag should NOT be true if you are not adjacent (telekinesis)
/mob/proc/UnarmedAttack(var/atom/A, var/proximity_flag)
return
// unarmed and at range - laser eyes, telekinesis, and mob special abilities
/mob/proc/RangedAttack(var/atom/A, var/params)
if((LASER in mutations) && a_intent == "harm")
LaserEyes(A) // moved into a proc below
else if(TK in mutations)
switch(get_dist(src,A))
if(1 to 5) // not adjacent may mean blocked by window
next_move += 2
if(5 to 7)
next_move += 5
if(8 to 15)
next_move += 10
if(16 to 128)
return
A.attack_tk(src)
// hand_h, hand_p, etc - these are almost entirely unused
/mob/proc/RestrainedClickOn(var/atom/A)
return
+30 -1
View File
@@ -1,6 +1,15 @@
// Humans
/mob/living/carbon/human/UnarmedAttack(var/atom/A)
/mob/living/carbon/human/UnarmedAttack(var/atom/A, var/proximity)
var/obj/item/clothing/gloves/G = gloves // not typecast specifically enough in defines
// Special glove functions:
// If the gloves do anything, have them return 1 to stop
// normal attack_hand() here.
if(proximity && istype(G) && G.Touch(A,1))
return
A.attack_hand(src)
/atom/proc/attack_hand(mob/user as mob)
return
@@ -10,6 +19,26 @@
/atom/proc/hand_h(mob/user as mob) //human (hand) - restrained
return
/mob/living/carbon/human/RangedAttack(var/atom/A)
var/obj/item/clothing/gloves/G = gloves
if((LASER in mutations) && a_intent == "harm")
LaserEyes(A) // moved into a proc below
else if(istype(G) && G.Touch(A,0)) // for magic gloves
return
else if(TK in mutations)
switch(get_dist(src,A))
if(1 to 5) // not adjacent may mean blocked by window
next_move += 2
if(5 to 7)
next_move += 5
if(8 to 15)
next_move += 10
if(16 to 128)
return
A.attack_tk(src)
// Animals & All Unspecified
/mob/living/UnarmedAttack(var/atom/A)
+3 -5
View File
@@ -53,7 +53,7 @@
layer = 20
var/last_throw = 0
var/obj/focus = null
var/atom/movable/focus = null
var/mob/living/host = null
@@ -114,10 +114,8 @@
proc/focus_object(var/obj/target, var/mob/living/user)
if(!istype(target,/obj)) return//Cant throw non objects atm might let it do mobs later
if(target.anchored)
target.attack_hand(user) // you can use shit now!
return//No throwing anchored things
if(!isturf(target.loc))
if(target.anchored || !isturf(target.loc))
del src
return
focus = target
update_icon()
-9
View File
@@ -180,15 +180,6 @@
A.transfer_ai("INACTIVE","AICARD",src,user)
return
attack_hand(var/mob/user as mob)
if(ishuman(user))//Checks to see if they are ninja
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
if(user:wear_suit:s_control)
user:wear_suit:transfer_ai("INACTIVE","NINJASUIT",src,user)
else
user << "\red <b>ERROR</b>: \black Remote access channel disabled."
return
/*
This is a good place for AI-related object verbs so I'm sticking it here.
If adding stuff to this, don't forget that an AI need to cancel_camera() whenever it physically moves to a different location.
-8
View File
@@ -60,14 +60,6 @@
if(..())
return
if(ishuman(user))//Checks to see if they are ninja
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
if(user:wear_suit:s_control)
user:wear_suit.transfer_ai("AIFIXER","NINJASUIT",src,user)
else
user << "\red <b>ERROR</b>: \black Remote access channel disabled."
return
user.set_machine(src)
var/dat = ""
-5
View File
@@ -417,11 +417,6 @@
/obj/mecha/attack_hand(mob/user as mob)
src.log_message("Attack by hand/paw. Attacker - [user].",1)
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("MECHA",src,user:wear_suit)
return
if ((HULK in user.mutations) && !prob(src.deflect_chance))
src.take_damage(15)
src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST))
+4
View File
@@ -59,6 +59,10 @@ BLIND // can't see anything
..()
return
// Called just before an attack_hand(), in mob/UnarmedAttack()
/obj/item/clothing/gloves/proc/Touch(var/atom/A, var/proximity)
return 0 // return 1 to cancel attack_hand()
//Head
/obj/item/clothing/head
name = "head"
@@ -1,14 +1,3 @@
/obj/item/clothing/gloves/space_ninja
desc = "These nano-enhanced gloves insulate from electricity and provide fire resistance."
name = "ninja gloves"
icon_state = "s-ninja"
item_state = "s-ninja"
siemens_coefficient = 0
var/draining = 0
var/candrain = 0
var/mindrain = 200
var/maxdrain = 400
/obj/item/clothing/gloves/captain
desc = "Regal blue gloves, with a nice gold trim. Swanky."
name = "captain's gloves"
+110
View File
@@ -0,0 +1,110 @@
/*
Dear ninja gloves
This isn't because I like you
this is because your father is a bastard
...
I guess you're a little cool.
-Sayu
*/
/obj/item/clothing/gloves/space_ninja
desc = "These nano-enhanced gloves insulate from electricity and provide fire resistance."
name = "ninja gloves"
icon_state = "s-ninja"
item_state = "s-ninja"
siemens_coefficient = 0
var/draining = 0
var/candrain = 0
var/mindrain = 200
var/maxdrain = 400
/*
This runs the gamut of what ninja gloves can do
The other option would be a dedicated ninja touch bullshit proc on everything
For the drain proc, see events/ninja.dm
*/
/obj/item/clothing/gloves/space_ninja/Touch(var/atom/A,var/proximity)
if(!candrain || draining) return 0
var/mob/living/carbon/human/H = loc
if(!istype(H)) return 0 // what
var/obj/item/clothing/suit/space/space_ninja/suit = H.wear_suit
if(!istype(suit)) return 0
if(isturf(A)) return 0
if(!proximity) // todo: you could add ninja stars or computer hacking here
return 0
// Move an AI into and out of things
if(istype(A,/mob/living/silicon/ai))
if(suit.s_control)
A.add_fingerprint(H)
suit.transfer_ai("AICORE", "NINJASUIT", A, H)
return 1
else
H << "\red <b>ERROR</b>: \black Remote access channel disabled."
return 0
if(istype(A,/obj/structure/AIcore/deactivated))
if(suit.s_control)
A.add_fingerprint(H)
suit.transfer_ai("INACTIVE","NINJASUIT",A, H)
return 1
else
H << "\red <b>ERROR</b>: \black Remote access channel disabled."
return 0
if(istype(A,/obj/machinery/computer/aifixer))
if(suit.s_control)
A.add_fingerprint(H)
suit.transfer_ai("AIFIXER","NINJASUIT",A, H)
return 1
else
H << "\red <b>ERROR</b>: \black Remote access channel disabled."
return 0
// steal energy from powered things
if(istype(A,/mob/living/silicon/robot))
A.add_fingerprint(H)
drain("CYBORG",A,suit)
return 1
if(istype(A,/obj/machinery/power/apc))
A.add_fingerprint(H)
drain("APC",A,suit)
return 1
if(istype(A,/obj/structure/cable))
A.add_fingerprint(H)
drain("WIRE",A,suit)
return 1
if(istype(A,/obj/structure/grille))
var/obj/structure/cable/C = locate() in A.loc
if(C)
drain("WIRE",C,suit)
return 1
if(istype(A,/obj/machinery/power/smes))
A.add_fingerprint(H)
drain("SMES",A,suit)
return 1
if(istype(A,/obj/mecha))
A.add_fingerprint(H)
drain("MECHA",A,suit)
return 1
// download research
if(istype(A,/obj/machinery/computer/rdconsole))
A.add_fingerprint(H)
drain("RESEARCH",A,suit)
return 1
if(istype(A,/obj/machinery/r_n_d/server))
A.add_fingerprint(H)
var/obj/machinery/r_n_d/server/S = A
if(S.disabled)
return 1
if(S.shocked)
S.shock(H,50)
return 1
drain("RESEARCH",A,suit)
return 1
-10
View File
@@ -406,16 +406,6 @@ var/list/ai_list = list()
O.show_message(text("\red <B>[] took a swipe at []!</B>", M, src), 1)
return
/mob/living/silicon/ai/attack_hand(mob/living/carbon/M as mob)
if(ishuman(M))//Checks to see if they are ninja
if(istype(M:gloves, /obj/item/clothing/gloves/space_ninja)&&M:gloves:candrain&&!M:gloves:draining)
if(M:wear_suit:s_control)
M:wear_suit:transfer_ai("AICORE", "NINJASUIT", src, M)
else
M << "\red <b>ERROR</b>: \black Remote access channel disabled."
return
/mob/living/silicon/ai/attack_animal(mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0)
M.emote("[M.friendly] [src]")
@@ -734,12 +734,6 @@
user.visible_message("<span class='notice'>[user] pets [src]!</span>", \
"<span class='notice'>You pet [src]!</span>")
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("CYBORG",src,user:wear_suit)
return
/mob/living/silicon/robot/attack_paw(mob/user)
return attack_hand(user)
-5
View File
@@ -452,11 +452,6 @@
return
if(stat & (BROKEN|MAINT))
return
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("APC",src,user:wear_suit)
return
// do APC interaction
user.set_machine(src)
src.interact(user)
-5
View File
@@ -109,11 +109,6 @@
/obj/structure/cable/proc/get_powernet() //TODO: remove this as it is obsolete
return powernet
/obj/structure/cable/attack_hand(mob/user)
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("WIRE",src,user:wear_suit)
return
/obj/structure/cable/attack_tk(mob/user)
return
+5 -2
View File
@@ -63,8 +63,11 @@
/obj/item/weapon/cell/attack_self(mob/user as mob)
src.add_fingerprint(user)
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("CELL",src,user:wear_suit)
var/mob/living/carbon/human/H = user
var/obj/item/clothing/gloves/space_ninja/SNG = H.gloves
if(!istype(SNG) || !SNG.candrain || !SNG.draining) return
SNG.drain("CELL",src,H.wear_suit)
return
/obj/item/weapon/cell/attackby(obj/item/W, mob/user)
-5
View File
@@ -168,11 +168,6 @@
/obj/machinery/power/smes/attack_hand(mob/user)
add_fingerprint(user)
if(stat & BROKEN) return
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("SMES",src,user:wear_suit)
return
interact(user)
-5
View File
@@ -545,11 +545,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(stat & (BROKEN|NOPOWER))
return
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("RESEARCH",src,user:wear_suit)
return
user.set_machine(src)
var/dat = ""
files.RefreshResearch()
+1 -7
View File
@@ -154,19 +154,13 @@
del(src)
return 1
/obj/machinery/r_n_d/server/attack_hand(mob/user as mob)
/obj/machinery/r_n_d/server/attack_hand(mob/user as mob) // I guess only exists to stop ninjas or hell does it even work I dunno. See also ninja gloves.
if (disabled)
return
if (shocked)
shock(user,50)
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("RESEARCH",src,user:wear_suit)
return
/obj/machinery/r_n_d/server/centcom
name = "Centcom Central R&D Database"
server_id = -1
+1
View File
@@ -713,6 +713,7 @@
#include "code\modules\clothing\gloves\boxing.dm"
#include "code\modules\clothing\gloves\color.dm"
#include "code\modules\clothing\gloves\miscellaneous.dm"
#include "code\modules\clothing\gloves\ninja.dm"
#include "code\modules\clothing\head\collectable.dm"
#include "code\modules\clothing\head\hardhat.dm"
#include "code\modules\clothing\head\helmet.dm"