diff --git a/Code/Machinery/Atmoalter/canister.dm b/Code/Machinery/Atmoalter/canister.dm
index 9fd7047..e1ad6ee 100644
--- a/Code/Machinery/Atmoalter/canister.dm
+++ b/Code/Machinery/Atmoalter/canister.dm
@@ -252,7 +252,7 @@ Pipe Valve Status: [ct]
// Process topic link from interaction window
Topic(href, href_list)
- usr.client_mob() << "Topic on canister, usr is [usr], src is [src], usr.client_mob() is [usr.client_mob()], href is ([href]), href_list is ([href_list])."
+ //debug message: //usr.client_mob() << "Topic on canister, usr is [usr], src is [src], usr.client_mob() is [usr.client_mob()], href is ([href]), href_list is ([href_list])."
..()
if (usr.stat || usr.restrained())
diff --git a/Code/Machinery/Computer/atmosphere.dm b/Code/Machinery/Computer/atmosphere.dm
index 73c2096..3d806ee 100644
--- a/Code/Machinery/Computer/atmosphere.dm
+++ b/Code/Machinery/Computer/atmosphere.dm
@@ -57,8 +57,11 @@ obj/machinery/computer/atmosphere
verb/siphon_all()
set src in oview(1)
if(stat & NOPOWER) return
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
+
usr.client_mob() << "Starting all siphon systems."
for(var/obj/machinery/atmoalter/siphs/S in src.returnarea())
S.reset(1, 0)
@@ -70,7 +73,9 @@ obj/machinery/computer/atmosphere
verb/stop_all()
set src in oview(1)
if(stat & NOPOWER) return
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
usr.client_mob() << "Stopping all siphon systems."
for(var/obj/machinery/atmoalter/siphs/S in src.returnarea())
@@ -83,7 +88,9 @@ obj/machinery/computer/atmosphere
verb/auto_on()
set src in oview(1)
if(stat & NOPOWER) return
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
usr.client_mob() << "Starting automatic air control systems."
for(var/obj/machinery/atmoalter/siphs/S in src.returnarea())
@@ -97,7 +104,9 @@ obj/machinery/computer/atmosphere
set src in oview(1)
if(stat & NOPOWER) return
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
usr.client_mob() << "Releasing all scrubber toxins."
for(var/obj/machinery/atmoalter/siphs/scrubbers/S in src.returnarea())
@@ -110,7 +119,9 @@ obj/machinery/computer/atmosphere
verb/release_all()
set src in oview(1)
if(stat & NOPOWER) return
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
usr.client_mob() << "Releasing all stored air."
for(var/obj/machinery/atmoalter/siphs/S in src.returnarea())
diff --git a/Code/Machinery/Computer/communications.dm b/Code/Machinery/Computer/communications.dm
index b82c183..3ff9d37 100644
--- a/Code/Machinery/Computer/communications.dm
+++ b/Code/Machinery/Computer/communications.dm
@@ -14,6 +14,10 @@ obj/machinery/computer/communications
verb/call_shuttle()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
src.add_fingerprint(usr)
if(stat & NOPOWER) return
call_shuttle_proc(usr)
@@ -22,6 +26,10 @@ obj/machinery/computer/communications
verb/cancel_call()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
src.add_fingerprint(usr)
if(stat & NOPOWER) return
cancel_call_proc(usr)
diff --git a/Code/Machinery/Computer/data.dm b/Code/Machinery/Computer/data.dm
index 9b695cd..d58e599 100644
--- a/Code/Machinery/Computer/data.dm
+++ b/Code/Machinery/Computer/data.dm
@@ -19,6 +19,10 @@ obj/machinery/computer/data
verb/display()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
for(var/x in src.topics)
usr.client_mob() << "[x], \..."
@@ -32,6 +36,10 @@ obj/machinery/computer/data
verb/read(topic as text)
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
if (src.topics[text("[]", topic)])
usr.client_mob() << "[topic]\n\t [src.topics["[topic]"]]"
@@ -80,6 +88,10 @@ obj/machinery/computer/data
display()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
usr.client_mob() << "Research Information:"
..()
@@ -107,6 +119,10 @@ obj/machinery/computer/data
display()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
usr.client_mob() << "Research Log:"
..()
diff --git a/Code/Machinery/Computer/hologram.dm b/Code/Machinery/Computer/hologram.dm
index 6be021f..a949d6a 100644
--- a/Code/Machinery/Computer/hologram.dm
+++ b/Code/Machinery/Computer/hologram.dm
@@ -131,7 +131,9 @@ Blue (0-255): \[0\] Restabilizing prison shuttle atmosphere!"
diff --git a/Code/Machinery/Computer/shuttle.dm b/Code/Machinery/Computer/shuttle.dm
index 4efb57f..f5098f7 100644
--- a/Code/Machinery/Computer/shuttle.dm
+++ b/Code/Machinery/Computer/shuttle.dm
@@ -16,11 +16,15 @@ obj/machinery/computer/shuttle
access = "2000" // ID card access level needed to authorize
- // Restabalize verb
+ // Restabilize verb
// Set all shuttle locations to standard atmosphere
- verb/restabalize()
+ verb/restabilize()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
world << "\red Restabilizing shuttle atmosphere!"
var/A = locate(/area/shuttle)
@@ -55,6 +59,10 @@ obj/machinery/computer/shuttle
verb/hijack()
set src in oview(1)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
if ((!( ticker ) || ticker.shuttle_location != shuttle_z))
return
diff --git a/Code/Machinery/cryocell.dm b/Code/Machinery/cryocell.dm
index 01f9727..e6dfe8f 100644
--- a/Code/Machinery/cryocell.dm
+++ b/Code/Machinery/cryocell.dm
@@ -155,9 +155,11 @@ obj/machinery/cryo_cell
verb/move_eject()
set src in oview(1)
-
- if (usr.stat != 0)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
return
+
src.go_out()
add_fingerprint(usr)
@@ -168,7 +170,10 @@ obj/machinery/cryo_cell
verb/move_inside()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
if (usr.stat != 0 || stat & NOPOWER)
return
if (src.occupant)
@@ -227,9 +232,9 @@ obj/machinery/cryo_cell
// AI interact
attack_ai(mob/user)
return src.attack_hand(user)
-
+
// Human interact, show status window of machine and occupant
-
+
attack_hand(mob/user)
if(stat & NOPOWER)
@@ -347,7 +352,7 @@ obj/machinery/cryo_cell
else
usr.client_mob() << "User too far?"
return
-
+
// Called to remove the occupant of a cell
// Reset the view back to normal
diff --git a/Code/Machinery/pod.dm b/Code/Machinery/pod.dm
index 27ec197..3c75223 100644
--- a/Code/Machinery/pod.dm
+++ b/Code/Machinery/pod.dm
@@ -84,7 +84,9 @@ obj/machinery/pod
verb/eject()
set src = usr.loc
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
var/mob/M = usr
M.loc = src.loc
@@ -99,14 +101,16 @@ obj/machinery/pod
verb/board()
set src in oview(1)
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
var/mob/M = usr
if (M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.loc = src
- return
+
// Load pod - whatever the player is pulling gets loaded into the pod (including other players)
@@ -125,6 +129,15 @@ obj/machinery/pod
if (ismob(H.pulling))
var/mob/M = H.pulling
+ var/result = src.canReach(H, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
+ return
+ result = H.pulling.canReach(H, null, 1)
+ if (result==0)
+ usr << "You can't reach [H.pulling]."
+ return
+
if (M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
@@ -141,8 +154,15 @@ obj/machinery/pod
verb/unload(var/atom/movable/A in src.contents)
set src in oview(1)
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
+ result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
+ return
+
if (istype(A, /atom/movable))
A.loc = src.loc
for(var/mob/O in viewers(src, null))
diff --git a/Code/Machinery/recon.dm b/Code/Machinery/recon.dm
index 7c31601..73c5d9d 100644
--- a/Code/Machinery/recon.dm
+++ b/Code/Machinery/recon.dm
@@ -79,7 +79,9 @@ obj/machinery/recon
verb/eject()
set src = usr.loc
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
var/mob/M = usr
M.loc = src.loc
@@ -93,7 +95,9 @@ obj/machinery/recon
verb/board()
set src in oview(1)
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
if (locate(/mob, src))
usr.client_mob() << "There is no room! You can only fit one person."
@@ -111,7 +115,9 @@ obj/machinery/recon
verb/load()
set src in oview(1)
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
if ((( istype(usr, /mob/human) ) && (!( ticker ) || (ticker && ticker.mode != "monkey"))))
var/mob/human/H = usr
@@ -141,7 +147,9 @@ obj/machinery/recon
verb/unload(atom/movable/A in src)
set src in oview(1)
- if (usr.stat)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
if (istype(A, /atom/movable))
A.loc = src.loc
diff --git a/Code/Machinery/sleeper.dm b/Code/Machinery/sleeper.dm
index 24e745a..6413ea2 100644
--- a/Code/Machinery/sleeper.dm
+++ b/Code/Machinery/sleeper.dm
@@ -30,7 +30,9 @@ obj/machinery/sleeper
verb/eject()
set src in oview(1)
- if (usr.stat != 0)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
src.go_out()
add_fingerprint(usr)
@@ -43,7 +45,9 @@ obj/machinery/sleeper
verb/move_inside()
set src in oview(1)
- if (usr.stat != 0)
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr << "You can't reach [src]."
return
if (src.occupant)
usr.client_mob() << "\blue The sleeper is already occupied!"
diff --git a/Code/demo.dm b/Code/demo.dm
index 249727d..f8492b0 100644
--- a/Code/demo.dm
+++ b/Code/demo.dm
@@ -115,7 +115,7 @@
M.stunned = time
M.stat = 1
for(var/mob/O in viewers(M, null))
- if ((!( O.blinded )))
+ if (O.hasClient() && (!( O.blinded )))
O.client_mob() << text("\red [] has been knocked unconscious!", M)
//Foreach goto(169)
M.client_mob() << text("\red This was a []% hit. Roleplay it! (personality/memory change if the hit was severe enough)", time * 100 / 120)
@@ -1512,7 +1512,11 @@
/obj/stool/chair/e_chair/verb/toggle_power()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
if ((usr.stat || usr.restrained() || !( usr.canmove ) || usr.lying))
return
src.on = !( src.on )
@@ -1618,7 +1622,11 @@
/obj/stool/chair/verb/rotate()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
src.dir = turn(src.dir, 90)
if (src.dir == NORTH)
src.layer = FLY_LAYER
@@ -1661,10 +1669,9 @@
/obj/stool/chair/attack_hand(mob/user as mob)
if (istype(user, /mob/drone))
- if (istype(user, /mob/drone))
- if (user.equipped())
- user.client_mob() << "You need to be using the gripper to buckle someone in."
- return
+ if (user.equipped())
+ user.client_mob() << "You need to be using the gripper to buckle someone in."
+ return
for(var/mob/M in src.loc)
if (M.buckled)
if (M != user)
@@ -1957,7 +1964,11 @@
/obj/window/verb/rotate()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
if (src.anchored)
usr.client_mob() << "It is fastened to the floor; therefore, you can't rotate it!"
return 0
diff --git a/Code/dna.dm b/Code/dna.dm
index c4891f9..a13dd64 100644
--- a/Code/dna.dm
+++ b/Code/dna.dm
@@ -246,7 +246,11 @@
/obj/machinery/dna_scanner/verb/move_inside()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
if (usr.stat != 0)
return
if (src.occupant)
@@ -718,7 +722,7 @@
/obj/machinery/restruct/verb/eject()
set src in oview(1)
-
+
if (usr.stat != 0)
return
src.go_out()
@@ -727,7 +731,11 @@
/obj/machinery/restruct/verb/operate()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
src.add_fingerprint(usr)
if ((src.occupant && src.occupant.primary))
switch(src.occupant.primary.spec_identity)
@@ -884,7 +892,11 @@
/obj/machinery/restruct/verb/move_inside()
set src in oview(1)
-
+ var/result = src.canReach(usr, null, 1)
+ if (result==0)
+ usr.client_mob() << "You can't reach [src]."
+ return
+
if (usr.stat != 0)
return
if (src.occupant)
diff --git a/Code/items.dm b/Code/items.dm
index 1ce450b..1ff11b2 100644
--- a/Code/items.dm
+++ b/Code/items.dm
@@ -778,7 +778,6 @@
for(var/obj/item/weapon/cloaking_device/S in M)
S.active = 0
S.icon_state = "shield0"
- //Foreach goto(72)
if ((get_dist(M, T) <= 2 || src.loc == M.loc || src.loc == M))
flick("e_flash", M.flash)
M.stunned = 10
@@ -928,7 +927,6 @@
for(var/obj/item/weapon/cloaking_device/S in M)
S.active = 0
S.icon_state = "shield0"
- //Foreach goto(201)
if (M.hasClient())
var/mob/CM = M.client_mob()
var/safety = null
@@ -4357,24 +4355,43 @@
//Foreach goto(203)
for(var/mob/O in crackle)
O.show_message(text("\icon[] Crackle,Crackle", src), 2)
- //Foreach goto(233)
+ //Foreach goto(233)
+ var/speakerType = M.type
if (istype(M, /mob/human) || (istype(M, /mob/ai)))
for(var/mob/O in receive)
- if (istype(O, /mob/human) || (istype(O, /mob/ai)))
+ var/mobType = O.type
+ if (istype(O, /mob/drone))
+ var/mob/drone/Mdrone = O
+ var/mob/Mowner = Mdrone.controlledBy
+ if (Mowner!=null)
+ mobType = Mowner.type
+ if (istype(O, /mob/human) || (istype(O, /mob/ai)) || (istype(O, /mob/drone) && mobType==speakerType))
O.show_message(text("[]-\icon[]\[[]\]-broadcasts: []", M.rname, src, src.freq, msg), 2)
else
O.show_message(text("[]-\icon[]\[[]\]-broadcasts: []", M.rname, src, src.freq, stars(msg)), 2)
//Foreach goto(284)
if (src.freq == 5)
for(var/mob/O in receive)
- if (istype(O, /mob/human) || (istype(O, /mob/ai)))
+ var/mobType = O.type
+ if (istype(O, /mob/drone))
+ var/mob/drone/Mdrone = O
+ var/mob/Mowner = Mdrone.controlledBy
+ if (Mowner!=null)
+ mobType = Mowner.type
+ if (istype(O, /mob/human) || (istype(O, /mob/ai)) || (istype(O, /mob/drone) && istype(mobType, speakerType)))
O.show_message(text("[]-\icon[]\[[]\]-broadcasts (over PA): []", M.rname, src, src.freq, msg), 2)
else
O.show_message(text("[]-\icon[]\[[]\]-broadcasts (over PA): []", M.rname, src, src.freq, stars(msg)), 2)
//Foreach goto(393)
else
for(var/mob/O in receive)
- if (istype(O, M))
+ var/mobType = O.type
+ if (istype(O, /mob/drone))
+ var/mob/drone/Mdrone = O
+ var/mob/Mowner = Mdrone.controlledBy
+ if (Mowner!=null)
+ mobType = Mowner.type
+ if (istype(O, M) || (istype(O, /mob/drone) && istype(mobType, speakerType)))
O.show_message(text("The monkey-\icon[]\[[]\]-broadcasts: []", src, src.freq, msg), 2)
else
O.show_message(text("The monkey-\icon[]\[[]\]-broadcasts: chimpering", src, src.freq), 2)
@@ -4897,7 +4914,7 @@
M.health = 100 - M.oxyloss - M.toxloss - M.fireloss - M.bruteloss
src.amount--
else
- usr.client_mob() << text("\red The [] only works on humans.", src)
+ user.client_mob() << text("\red The [] only works on humans.", src)
return
/obj/item/weapon/brutepack/examine()
@@ -5654,6 +5671,183 @@
return
..()
return
+
+/*
+ Proc name: canReach
+ Purpose: To indicate whether something - a turf, a mob, an object, whatever - can be reached from the user's location.
+ Parameters:
+ user - the mob who will be doing the attempted touching
+ usingWeapon - the weapon the mob is using to reach src. This is important if they're actually trying to *shoot* someone.
+ ignoreNextMoveTime - Normally this would be 0, and if world.time wasn't < next_time, the proc would return 0. If it was < next_time, prev_time and next_time would be changed (next_time being set to world.time + 10).
+ If, instead, ignoreNextMoveTime is 1, next_time, world.time, and prev_time will not be examined or changed.
+
+ Return value:
+ This returns 0 if, for some reason, the user can't reach src. If not, the return value is a set of 3 bitflags:
+ 1: CANREACH_USINGWEAPON: If set, user is using a "weapon" (passed in as usingWeapon) on src. (This is kind of semi-useless to check, since the only case currently where this would be 0 when you had passed in a weapon would be if the user was a drone, and the weapon was the AI interface, and the drone was controlled by the AI player, in which case if you cared you would already be checking for it anyways because you would need to be changing the user and setting the weapon to null yourself.)
+ 2: CANREACH_CANTOUCH: If set, src can be touched by user (which was called t5 in DblClick). This is set if (get_dist(src, user) <= 1 || src.loc == user), or if the user is the AI, or if the user is a drone controlled by an AI using the AI interface tool.
+ 4: CANREACH_ALLOWED: If set, src is reachable by user, or the attempt is allowed for another reason. This is always set if the return value is valid. This differs from cantouch because this will be set if the user is using a gun on someone distant, whereas cantouch will not be set in that case. It's also theoretically possible to have a return value which contains only 4 for some /obj/screen objects, if the code in /atom/DblClick wasn't just overly paranoid.
+
+ Valid combinations of those are: 0, 4, 5, 6, or 7. (You won't ever have 1 or 2 set if 4 isn't set)
+
+ Detail on what's checked:
+ The user has to be able to move unless they are an AI, and their stat has to be 0 (alive and awake).
+ If the src is not in user's inventory, we MIGHT return 0:
+ If src is not a turf, and it is not on a turf, and it is inside something else which is not in a turf:
+ We return 0, it cannot be reached.
+ If not, if the user is inside some item instead of on a turf, and src is not in the same place as the user, and src is not a screen object, and src is not inside an item in user's inventory:
+ We return 0, it cannot be reached.
+ (Otherwise we continue)
+ And some other difficult to explain stuff is done here.
+
+ Either CANREACH_CANTOUCH will be true, or the user must be using a weapon which has flag 16 set, or src is an /obj/screen.
+ Checks to determine if there are obstacles in the way (windows, etc) are done unless src is an /obj/screen.
+*/
+
+#define CANREACH_USINGWEAPON 1
+#define CANREACH_CANTOUCH 2
+#define CANREACH_ALLOWED 4
+
+/* Note: CANREACH_USINGWEAPON and CANREACH_CANTOUCH are not referenced in canReach because those are set by just a something&1 and a (something&1)<<1 */
+
+/atom/proc/canReach(mob/user, obj/item/weapon/usingWeapon, ignoreNextMoveTime)
+ if (((!user.canmove) && (!istype(user, /mob/ai))) || user.stat != 0)
+ return 0
+ /* This line broke my mental parser. --Stephen001 */
+ if ((!(src in user.contents) && (((!(isturf(src)) && (!(isturf(src.loc)) && (src.loc && !(isturf(src.loc.loc))))) || !(isturf(user.loc))) && (src.loc != user.loc && (!(istype(src, /obj/screen)) && !(user.contents.Find(src.loc)))))))
+ return 0
+ /* Breaks double-clicking on an equipment slot to place an item there, unfortunately. */
+ /*
+ //If the dclicked item is not in our inventory
+ if (!(src in user.contents))
+ //If the item is not a turf, and it is not on a turf, and it is inside something else which is not in a turf
+ if (!(isturf(src)) && (!(isturf(src.loc)) && (src.loc && !(isturf(src.loc.loc)))))
+ return
+ //If not, if we are inside some item instead of on a turf, and the dclicked item is not in the same place as us, and the dclicked item is not a screen object, and the dclicked item is not inside an item in our inventory.
+ else if ((!(isturf(user.loc))) && (src.loc != user.loc && (!(istype(src, /obj/screen)) && !(user.contents.Find(src.loc)))))
+ return
+ */
+
+ /* That's checking to see if it's being held/worn or something like that, methinks */
+ var/t5 = (get_dist(src, user) <= 1 || src.loc == user)
+ if (istype(user, /mob/ai))
+ t5 = 1
+ else if (istype(user, /mob/drone))
+ if (user:selectedTool == user:aiInterface)
+ if (istype(user:controlledBy, /mob/ai))
+ t5 = 1
+ user = user:controlledBy
+ usingWeapon = null
+
+ if ((istype(src, /obj/item/weapon/organ) && src in user.contents))
+ var/mob/human/H = user
+ if (istype(user, /mob/human))
+ if (!(src == H.l_store || src == H.r_store))
+ return 0
+ else
+ return 0
+ /* Suggested fix by shadowlord13 for Bug #1952091. --Stephen001 */
+ var/turf/turfLoc = (istype(src, /turf) ? src : src.loc)
+
+ /* Seems like a pretty important expression. Dare I fathom what it checks? --Stephen001 */
+ /* flag 16 in this case apparently disables the distance check and the alternate 'is in contents' check in the var/t5 line.
+ It's used on guns, for instance. --shadowlord13 */
+ if (((t5 || (usingWeapon && (usingWeapon.flags & 16))) && !(istype(src, /obj/screen))))
+ if (ignoreNextMoveTime!=0)
+ if (user.next_move < world.time)
+ user.prev_move = user.next_move
+ user.next_move = world.time + 10
+ else
+ return 0
+ if ((turfLoc && (get_dist(src, user) < 2 || turfLoc == user.loc)))
+ var/direct = get_dir(user, src)
+ var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy(user.loc)
+ var/ok = 0
+ if ((direct - 1) & direct)
+ var/turf/T
+ switch(direct)
+ if(5.0)
+ T = get_step(user, NORTH)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ else
+ T = get_step(user, EAST)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ if(6.0)
+ T = get_step(user, SOUTH)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ else
+ T = get_step(user, EAST)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ if(9.0)
+ T = get_step(user, NORTH)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ else
+ T = get_step(user, WEST)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ if(10.0)
+ T = get_step(user, SOUTH)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ else
+ T = get_step(user, WEST)
+ if (T.Enter(D, src))
+ D.loc = T
+ T = turfLoc
+ if (T.Enter(D, src))
+ ok = 1
+ else
+ else
+ if (turfLoc.Enter(D, src))
+ ok = 1
+ else
+ if ((src.flags & 512 && get_dir(src, user) & src.dir))
+ ok = 1
+ if (user.loc != turfLoc)
+ for(var/atom/A in user.loc)
+ if ((!A.CheckExit(user, src.loc)) && A != user)
+ ok = 0
+ del(D)
+ if (!(ok))
+ return 0
+ //user << "Debug message: usingWeapon [usingWeapon] t5 [t5] src [src] user [user]"
+
+ return (((t5!=0)&1)<<1) | ((usingWeapon!=0)&1) | CANREACH_ALLOWED
+ else
+ if (istype(src, /obj/screen))
+ if (ignoreNextMoveTime!=0)
+ if (user.next_move < world.time)
+ user.prev_move = user.next_move
+ user.next_move = world.time + 10
+ else
+ return 0
+ return (((t5!=0)&1)<<1) | ((usingWeapon!=0)&1) | CANREACH_ALLOWED
+ return 0
/atom/Click()
if (!usr.disable_one_click)
@@ -5679,197 +5873,53 @@
var/obj/item/weapon/tool = user:checkIsOurTool(src)
if (tool!=null)
if (tool==W)
- user.client_mob() << "user clicked their active tool."
+ //user.client_mob() << "Debug message: user clicked their active tool."
spawn(0)
W.attack_self(user)
user:updateToolIcon(W)
return
else
- user.client_mob() << "user switched tools from [W] to [tool]"
+ //user.client_mob() << "Debug message: user switched tools from [W] to [tool]"
user:selectTool(tool)
return
else
- user.client_mob() << "That's not one of our tools"
+ //user.client_mob() << "Debug message: That's not one of our tools"
user:pressIfDroneButton(src)
if (W == src)
- user.client_mob() << "user clicked their active item."
+ //user.client_mob() << "Debug message: user clicked their active item."
spawn(0) W.attack_self(user)
- return
+ return
- if (((!user.canmove) && (!istype(user, /mob/ai))) || user.stat != 0)
-
- return
- if ((!(src in user.contents) && (((!(isturf(src)) && (!(isturf(src.loc)) && (src.loc && !(isturf(src.loc.loc))))) || !(isturf(user.loc))) && (src.loc != user.loc && (!(istype(src, /obj/screen)) && !(user.contents.Find(src.loc)))))))
- return
- /* Breaks double-clicking on an equipment slot to place an item there, unfortunately. */
- /*
- // If the dclicked item is in our inventory
- if (!(src in user.contents))
- // If the item is not a turf, and it is not on a turf, and it is inside something else which is not in a turf
- if (!(isturf(src)) && (!(isturf(src.loc)) && (src.loc && !(isturf(src.loc.loc)))))
- return
- // If not, if we are inside some item instead of on a turf, and the dclicked item is not in the same place as us, and the dclicked item is not a screen object,
- // and the dclicked item is not inside an item in our inventory.
- else if ((!(isturf(user.loc))) && (src.loc != user.loc && (!(istype(src, /obj/screen)) && !(user.contents.Find(src.loc)))))
- return
- */
-
- /* That's checking to see if it's being held/worn or something like that, methinks. */
- var/t5 = (get_dist(src, user) <= 1 || src.loc == user)
- if (istype(user, /mob/ai))
- t5 = 1
- else if (istype(user, /mob/drone))
+ var/retval = src.canReach(user, W, 0)
+
+ if (retval==0)
+ return
+
+ if (istype(user, /mob/drone))
if (user:selectedTool == user:aiInterface)
if (istype(user:controlledBy, /mob/ai))
- t5 = 1
user = user:controlledBy
W = null
-
- if ((istype(src, /obj/item/weapon/organ) && src in user.contents))
- var/mob/human/H = user
- user.client_mob() << "Betchya think you're really smart trying to remove your own body parts aren't ya!"
- if (istype(user, /mob/human))
- if (!(src == H.l_store || src == H.r_store))
- return
- else
- return
- /* Suggested fix for Bug #1952091. */
- var/turf/turfLoc = (istype(src, /turf) ? src : src.loc)
-
- /* flag 16 in this case apparently disables the distance check and the alternate 'is in contents' check in the var/t5 line. It's used on guns, for instance. */
- if (((t5 || (W && (W.flags & 16))) && !(istype(src, /obj/screen))))
- if (user.next_move < world.time)
- user.prev_move = user.next_move
- user.next_move = world.time + 10
- else
- return
- if ((turfLoc && (get_dist(src, user) < 2 || turfLoc == user.loc)))
- var/direct = get_dir(user, src)
- var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy(user.loc)
- var/ok = 0
- if ((direct - 1) & direct)
- var/turf/T
- switch(direct)
- if(5.0)
- T = get_step(user, NORTH)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- else
- T = get_step(user, EAST)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- if(6.0)
- T = get_step(user, SOUTH)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- else
- T = get_step(user, EAST)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- if(9.0)
- T = get_step(user, NORTH)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- else
- T = get_step(user, WEST)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- if(10.0)
- T = get_step(user, SOUTH)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- else
- T = get_step(user, WEST)
- if (T.Enter(D, src))
- D.loc = T
- T = turfLoc
- if (T.Enter(D, src))
- ok = 1
- else
- else
- if (turfLoc.Enter(D, src))
- ok = 1
- else
- if ((src.flags & 512 && get_dir(src, user) & src.dir))
- ok = 1
- if (user.loc != turfLoc)
- for(var/atom/A in user.loc)
- if ((!A.CheckExit(user, src.loc)) && A != user)
- ok = 0
- del(D)
- if (!(ok))
- return 0
- if (!user.restrained())
- if (W)
- if (t5)
- src.attackby(W, user)
+
+ if (!(retval & CANREACH_USINGWEAPON))
+ W = null
+
+ //if (((t5 || (usingWeapon && (usingWeapon.flags & 16))) && !(istype(src, /obj/screen))))
+
+ if (retval & CANREACH_ALLOWED)
+ if (!(istype(src, /obj/screen)))
+ if (!user.restrained())
if (W)
- W.afterattack(src, user, (t5 ? 1 : 0))
- else
- if (istype(user, /mob/human) || istype(user, /mob/drone))
- src.attack_hand(user, user.hand)
- else
- if (istype(user, /mob/monkey))
- src.attack_paw(user, user.hand)
- else
- if (istype(user, /mob/ai))
- src.attack_ai(user, user.hand)
- else
- if (istype(user, /mob/human))
- src.hand_h(user, user.hand)
- else
- if (istype(user, /mob/monkey))
- src.hand_p(user, user.hand)
- else
- if (istype(user, /mob/ai))
- src.hand_a(user, user.hand)
-
- else
- if (istype(src, /obj/screen))
- user.prev_move = user.next_move
- if (user.next_move < world.time)
- user.next_move = world.time + 10
- else
- return
- if (!( user.restrained() ))
- if ((W && !( istype(src, /obj/screen) )))
- src.attackby(W, user)
+ if (retval & CANREACH_CANTOUCH)
+ src.attackby(W, user)
if (W)
- W.afterattack(src, user)
+ W.afterattack(src, user, ((retval & CANREACH_CANTOUCH) ? 1 : 0))
else
- if (istype(user, /mob/human))
+ if (istype(user, /mob/human) || istype(user, /mob/drone))
src.attack_hand(user, user.hand)
else
if (istype(user, /mob/monkey))
src.attack_paw(user, user.hand)
- else
- if (istype(user, /mob/human))
- src.hand_h(user, user.hand)
- else
- if (istype(user, /mob/monkey))
- src.hand_p(user, user.hand)
- return
/obj/proc/updateDialog()
@@ -5893,4 +5943,10 @@
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
src:attack_self(M)
- AutoUpdateAI(src, 1)
+
+//Used for infra_sensor, etc
+/obj/proc/updateSelfDialog(atom/origin)
+ var/list/nearby = viewers(1, origin)
+ for(var/mob/M in nearby)
+ if (M.client)
+ src:attack_self(M)
diff --git a/Code/mob.dm b/Code/mob.dm
index b77ae09..253436f 100644
--- a/Code/mob.dm
+++ b/Code/mob.dm
@@ -1087,8 +1087,8 @@
if ((src.item && src.source.equipped() != src.item))
return
if ((src.source.restrained() || src.source.stat))
- return
-
+ return
+
switch(src.place)
if("mask")
if (src.target.wear_mask)
@@ -1866,7 +1866,7 @@
return
/mob/human/proc/monkeyize()
- if (src.currentDrone!=null)
+ if (src.currentDrone!=null)
src.currentDrone:releaseControl(0)
if (src.monkeyizing)
return
@@ -2385,8 +2385,8 @@
//src.paralysis += 1
src.show_message("\red The blob attacks you!")
- src.damage_anywhere(damage)
-
+ src.damage_anywhere(damage)
+
/mob/human/proc/damage_anywhere(damage)
var/list/zones = list("head","chest","chest", "diaper", "l_arm", "r_arm", "l_hand", "r_hand", "l_leg", "r_leg", "l_foot", "r_foot")
@@ -2732,68 +2732,68 @@
src.sdisabilities = 0
src.stat = 0
-*/
-
+*/
+
/* IMPORTANT NOTE: Both humans and drones have a copy of this code. If the code is modified to fix a bug or whatever, it will need to be modified in BOTH of them. Monkeys also have some of this code, but not all of it. (Moving the code into a shared method or two wasn't feasible because of where the ..() calls are and such) --shadowlord13 */
/mob/human/Move(a, b, flag)
- if (src.buckled)
- return
- if (src.restrained())
- src.pulling = null
- var/t7 = 1
- if (src.restrained())
- for(var/mob/M in range(src, 1))
- if ((M.pulling == src && M.stat == 0 && !( M.restrained() )))
- t7 = null
- //Foreach goto(62)
- if ((t7 && (src.pulling && ((get_dist(src, src.pulling) <= 1 || src.pulling.loc == src.loc) && (src.client && src.client.moving)))))
- var/turf/T = src.loc
- . = ..()
- if (!( isturf(src.pulling.loc) ))
- src.pulling = null
- return
- //////
- if (src.pulling.anchored)
- src.pulling = null
- return
- if (istype(src.pulling, /mob/drone) && config.walkable_not_pullable_drones)
- src.pulling = null
- return
- //////
- if (!( src.restrained() ))
- var/diag = get_dir(src, src.pulling)
- if ((diag - 1) & diag)
- else
- diag = null
- if ((get_dist(src, src.pulling) > 1 || diag))
- if (ismob(src.pulling))
- var/mob/M = src.pulling
- var/ok = 1
- if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
- if (prob(75))
- var/obj/item/weapon/grab/G = pick(M.grabbed_by)
- if (istype(G, /obj/item/weapon/grab))
- for(var/mob/O in viewers(M, null))
- O.show_message(text("\red [] has been pulled from []'s grip by []", G.affecting, G.assailant, src), 1)
- //Foreach goto(354)
- //G = null
- del(G)
- else
- ok = 0
- if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
- ok = 0
- if (ok)
- var/t = M.pulling
- M.pulling = null
- step(src.pulling, get_dir(src.pulling.loc, T))
- M.pulling = t
- else
- step(src.pulling, get_dir(src.pulling.loc, T))
- else
- src.pulling = null
- . = ..()
- if ((src.s_active && !( s_active in src.contents ) ))
- src.s_active.close(src)
+ if (src.buckled)
+ return
+ if (src.restrained())
+ src.pulling = null
+ var/t7 = 1
+ if (src.restrained())
+ for(var/mob/M in range(src, 1))
+ if ((M.pulling == src && M.stat == 0 && !( M.restrained() )))
+ t7 = null
+ //Foreach goto(62)
+ if ((t7 && (src.pulling && ((get_dist(src, src.pulling) <= 1 || src.pulling.loc == src.loc) && (src.client && src.client.moving)))))
+ var/turf/T = src.loc
+ . = ..()
+ if (!( isturf(src.pulling.loc) ))
+ src.pulling = null
+ return
+ //////
+ if (src.pulling.anchored)
+ src.pulling = null
+ return
+ if (istype(src.pulling, /mob/drone) && config.walkable_not_pullable_drones)
+ src.pulling = null
+ return
+ //////
+ if (!( src.restrained() ))
+ var/diag = get_dir(src, src.pulling)
+ if ((diag - 1) & diag)
+ else
+ diag = null
+ if ((get_dist(src, src.pulling) > 1 || diag))
+ if (ismob(src.pulling))
+ var/mob/M = src.pulling
+ var/ok = 1
+ if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
+ if (prob(75))
+ var/obj/item/weapon/grab/G = pick(M.grabbed_by)
+ if (istype(G, /obj/item/weapon/grab))
+ for(var/mob/O in viewers(M, null))
+ O.show_message(text("\red [] has been pulled from []'s grip by []", G.affecting, G.assailant, src), 1)
+ //Foreach goto(354)
+ //G = null
+ del(G)
+ else
+ ok = 0
+ if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
+ ok = 0
+ if (ok)
+ var/t = M.pulling
+ M.pulling = null
+ step(src.pulling, get_dir(src.pulling.loc, T))
+ M.pulling = t
+ else
+ step(src.pulling, get_dir(src.pulling.loc, T))
+ else
+ src.pulling = null
+ . = ..()
+ if ((src.s_active && !( s_active in src.contents ) ))
+ src.s_active.close(src)
return
/mob/human/examine()
@@ -2837,7 +2837,7 @@
/mob/human/Logout()
- if (src.droneTransitioning==1)
+ if (src.droneTransitioning==1)
return
if(config.logaccess) world.log << "LOGOUT: [src.key]"
if (!( src.start ))
@@ -2928,10 +2928,10 @@
return
/mob/human/Login()
- if (src.droneTransitioning==1)
- ..()
- return
-
+ if (src.droneTransitioning==1)
+ ..()
+ return
+
if(config.logaccess)
world.log << "LOGIN: [src.key] from [src.client.address]"
src.lastKnownIP = src.client.address
@@ -3057,6 +3057,9 @@
src.verbs += /proc/Vars
src << text("\blue []", world_message)
src << browse(text("[]", changes), "window=changes")
+ if (!( isturf(src.loc) ))
+ src.client.eye = src.loc
+ src.client.perspective = EYE_PERSPECTIVE
if (!( src.start ))
src.savefile_load()
ShowChoices()
@@ -3068,30 +3071,30 @@
//Foreach goto(1473)
src.loc = pick(L)
-
+
return
/mob/human/Bump(atom/movable/AM as mob|obj, yes)
- spawn( 0 )
- if ((!( yes ) || src.now_pushing))
- return
- ..()
+ spawn( 0 )
+ if ((!( yes ) || src.now_pushing))
+ return
+ ..()
src.PushingBump(AM, yes)
return
-
-/mob/proc/PushingBump(atom/movable/AM as mob|obj, yes)
- if (!( istype(AM, /atom/movable) ))
- return
- if (!( src.now_pushing ))
- src.now_pushing = 1
- if (!( AM.anchored ))
- /* If it's a drone and walkable_not_pullable_drones is set, you CAN'T pull it. --shadowlord13 */
- if (!(istype(src, /mob/drone) && config.walkable_not_pullable_drones))
- var/t = get_dir(src, AM)
- step(AM, t)
- src.now_pushing = null
- return
-
+
+/mob/proc/PushingBump(atom/movable/AM as mob|obj, yes)
+ if (!( istype(AM, /atom/movable) ))
+ return
+ if (!( src.now_pushing ))
+ src.now_pushing = 1
+ if (!( AM.anchored ))
+ /* If it's a drone and walkable_not_pullable_drones is set, you CAN'T pull it. --shadowlord13 */
+ if (!(istype(src, /mob/drone) && config.walkable_not_pullable_drones))
+ var/t = get_dir(src, AM)
+ step(AM, t)
+ src.now_pushing = null
+ return
+
/mob/human/death()
if (src.currentDrone!=null)
src.currentDrone:releaseControl()
@@ -3142,9 +3145,9 @@
if (src.shoes.chained)
tally += 15
else
- tally += -1.0
- if (src.pulling)
- if (istype(src.pulling, /mob/drone))
+ tally += -1.0
+ if (src.pulling)
+ if (istype(src.pulling, /mob/drone))
tally += 5
return tally
@@ -3698,7 +3701,7 @@
else
src.screenOrBackupRemove(src.hud_used.blurry)
if (src.stat != 2)
- if (src.client)
+ if (src.client)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
@@ -3908,6 +3911,10 @@
L += hearers(1, null)
obj_range = 1
italics = 1
+ else if (pre == "\[d\]" && usr.currentDrone)
+ message = copytext(message, 4, length(message) + 1)
+ L += hearers(1, null)
+ usr = usr.currentDrone
else
if (pre == "\[l\]")
message = copytext(message, 4, length(message) + 1)
@@ -3952,8 +3959,20 @@
if (italics)
message = text("[]", message)
if (((src.oxygen && src.oxygen.icon_state == "oxy0") || (!( (istype(T, /turf) || istype(T, /obj/move)) ) || T.oxygen > 0)))
+ var/speakerType = src.type
+ if (istype(src, /mob/drone))
+ var/mob/drone/drone = src
+ var/mob/owner = drone.controlledBy
+ if (owner!=null)
+ speakerType = owner.type
for(var/mob/M in L)
- if (istype(M, src.type) || istype(M, /mob/ai))
+ var/mobType = M.type
+ if (istype(M, /mob/drone))
+ var/mob/drone/Mdrone = M
+ var/mob/Mowner = Mdrone.controlledBy
+ if (Mowner!=null)
+ mobType = Mowner.type
+ if (istype(M, speakerType) || istype(M, /mob/ai) || (istype(M, /mob/drone) && mobType==speakerType))
M.show_message(text("[][]: []", src.rname, alt_name, message), 2)
else
M.show_message(text("The human: []", stars(message)), 2)
@@ -3970,11 +3989,11 @@
return
/mob/human/UpdateClothing()
-
+
..()
if (src.monkeyizing)
- return
-
+ return
+
if (!( src.w_uniform ))
var/obj/item/weapon/W = src.r_store
if (W)
@@ -4378,51 +4397,51 @@
/mob/human/attack_hand(mob/M as mob)
if (!ticker)
M << "You cannot attack people before the game has started."
- return
-
- var/intentToApply = M.a_intent
- var/aiControllingBonus = 0
- var/corruptedIntent = 0
-
- if (istype(M, /mob/drone))
- var/mob/owner = M:controlledBy
- if (owner!=null && istype(owner, /mob/ai))
- aiControllingBonus = 1
- else
- if (M.a_intent=="help")
- corruptedIntent = prob(50)
- if (corruptedIntent)
- if (prob(75)) //push down
- intentToApply = "disarm"
- else
- intentToApply = "hurt"
- else if (M.a_intent == "grab")
- corruptedIntent = prob(50)
- if (corruptedIntent)
- if (prob(10)) //push down
- intentToApply = "disarm"
- else
- intentToApply = "hurt"
- else if (M.a_intent == "hurt")
- corruptedIntent = prob(30)
- if (corruptedIntent)
- if (prob(20)) //push down
- intentToApply = "disarm"
- else
- intentToApply = "grab"
- else //disarm
- corruptedIntent = prob(50)
- if (corruptedIntent)
- if (prob(50))
- M.client_mob() << "You tried to disarm them, but managed to miss entirely."
- for(var/mob/O in viewers(src, null))
- O.show_message(text("\blue [] attempted to disarm [], but completely missed!", M, src), 1)
- return
- //otherwise we push them down
-
+ return
+
+ var/intentToApply = M.a_intent
+ var/aiControllingBonus = 0
+ var/corruptedIntent = 0
+
+ if (istype(M, /mob/drone))
+ var/mob/owner = M:controlledBy
+ if (owner!=null && istype(owner, /mob/ai))
+ aiControllingBonus = 1
+ else
+ if (M.a_intent=="help")
+ corruptedIntent = prob(50)
+ if (corruptedIntent)
+ if (prob(75)) //push down
+ intentToApply = "disarm"
+ else
+ intentToApply = "hurt"
+ else if (M.a_intent == "grab")
+ corruptedIntent = prob(50)
+ if (corruptedIntent)
+ if (prob(10)) //push down
+ intentToApply = "disarm"
+ else
+ intentToApply = "hurt"
+ else if (M.a_intent == "hurt")
+ corruptedIntent = prob(30)
+ if (corruptedIntent)
+ if (prob(20)) //push down
+ intentToApply = "disarm"
+ else
+ intentToApply = "grab"
+ else //disarm
+ corruptedIntent = prob(50)
+ if (corruptedIntent)
+ if (prob(50))
+ M.client_mob() << "You tried to disarm them, but managed to miss entirely."
+ for(var/mob/O in viewers(src, null))
+ O.show_message(text("\blue [] attempted to disarm [], but completely missed!", M, src), 1)
+ return
+ //otherwise we push them down
+
if (intentToApply == "help")
- if (istype(M, /mob/human))
- var/mob/human/H = M
+ if (istype(M, /mob/human))
+ var/mob/human/H = M
if (src.health > 0)
if (src.w_uniform)
src.w_uniform.add_fingerprint(M)
@@ -4446,16 +4465,16 @@
spawn( 0 )
O.process()
return
- else if (istype(M, /mob/drone))
- if (src.health > 0)
- if (src.w_uniform)
- src.w_uniform.add_fingerprint(M)
- src.sleeping = 0
- src.resting = 0
- for(var/mob/O in viewers(src, null))
- O.show_message(text("\blue [] shakes [] trying to wake [] up!", M, src, src), 1)
- //Foreach goto(80)
- else
+ else if (istype(M, /mob/drone))
+ if (src.health > 0)
+ if (src.w_uniform)
+ src.w_uniform.add_fingerprint(M)
+ src.sleeping = 0
+ src.resting = 0
+ for(var/mob/O in viewers(src, null))
+ O.show_message(text("\blue [] shakes [] trying to wake [] up!", M, src, src), 1)
+ //Foreach goto(80)
+ else
M << "They need CPR, and you can't perform it through this drone!"
else
if (intentToApply == "grab")
@@ -4479,10 +4498,13 @@
else
if (M.stat < 2)
if (intentToApply == "hurt")
- if (istype(M, /mob/human))
+ if (istype(M, /mob/human))
if (src.w_uniform)
src.w_uniform.add_fingerprint(M)
var/damage = rand(1, 9)
+ //This gives a damage bonus when the AI is controlling the drone. For now, it doesn't check their weapon or target zone.
+ if (aiControllingBonus && (!corruptedIntent))
+ damage += rand(9, 18)
var/obj/item/weapon/organ/external/affecting = src.organs["chest"]
var/t = M.zone_sel.selecting
if ((t in list( "hair", "eyes", "mouth", "neck" )))
@@ -4559,16 +4581,16 @@
O.show_message(text("\red [] has attempted to punch []!", M, src), 1)
//Foreach goto(1419)
return
- else if (istype(M, /mob/drone))
- var/damage = 0
- if (corruptedIntent)
- damage = rand(0, 5)
- else
- damage = rand(5, 14)
- for(var/mob/O in viewers(src, null))
- O.show_message(text("\red [] has smacked [] with its arm!", M, src), 1)
- if (corruptedIntent)
- M << "Oops! You've accidentally hit them."
+ else if (istype(M, /mob/drone))
+ var/damage = 0
+ if (corruptedIntent)
+ damage = rand(0, 5)
+ else
+ damage = rand(5, 14)
+ for(var/mob/O in viewers(src, null))
+ O.show_message(text("\red [] has smacked [] with its arm!", M, src), 1)
+ if (corruptedIntent)
+ M << "Oops! You've accidentally hit them."
src.damage_anywhere(damage)
else
if (!( src.lying ))
@@ -4589,11 +4611,11 @@
else
for(var/mob/O in viewers(src, null))
O.show_message(text("\red [] has attempted to disarm []!", M, src), 1)
- //Foreach goto(1643)
- if (corruptedIntent)
- if (M.a_intent == "help")
- M.client_mob() << "You failed to help [src] due to poor control over the drone, and may have knocked \him down, but at least you have not hurt \him."
- else if (M.a_intent == "grab")
+ //Foreach goto(1643)
+ if (corruptedIntent)
+ if (M.a_intent == "help")
+ M.client_mob() << "You failed to help [src] due to poor control over the drone, and may have knocked \him down, but at least you have not hurt \him."
+ else if (M.a_intent == "grab")
M.client_mob() << "You failed to grab [src] due to poor control over the drone, and may have knocked \him down, but at least you have not hurt \him."
return
@@ -4835,10 +4857,11 @@
return
/mob/human/show_inv(mob/user as mob)
- user.machine = src
- var/dat = text("\n[]\n\tHead(Mask): []\n\t\tHeadset: []\n\tLeft Hand: []\n\tRight Hand: []\n\tGloves: []\n\tEyes: []\n\tEars: []\n\tHead: []\n\tShoes: []\n\tBelt: []\n\tUniform: []\n\t(Exo)Suit: []\n\tBack: [] []\n\tID: []\n\t[]\n\t[]\n\tEmpty Pockets\nClose\n
", src.name, src, (src.wear_mask ? text("[]", src.wear_mask) : "Nothing"), src, (src.w_radio ? text("[]", src.w_radio) : "Nothing"), src, (src.l_hand ? text("[]", src.l_hand) : "Nothing"), src, (src.r_hand ? text("[]", src.r_hand) : "Nothing"), src, (src.gloves ? text("[]", src.gloves) : "Nothing"), src, (src.glasses ? text("[]", src.glasses) : "Nothing"), src, (src.ears ? text("[]", src.ears) : "Nothing"), src, (src.head ? text("[]", src.head) : "Nothing"), src, (src.shoes ? text("[]", src.shoes) : "Nothing"), src, (src.belt ? text("[]", src.belt) : "Nothing"), src, (src.w_uniform ? text("[]", src.w_uniform) : "Nothing"), src, (src.wear_suit ? text("[]", src.wear_suit) : "Nothing"), src, (src.back ? text("[]", src.back) : "Nothing"), ((istype(src.wear_mask, /obj/item/weapon/clothing/mask) && istype(src.back, /obj/item/weapon/tank) && !( src.internal )) ? text(" Set Internal", src) : ""), src, (src.wear_id ? text("[]", src.wear_id) : "Nothing"), (src.handcuffed ? text("Handcuffed", src) : text("Not Handcuffed", src)), (src.internal ? text("Remove Internal", src) : ""), src, user, url_encode(src.name))
- user << browse(dat, text("window=mob[];size=300x600", url_encode(src.name)))
- return
+ if (istype(user, /mob/human) || istype(user, /mob/monkey) || (istype(user, /mob/drone) && user.equipped()==null)) //AI should not be able to do this, and drone can only do it if they're using the gripper
+ user.machine = src
+ var/dat = text("
\n[]\n\tHead(Mask): []\n\t\tHeadset: []\n\tLeft Hand: []\n\tRight Hand: []\n\tGloves: []\n\tEyes: []\n\tEars: []\n\tHead: []\n\tShoes: []\n\tBelt: []\n\tUniform: []\n\t(Exo)Suit: []\n\tBack: [] []\n\tID: []\n\t[]\n\t[]\n\tEmpty Pockets\nClose\n", src.name, src, (src.wear_mask ? text("[]", src.wear_mask) : "Nothing"), src, (src.w_radio ? text("[]", src.w_radio) : "Nothing"), src, (src.l_hand ? text("[]", src.l_hand) : "Nothing"), src, (src.r_hand ? text("[]", src.r_hand) : "Nothing"), src, (src.gloves ? text("[]", src.gloves) : "Nothing"), src, (src.glasses ? text("[]", src.glasses) : "Nothing"), src, (src.ears ? text("[]", src.ears) : "Nothing"), src, (src.head ? text("[]", src.head) : "Nothing"), src, (src.shoes ? text("[]", src.shoes) : "Nothing"), src, (src.belt ? text("[]", src.belt) : "Nothing"), src, (src.w_uniform ? text("[]", src.w_uniform) : "Nothing"), src, (src.wear_suit ? text("[]", src.wear_suit) : "Nothing"), src, (src.back ? text("[]", src.back) : "Nothing"), ((istype(src.wear_mask, /obj/item/weapon/clothing/mask) && istype(src.back, /obj/item/weapon/tank) && !( src.internal )) ? text(" Set Internal", src) : ""), src, (src.wear_id ? text("[]", src.wear_id) : "Nothing"), (src.handcuffed ? text("Handcuffed", src) : text("Not Handcuffed", src)), (src.internal ? text("Remove Internal", src) : ""), src, user, url_encode(src.name)) + user << browse(dat, text("window=mob[];size=300x600", url_encode(src.name))) + return /mob/proc/show_message(msg, type, alt, alt_type) @@ -5029,11 +5052,10 @@ return /mob/proc/show_inv(mob/user as mob) - - user.machine = src - var/dat = text("\n[]