initial commit - cross reference with 5th port - obviously has compile errors

This commit is contained in:
LetterJay
2016-07-03 02:17:19 -05:00
commit 35a1723e98
4355 changed files with 2221257 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
#define CLICKCATCHER_PLANE -99
+97
View File
@@ -0,0 +1,97 @@
/*
Adjacency proc for determining touch range
This is mostly to determine if a user can enter a square for the purposes of touching something.
Examples include reaching a square diagonally or reaching something on the other side of a glass window.
This is calculated by looking for border items, or in the case of clicking diagonally from yourself, dense items.
This proc will NOT notice if you are trying to attack a window on the other side of a dense object in its turf. There is a window helper for that.
Note that in all cases the neighbor is handled simply; this is usually the user's mob, in which case it is up to you
to check that the mob is not inside of something
*/
/atom/proc/Adjacent(atom/neighbor) // basic inheritance, unused
return 0
// Not a sane use of the function and (for now) indicative of an error elsewhere
/area/Adjacent(var/atom/neighbor)
CRASH("Call to /area/Adjacent(), unimplemented proc")
/*
Adjacency (to turf):
* If you are in the same turf, always true
* If you are vertically/horizontally adjacent, ensure there are no border objects
* If you are diagonally adjacent, ensure you can pass through at least one of the mutually adjacent square.
* Passing through in this case ignores anything with the LETPASSTHROW pass flag, such as tables, racks, and morgue trays.
*/
/turf/Adjacent(var/atom/neighbor, var/atom/target = null)
var/turf/T0 = get_turf(neighbor)
if(T0 == src) //same turf
return 1
if(get_dist(src,T0) > 1) //too far
return 0
// Non diagonal case
if(T0.x == x || T0.y == y)
// Check for border blockages
return T0.ClickCross(get_dir(T0,src), border_only = 1) && src.ClickCross(get_dir(src,T0), border_only = 1, target_atom = target)
// Diagonal case
var/in_dir = get_dir(T0,src) // eg. northwest (1+8) = 9 (00001001)
var/d1 = in_dir&3 // eg. north (1+8)&3 (0000 0011) = 1 (0000 0001)
var/d2 = in_dir&12 // eg. west (1+8)&12 (0000 1100) = 8 (0000 1000)
for(var/d in list(d1,d2))
if(!T0.ClickCross(d, border_only = 1))
continue // could not leave T0 in that direction
var/turf/T1 = get_step(T0,d)
if(!T1 || T1.density || !T1.ClickCross(get_dir(T1,T0) | get_dir(T1,src), border_only = 0)) //let's check both directions at once
continue // couldn't enter or couldn't leave T1
if(!src.ClickCross(get_dir(src,T1), border_only = 1, target_atom = target))
continue // could not enter src
return 1 // we don't care about our own density
return 0
/*
Adjacency (to anything else):
* Must be on a turf
*/
/atom/movable/Adjacent(var/atom/neighbor)
if(neighbor == loc) return 1
if(!isturf(loc)) return 0
if(loc.Adjacent(neighbor,src)) return 1
return 0
// This is necessary for storage items not on your person.
/obj/item/Adjacent(var/atom/neighbor, var/recurse = 1)
if(neighbor == loc) return 1
if(istype(loc,/obj/item))
if(recurse > 0)
return loc.Adjacent(neighbor,recurse - 1)
return 0
return ..()
/*
This checks if you there is uninterrupted airspace between that turf and this one.
This is defined as any dense ON_BORDER object, or any dense object without LETPASSTHROW.
The border_only flag allows you to not objects (for source and destination squares)
*/
/turf/proc/ClickCross(target_dir, border_only, target_atom = null)
for(var/obj/O in src)
if( !O.density || O == target_atom || (O.pass_flags & LETPASSTHROW)) //check if there's a dense object present on the turf
continue // LETPASSTHROW is used for anything you can click through (or the firedoor special case, see above)
if( O.flags&ON_BORDER) // windows are on border, check them first
if( O.dir & target_dir || O.dir & (O.dir-1) ) // full tile windows are just diagonals mechanically
return 0 //O.dir&(O.dir-1) is false for any cardinal direction, but true for diagonal ones
else if( !border_only ) // dense, not on border, cannot pass over
return 0
return 1
+177
View File
@@ -0,0 +1,177 @@
/*
AI ClickOn()
Note currently ai restrained() returns 0 in all cases,
therefore restrained code has been removed
The AI can double click to move the camera (this was already true but is cleaner),
or double click a mob to track them.
Note that AI have no need for the adjacency proc, and so this proc is a lot cleaner.
*/
/mob/living/silicon/ai/DblClickOn(var/atom/A, params)
if(client.click_intercept)
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
return
if(control_disabled || stat) return
if(ismob(A))
ai_actual_track(A)
else
A.move_camera_by_click()
/mob/living/silicon/ai/ClickOn(var/atom/A, params)
if(world.time <= next_click)
return
next_click = world.time + 1
if(client.click_intercept)
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
return
if(control_disabled || stat)
return
var/list/modifiers = params2list(params)
if(modifiers["shift"] && modifiers["ctrl"])
CtrlShiftClickOn(A)
return
if(modifiers["middle"])
if(controlled_mech) //Are we piloting a mech? Placed here so the modifiers are not overridden.
controlled_mech.click_action(A, src, params) //Override AI normal click behavior.
return
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"]) // alt and alt-gr (rightalt)
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
if(world.time <= next_move)
return
if(aicamera.in_camera_mode)
aicamera.camera_mode_off()
aicamera.captureimage(A, usr)
return
if(waypoint_mode)
set_waypoint(A)
waypoint_mode = 0
return
/*
AI restrained() currently does nothing
if(restrained())
RestrainedClickOn(A)
else
*/
A.attack_ai(src)
/*
AI has no need for the UnarmedAttack() and RangedAttack() procs,
because the AI code is not generic; attack_ai() is used instead.
The below is only really for safety, or you can alter the way
it functions and re-insert it above.
*/
/mob/living/silicon/ai/UnarmedAttack(atom/A)
A.attack_ai(src)
/mob/living/silicon/ai/RangedAttack(atom/A)
A.attack_ai(src)
/atom/proc/attack_ai(mob/user)
return
/*
Since the AI handles shift, ctrl, and alt-click differently
than anything else in the game, atoms have separate procs
for AI shift, ctrl, and alt clicking.
*/
/mob/living/silicon/ai/CtrlShiftClickOn(var/atom/A)
A.AICtrlShiftClick(src)
/mob/living/silicon/ai/ShiftClickOn(var/atom/A)
A.AIShiftClick(src)
/mob/living/silicon/ai/CtrlClickOn(var/atom/A)
A.AICtrlClick(src)
/mob/living/silicon/ai/AltClickOn(var/atom/A)
A.AIAltClick(src)
/*
The following criminally helpful code is just the previous code cleaned up;
I have no idea why it was in atoms.dm instead of respective files.
*/
/* Questions: Instead of an Emag check on every function, can we not add to airlocks onclick if emag return? */
/* Atom Procs */
/atom/proc/AICtrlClick()
return
/atom/proc/AIAltClick(mob/living/silicon/ai/user)
AltClick(user)
return
/atom/proc/AIShiftClick()
return
/atom/proc/AICtrlShiftClick()
return
/* Airlocks */
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors
if(emagged)
return
if(locked)
Topic("aiEnable=4", list("aiEnable"="4"), 1)// 1 meaning no window (consistency!)
else
Topic("aiDisable=4", list("aiDisable"="4"), 1)
return
/obj/machinery/door/airlock/AIAltClick() // Eletrifies doors.
if(emagged)
return
if(!secondsElectrified)
// permenant shock
Topic("aiEnable=6", list("aiEnable"="6"), 1) // 1 meaning no window (consistency!)
else
// disable/6 is not in Topic; disable/5 disables both temporary and permenant shock
Topic("aiDisable=5", list("aiDisable"="5"), 1)
return
/obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors!
if(emagged)
return
if(density)
Topic("aiEnable=7", list("aiEnable"="7"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=7", list("aiDisable"="7"), 1)
return
/obj/machinery/door/airlock/AICtrlShiftClick() // Sets/Unsets Emergency Access Override
if(emagged)
return
if(!emergency)
Topic("aiEnable=11", list("aiEnable"="11"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=11", list("aiDisable"="11"), 1)
return
/* APC */
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
toggle_breaker()
add_fingerprint(usr)
/* AI Turrets */
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
toggle_lethal()
add_fingerprint(usr)
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
toggle_on()
add_fingerprint(usr)
//
// Override TurfAdjacent for AltClicking
//
/mob/living/silicon/ai/TurfAdjacent(var/turf/T)
return (cameranet && cameranet.checkTurfVis(T))
+45
View File
@@ -0,0 +1,45 @@
/client
var/list/atom/selected_target[2]
/client/MouseDown(object, location, control, params)
var/delay = mob.CanMobAutoclick(object, location, params)
if(delay)
selected_target[1] = object
selected_target[2] = params
while(selected_target[1])
Click(selected_target[1], location, control, selected_target[2])
sleep(delay)
/client/MouseUp(object, location, control, params)
selected_target[1] = null
/client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params)
if(selected_target[1] && over_object.IsAutoclickable())
selected_target[1] = over_object
selected_target[2] = params
/mob/proc/CanMobAutoclick(object, location, params)
/mob/living/carbon/CanMobAutoclick(atom/object, location, params)
if(!object.IsAutoclickable())
return
var/obj/item/h = get_active_hand()
if(h)
. = h.CanItemAutoclick(object, location, params)
/obj/item/proc/CanItemAutoclick(object, location, params)
/obj/item/weapon/gun
var/automatic = 0 //can gun use it, 0 is no, anything above 0 is the delay between clicks in ds
/obj/item/weapon/gun/CanItemAutoclick(object, location, params)
. = automatic
/atom/proc/IsAutoclickable()
. = 1
/obj/screen/IsAutoclickable()
. = 0
/obj/screen/click_catcher/IsAutoclickable()
. = 1
+356
View File
@@ -0,0 +1,356 @@
/*
Click code cleanup
~Sayu
*/
// 1 decisecond click delay (above and beyond mob/next_move)
//This is mainly modified by click code, to modify click delays elsewhere, use next_move and changeNext_move()
/mob/var/next_click = 0
// THESE DO NOT EFFECT THE BASE 1 DECISECOND DELAY OF NEXT_CLICK
/mob/var/next_move_adjust = 0 //Amount to adjust action/click delays by, + or -
/mob/var/next_move_modifier = 1 //Value to multiply action/click delays by
//Delays the mob's next click/action by num deciseconds
// eg: 10-3 = 7 deciseconds of delay
// eg: 10*0.5 = 5 deciseconds of delay
// DOES NOT EFFECT THE BASE 1 DECISECOND DELAY OF NEXT_CLICK
/mob/proc/changeNext_move(num)
next_move = world.time + ((num+next_move_adjust)*next_move_modifier)
/*
Before anything else, defer these calls to a per-mobtype handler. This allows us to
remove istype() spaghetti code, but requires the addition of other handler procs to simplify it.
Alternately, you could hardcode every mob's variation in a flat ClickOn() proc; however,
that's a lot of code duplication and is hard to maintain.
Note that this proc can be overridden, and is in the case of screen objects.
*/
/atom/Click(location,control,params)
usr.ClickOn(src, params)
/atom/DblClick(location,control,params)
usr.DblClickOn(src,params)
/*
Standard mob ClickOn()
Handles exceptions: Buildmode, middle click, modified clicks, mech actions
After that, mostly just check your state, check whether you're holding an item,
check whether you're adjacent to the target, then pass off the click to whoever
is recieving it.
The most common are:
* mob/UnarmedAttack(atom,adjacent) - used here only when adjacent, with no item in hand; in the case of humans, checks gloves
* atom/attackby(item,user) - used only when adjacent
* item/afterattack(atom,user,adjacent,params) - used both ranged and adjacent
* mob/RangedAttack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed
*/
/mob/proc/ClickOn( atom/A, params )
if(world.time <= next_click)
return
next_click = world.time + 1
if(client.click_intercept)
if(call(client.click_intercept, "InterceptClickOn")(src, params, A))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"] && modifiers["middle"])
ShiftMiddleClickOn(A)
return
if(modifiers["shift"] && modifiers["ctrl"])
CtrlShiftClickOn(A)
return
if(modifiers["middle"])
MiddleClickOn(A)
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"]) // alt and alt-gr (rightalt)
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
if(incapacitated(ignore_restraints = 1))
return
face_atom(A)
if(next_move > world.time) // in the year 2000...
return
if(istype(loc,/obj/mecha))
var/obj/mecha/M = loc
return M.click_action(A,src,params)
if(restrained())
changeNext_move(CLICK_CD_HANDCUFFED) //Doing shit in cuffs shall be vey slow
RestrainedClickOn(A)
return
if(in_throw_mode)
throw_item(A)
return
var/obj/item/W = get_active_hand()
if(W == A)
W.attack_self(src)
if(hand)
update_inv_l_hand(0)
else
update_inv_r_hand(0)
return
// operate three levels deep here (item in backpack in src; item in box in backpack in src, not any deeper)
if(!isturf(A) && A == loc || (A in contents) || (A.loc in contents) || (A.loc && (A.loc.loc in contents)))
// No adjacency needed
if(W)
var/resolved = A.attackby(W,src)
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1 indicates adjacency
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
UnarmedAttack(A)
return
if(!isturf(loc)) // This is going to stop you from telekinesing from inside a closet, but I don't shed many tears for that
return
// Allows you to click on a box's contents, if that box is on the ground, but no deeper than that
if(isturf(A) || isturf(A.loc) || (A.loc && isturf(A.loc.loc)))
if(A.Adjacent(src)) // see adjacent.dm
if(W)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = A.attackby(W,src,params)
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1: clicking something Adjacent
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
UnarmedAttack(A, 1)
return
else // non-adjacent click
if(W)
W.afterattack(A,src,0,params) // 0: not Adjacent
else
RangedAttack(A, params)
// Default behavior: ignore double clicks (the second click that makes the doubleclick call already calls for a normal click)
/mob/proc/DblClickOn(atom/A, params)
return
/*
Translates into attack_hand, etc.
Note: proximity_flag here is used to distinguish between normal usage (flag=1),
and usage when clicking on things telekinetically (flag=0). This proc will
not be called at ranged except with telekinesis.
proximity_flag is not currently passed to attack_hand, and is instead used
in human click code to allow glove touches only at melee range.
*/
/mob/proc/UnarmedAttack(atom/A, proximity_flag)
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
return
/*
Ranged unarmed attack:
This currently is just a default for all mobs, involving
laser eyes and telekinesis. You could easily add exceptions
for things like ranged glove touches, spitting alien acid/neurotoxin,
animals lunging, etc.
*/
/mob/proc/RangedAttack(atom/A, params)
/*
Restrained ClickOn
Used when you are handcuffed and click things.
Not currently used by anything but could easily be.
*/
/mob/proc/RestrainedClickOn(atom/A)
return
/*
Middle click
Only used for swapping hands
*/
/mob/proc/MiddleClickOn(atom/A)
return
/mob/living/carbon/MiddleClickOn(atom/A)
if(!src.stat && src.mind && src.mind.changeling && src.mind.changeling.chosen_sting && (istype(A, /mob/living/carbon)) && (A != src))
next_click = world.time + 5
mind.changeling.chosen_sting.try_to_sting(src, A)
else
swap_hand()
/mob/living/simple_animal/drone/MiddleClickOn(atom/A)
swap_hand()
// In case of use break glass
/*
/atom/proc/MiddleClick(mob/M as mob)
return
*/
/*
Shift click
For most mobs, examine.
This is overridden in ai.dm
*/
/mob/proc/ShiftClickOn(atom/A)
A.ShiftClick(src)
return
/atom/proc/ShiftClick(mob/user)
if(user.client && user.client.eye == user || user.client.eye == user.loc)
user.examinate(src)
return
/*
Ctrl click
For most objects, pull
*/
/mob/proc/CtrlClickOn(atom/A)
A.CtrlClick(src)
return
/atom/proc/CtrlClick(mob/user)
var/mob/living/ML = user
if(istype(ML))
ML.pulled(src)
/*
Alt click
Unused except for AI
*/
/mob/proc/AltClickOn(atom/A)
A.AltClick(src)
return
/mob/living/carbon/AltClickOn(atom/A)
if(!src.stat && src.mind && src.mind.changeling && src.mind.changeling.chosen_sting && (istype(A, /mob/living/carbon)) && (A != src))
next_click = world.time + 5
mind.changeling.chosen_sting.try_to_sting(src, A)
else
..()
/atom/proc/AltClick(mob/user)
var/turf/T = get_turf(src)
if(T && user.TurfAdjacent(T))
if(user.listed_turf == T)
user.listed_turf = null
else
user.listed_turf = T
user.client.statpanel = T.name
return
/mob/proc/TurfAdjacent(turf/T)
return T.Adjacent(src)
/*
Control+Shift click
Unused except for AI
*/
/mob/proc/CtrlShiftClickOn(atom/A)
A.CtrlShiftClick(src)
return
/mob/proc/ShiftMiddleClickOn(atom/A)
src.pointed(A)
return
/atom/proc/CtrlShiftClick(mob/user)
return
/*
Misc helpers
Laser Eyes: as the name implies, handles this since nothing else does currently
face_atom: turns the mob towards what you clicked on
*/
/mob/proc/LaserEyes(atom/A)
return
/mob/living/LaserEyes(atom/A)
changeNext_move(CLICK_CD_RANGE)
var/turf/T = get_turf(src)
var/turf/U = get_turf(A)
var/obj/item/projectile/beam/LE = new /obj/item/projectile/beam( loc )
LE.icon = 'icons/effects/genetics.dmi'
LE.icon_state = "eyelasers"
playsound(usr.loc, 'sound/weapons/taser2.ogg', 75, 1)
LE.firer = src
LE.def_zone = get_organ_target()
LE.original = A
LE.current = T
LE.yo = U.y - T.y
LE.xo = U.x - T.x
LE.fire()
// Simple helper to face what you clicked on, in case it should be needed in more than one place
/mob/proc/face_atom(atom/A)
if( buckled || stat != CONSCIOUS || !A || !x || !y || !A.x || !A.y )
return
var/dx = A.x - x
var/dy = A.y - y
if(!dx && !dy) // Wall items are graphically shifted but on the floor
if(A.pixel_y > 16)
setDir(NORTH)
else if(A.pixel_y < -16)
setDir(SOUTH)
else if(A.pixel_x > 16)
setDir(EAST)
else if(A.pixel_x < -16)
setDir(WEST)
return
if(abs(dx) < abs(dy))
if(dy > 0)
setDir(NORTH)
else
setDir(SOUTH)
else
if(dx > 0)
setDir(EAST)
else
setDir(WEST)
/obj/screen/click_catcher
icon = 'icons/mob/screen_gen.dmi'
icon_state = "click_catcher"
plane = CLICKCATCHER_PLANE
mouse_opacity = 2
screen_loc = "CENTER-7,CENTER-7"
/obj/screen/click_catcher/proc/MakeGreed()
. = list()
for(var/i = 0, i<15, i++)
for(var/j = 0, j<15, j++)
var/obj/screen/click_catcher/CC = new()
CC.screen_loc = "NORTH-[i],EAST-[j]"
. += CC
/obj/screen/click_catcher/Click(location, control, params)
var/list/modifiers = params2list(params)
if(modifiers["middle"] && istype(usr, /mob/living/carbon))
var/mob/living/carbon/C = usr
C.swap_hand()
else
var/turf/T = screen_loc2turf(screen_loc, get_turf(usr))
if(T)
T.Click(location, control, params)
. = 1
+159
View File
@@ -0,0 +1,159 @@
/*
Cyborg ClickOn()
Cyborgs have no range restriction on attack_robot(), because it is basically an AI click.
However, they do have a range restriction on item use, so they cannot do without the
adjacency code.
*/
/mob/living/silicon/robot/ClickOn(var/atom/A, var/params)
if(world.time <= next_click)
return
next_click = world.time + 1
if(client.click_intercept)
if(call(client.click_intercept,"InterceptClickOn")(src,params,A))
return
if(stat || lockcharge || weakened || stunned || paralysis)
return
var/list/modifiers = params2list(params)
if(modifiers["shift"] && modifiers["ctrl"])
CtrlShiftClickOn(A)
return
if(modifiers["middle"])
MiddleClickOn(A)
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"]) // alt and alt-gr (rightalt)
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
if(next_move >= world.time)
return
face_atom(A) // change direction to face what you clicked on
/*
cyborg restrained() currently does nothing
if(restrained())
RestrainedClickOn(A)
return
*/
if(aicamera.in_camera_mode) //Cyborg picture taking
aicamera.camera_mode_off()
aicamera.captureimage(A, usr)
return
var/obj/item/W = get_active_hand()
// Cyborgs have no range-checking unless there is item use
if(!W)
A.attack_robot(src)
return
// buckled cannot prevent machine interlinking but stops arm movement
if( buckled || incapacitated())
return
if(W == A)
W.attack_self(src)
return
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents)
if(A == loc || (A in loc) || (A in contents))
// No adjacency checks
var/resolved = A.attackby(W,src, params)
if(!resolved && A && W)
W.afterattack(A,src,1,params)
return
if(!isturf(loc))
return
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc))
if(isturf(A) || isturf(A.loc))
if(A.Adjacent(src)) // see adjacent.dm
var/resolved = A.attackby(W, src, params)
if(!resolved && A && W)
W.afterattack(A, src, 1, params)
return
else
W.afterattack(A, src, 0, params)
return
return
//Middle click cycles through selected modules.
/mob/living/silicon/robot/MiddleClickOn(atom/A)
cycle_modules()
return
//Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks
// for non-doors/apcs
/mob/living/silicon/robot/CtrlShiftClickOn(atom/A)
A.BorgCtrlShiftClick(src)
/mob/living/silicon/robot/ShiftClickOn(atom/A)
A.BorgShiftClick(src)
/mob/living/silicon/robot/CtrlClickOn(atom/A)
A.BorgCtrlClick(src)
/mob/living/silicon/robot/AltClickOn(atom/A)
A.BorgAltClick(src)
/atom/proc/BorgCtrlShiftClick(mob/living/silicon/robot/user) //forward to human click if not overriden
CtrlShiftClick(user)
/obj/machinery/door/airlock/BorgCtrlShiftClick() // Sets/Unsets Emergency Access Override Forwards to AI code.
AICtrlShiftClick()
/atom/proc/BorgShiftClick(mob/living/silicon/robot/user) //forward to human click if not overriden
ShiftClick(user)
/obj/machinery/door/airlock/BorgShiftClick() // Opens and closes doors! Forwards to AI code.
AIShiftClick()
/atom/proc/BorgCtrlClick(mob/living/silicon/robot/user) //forward to human click if not overriden
CtrlClick(user)
/obj/machinery/door/airlock/BorgCtrlClick() // Bolts doors. Forwards to AI code.
AICtrlClick()
/obj/machinery/power/apc/BorgCtrlClick() // turns off/on APCs. Forwards to AI code.
AICtrlClick()
/obj/machinery/turretid/BorgCtrlClick() //turret control on/off. Forwards to AI code.
AICtrlClick()
/atom/proc/BorgAltClick(mob/living/silicon/robot/user)
AltClick(user)
return
/obj/machinery/door/airlock/BorgAltClick() // Eletrifies doors. Forwards to AI code.
AIAltClick()
/obj/machinery/turretid/BorgAltClick() //turret lethal on/off. Forwards to AI code.
AIAltClick()
/*
As with AI, these are not used in click code,
because the code for robots is specific, not generic.
If you would like to add advanced features to robot
clicks, you can do so here, but you will have to
change attack_robot() above to the proper function
*/
/mob/living/silicon/robot/UnarmedAttack(atom/A)
A.attack_robot(src)
/mob/living/silicon/robot/RangedAttack(atom/A)
A.attack_robot(src)
/atom/proc/attack_robot(mob/user)
attack_ai(user)
return
+19
View File
@@ -0,0 +1,19 @@
/*
MouseDrop:
Called on the atom you're dragging. In a lot of circumstances we want to use the
recieving object instead, so that's the default action. This allows you to drag
almost anything into a trash can.
*/
/atom/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
if(!usr || !over) return
if(over == src)
return usr.client.Click(src, src_location, src_control, params)
if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows
over.MouseDrop_T(src,usr)
return
// recieve a mousedrop
/atom/proc/MouseDrop_T(atom/dropping, mob/user)
return
+8
View File
@@ -0,0 +1,8 @@
/mob/camera/god/UnarmedAttack(atom/A)
A.attack_god(src)
/mob/camera/god/RangedAttack(atom/A)
A.attack_god(src)
/atom/proc/attack_god(mob/user)
return
+140
View File
@@ -0,0 +1,140 @@
/*
These defines specificy screen locations. For more information, see the byond documentation on the screen_loc var.
The short version:
Everything is encoded as strings because apparently that's how Byond rolls.
"1,1" is the bottom left square of the user's screen. This aligns perfectly with the turf grid.
"1:2,3:4" is the square (1,3) with pixel offsets (+2, +4); slightly right and slightly above the turf grid.
Pixel offsets are used so you don't perfectly hide the turf under them, that would be crappy.
In addition, the keywords NORTH, SOUTH, EAST, WEST and CENTER can be used to represent their respective
screen borders. NORTH-1, for example, is the row just below the upper edge. Useful if you want your
UI to scale with screen size.
The size of the user's screen is defined by client.view (indirectly by world.view), in our case "15x15".
Therefore, the top right corner (except during admin shenanigans) is at "15,15"
*/
//Lower left, persistant menu
#define ui_inventory "WEST:6,SOUTH:5"
//Middle left indicators
#define ui_lingchemdisplay "WEST:6,CENTER-1:15"
#define ui_lingstingdisplay "WEST:6,CENTER-3:11"
#define ui_crafting "12:-10,1:5"
#define ui_devilsouldisplay "WEST:6,CENTER-1:15"
//Lower center, persistant menu
#define ui_sstore1 "CENTER-5:10,SOUTH:5"
#define ui_id "CENTER-4:12,SOUTH:5"
#define ui_belt "CENTER-3:14,SOUTH:5"
#define ui_back "CENTER-2:14,SOUTH:5"
#define ui_rhand "CENTER:-16,SOUTH:5"
#define ui_lhand "CENTER: 16,SOUTH:5"
#define ui_equip "CENTER:-16,SOUTH+1:5"
#define ui_swaphand1 "CENTER:-16,SOUTH+1:5"
#define ui_swaphand2 "CENTER: 16,SOUTH+1:5"
#define ui_storage1 "CENTER+1:18,SOUTH:5"
#define ui_storage2 "CENTER+2:20,SOUTH:5"
#define ui_borg_sensor "CENTER-3:16, SOUTH:5" //borgs
#define ui_borg_lamp "CENTER-4:16, SOUTH:5" //borgies
#define ui_borg_thrusters "CENTER-5:16, SOUTH:5"//borgies
#define ui_inv1 "CENTER-2:16,SOUTH:5" //borgs
#define ui_inv2 "CENTER-1 :16,SOUTH:5" //borgs
#define ui_inv3 "CENTER :16,SOUTH:5" //borgs
#define ui_borg_module "CENTER+1:16,SOUTH:5"
#define ui_borg_store "CENTER+2:16,SOUTH:5" //borgs
#define ui_borg_camera "CENTER+3:21,SOUTH:5" //borgs
#define ui_borg_album "CENTER+4:21,SOUTH:5" //borgs
#define ui_monkey_head "CENTER-4:13,SOUTH:5" //monkey
#define ui_monkey_mask "CENTER-3:14,SOUTH:5" //monkey
#define ui_monkey_back "CENTER-2:15,SOUTH:5" //monkey
#define ui_alien_storage_l "CENTER-2:14,SOUTH:5"//alien
#define ui_alien_storage_r "CENTER+1:18,SOUTH:5"//alien
#define ui_drone_drop "CENTER+1:18,SOUTH:5" //maintenance drones
#define ui_drone_pull "CENTER+2:2,SOUTH:5" //maintenance drones
#define ui_drone_storage "CENTER-2:14,SOUTH:5" //maintenance drones
#define ui_drone_head "CENTER-3:14,SOUTH:5" //maintenance drones
//Lower right, persistant menu
#define ui_drop_throw "EAST-1:28,SOUTH+1:7"
#define ui_pull_resist "EAST-2:26,SOUTH+1:7"
#define ui_movi "EAST-2:26,SOUTH:5"
#define ui_acti "EAST-3:24,SOUTH:5"
#define ui_zonesel "EAST-1:28,SOUTH:5"
#define ui_acti_alt "EAST-1:28,SOUTH:5" //alternative intent switcher for when the interface is hidden (F12)
#define ui_borg_pull "EAST-2:26,SOUTH+1:7"
#define ui_borg_radio "EAST-1:28,SOUTH+1:7"
#define ui_borg_intents "EAST-2:26,SOUTH:5"
//Upper-middle right (alerts)
#define ui_alert1 "EAST-1:28,CENTER+5:27"
#define ui_alert2 "EAST-1:28,CENTER+4:25"
#define ui_alert3 "EAST-1:28,CENTER+3:23"
#define ui_alert4 "EAST-1:28,CENTER+2:21"
#define ui_alert5 "EAST-1:28,CENTER+1:19"
//Middle right (status indicators)
#define ui_healthdoll "EAST-1:28,CENTER-2:13"
#define ui_health "EAST-1:28,CENTER-1:15"
#define ui_internal "EAST-1:28,CENTER:17"
//borgs and aliens
#define ui_alien_nightvision "EAST-1:28,CENTER:17"
#define ui_borg_health "EAST-1:28,CENTER-1:15" //borgs have the health display where humans have the pressure damage indicator.
#define ui_alien_health "EAST-1:28,CENTER-1:15" //aliens have the health display where humans have the pressure damage indicator.
#define ui_alienplasmadisplay "EAST-1:28,CENTER-2:15"
// AI
#define ui_ai_core "SOUTH:6,WEST"
#define ui_ai_camera_list "SOUTH:6,WEST+1"
#define ui_ai_track_with_camera "SOUTH:6,WEST+2"
#define ui_ai_camera_light "SOUTH:6,WEST+3"
#define ui_ai_crew_monitor "SOUTH:6,WEST+4"
#define ui_ai_crew_manifest "SOUTH:6,WEST+5"
#define ui_ai_alerts "SOUTH:6,WEST+6"
#define ui_ai_announcement "SOUTH:6,WEST+7"
#define ui_ai_shuttle "SOUTH:6,WEST+8"
#define ui_ai_state_laws "SOUTH:6,WEST+9"
#define ui_ai_pda_send "SOUTH:6,WEST+10"
#define ui_ai_pda_log "SOUTH:6,WEST+11"
#define ui_ai_take_picture "SOUTH:6,WEST+12"
#define ui_ai_view_images "SOUTH:6,WEST+13"
#define ui_ai_sensor "SOUTH:6,WEST+14"
//Pop-up inventory
#define ui_shoes "WEST+1:8,SOUTH:5"
#define ui_iclothing "WEST:6,SOUTH+1:7"
#define ui_oclothing "WEST+1:8,SOUTH+1:7"
#define ui_gloves "WEST+2:10,SOUTH+1:7"
#define ui_glasses "WEST:6,SOUTH+2:9"
#define ui_mask "WEST+1:8,SOUTH+2:9"
#define ui_ears "WEST+2:10,SOUTH+2:9"
#define ui_head "WEST+1:8,SOUTH+3:11"
//Ghosts
#define ui_ghost_jumptomob "SOUTH:6,CENTER-2:16"
#define ui_ghost_orbit "SOUTH:6,CENTER-1:16"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER:16"
#define ui_ghost_teleport "SOUTH:6,CENTER+1:16"
//Hand of God, god
#define ui_deityhealth "EAST-1:28,CENTER-2:13"
#define ui_deitypower "EAST-1:28,CENTER-1:15"
#define ui_deityfollowers "EAST-1:28,CENTER:17"
+129
View File
@@ -0,0 +1,129 @@
/obj/screen/movable/action_button
var/datum/action/linked_action
screen_loc = null
/obj/screen/movable/action_button/Click(location,control,params)
var/list/modifiers = params2list(params)
if(modifiers["shift"])
moved = 0
usr.update_action_buttons() //redraw buttons that are no longer considered "moved"
return 1
if(usr.next_move >= world.time) // Is this needed ?
return
linked_action.Trigger()
return 1
//Hide/Show Action Buttons ... Button
/obj/screen/movable/action_button/hide_toggle
name = "Hide Buttons"
icon = 'icons/mob/actions.dmi'
icon_state = "bg_default"
var/hidden = 0
/obj/screen/movable/action_button/hide_toggle/Click(location,control,params)
var/list/modifiers = params2list(params)
if(modifiers["shift"])
moved = 0
return 1
usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden
hidden = usr.hud_used.action_buttons_hidden
if(hidden)
name = "Show Buttons"
else
name = "Hide Buttons"
UpdateIcon()
usr.update_action_buttons()
/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(mob/living/user)
if(isalien(user))
icon_state = "bg_alien"
else
icon_state = "bg_default"
UpdateIcon()
return
/obj/screen/movable/action_button/hide_toggle/proc/UpdateIcon()
cut_overlays()
var/image/img = image(icon, src, hidden ? "show" : "hide")
add_overlay(img)
return
/obj/screen/movable/action_button/MouseEntered(location,control,params)
openToolTip(usr,src,params,title = name,content = desc)
/obj/screen/movable/action_button/MouseExited()
closeToolTip(usr)
/mob/proc/update_action_buttons_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
//This is the proc used to update all the action buttons.
/mob/proc/update_action_buttons(reload_screen)
if(!hud_used || !client)
return
if(hud_used.hud_shown != HUD_STYLE_STANDARD)
return
var/button_number = 0
if(hud_used.action_buttons_hidden)
for(var/datum/action/A in actions)
A.button.screen_loc = null
if(reload_screen)
client.screen += A.button
else
for(var/datum/action/A in actions)
button_number++
A.UpdateButtonIcon()
var/obj/screen/movable/action_button/B = A.button
if(!B.moved)
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
else
B.screen_loc = B.moved
if(reload_screen)
client.screen += B
if(!button_number)
hud_used.hide_actions_toggle.screen_loc = null
return
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
else
hud_used.hide_actions_toggle.screen_loc = hud_used.hide_actions_toggle.moved
if(reload_screen)
client.screen += hud_used.hide_actions_toggle
#define AB_MAX_COLUMNS 10
/datum/hud/proc/ButtonNumberToScreenCoords(number) // TODO : Make this zero-indexed for readabilty
var/row = round((number - 1)/AB_MAX_COLUMNS)
var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
var/coord_col = "+[col-1]"
var/coord_col_offset = 4 + 2 * col
var/coord_row = "[row ? -row : "+0"]"
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-6"
/datum/hud/proc/SetButtonCoords(obj/screen/button,number)
var/row = round((number-1)/AB_MAX_COLUMNS)
var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
var/x_offset = 32*(col-1) + 4 + 2*col
var/y_offset = -32*(row+1) + 26
var/matrix/M = matrix()
M.Translate(x_offset,y_offset)
button.transform = M
+218
View File
@@ -0,0 +1,218 @@
/obj/screen/ai
icon = 'icons/mob/screen_ai.dmi'
/obj/screen/ai/aicore
name = "AI core"
icon_state = "ai_core"
/obj/screen/ai/aicore/Click()
var/mob/living/silicon/ai/AI = usr
AI.view_core()
/obj/screen/ai/camera_list
name = "Show Camera List"
icon_state = "camera"
/obj/screen/ai/camera_list/Click()
var/mob/living/silicon/ai/AI = usr
var/camera = input(AI, "Choose which camera you want to view", "Cameras") as null|anything in AI.get_camera_list()
AI.ai_camera_list(camera)
/obj/screen/ai/camera_track
name = "Track With Camera"
icon_state = "track"
/obj/screen/ai/camera_track/Click()
var/mob/living/silicon/ai/AI = usr
var/target_name = input(AI, "Choose who you want to track", "Tracking") as null|anything in AI.trackable_mobs()
AI.ai_camera_track(target_name)
/obj/screen/ai/camera_light
name = "Toggle Camera Light"
icon_state = "camera_light"
/obj/screen/ai/camera_light/Click()
var/mob/living/silicon/ai/AI = usr
AI.toggle_camera_light()
/obj/screen/ai/crew_monitor
name = "Crew Monitoring Console"
icon_state = "crew_monitor"
/obj/screen/ai/crew_monitor/Click()
var/mob/living/silicon/ai/AI = usr
crewmonitor.show(AI)
/obj/screen/ai/crew_manifest
name = "Crew Manifest"
icon_state = "manifest"
/obj/screen/ai/crew_manifest/Click()
var/mob/living/silicon/ai/AI = usr
AI.ai_roster()
/obj/screen/ai/alerts
name = "Show Alerts"
icon_state = "alerts"
/obj/screen/ai/alerts/Click()
var/mob/living/silicon/ai/AI = usr
AI.ai_alerts()
/obj/screen/ai/announcement
name = "Make Announcement"
icon_state = "announcement"
/obj/screen/ai/announcement/Click()
var/mob/living/silicon/ai/AI = usr
AI.announcement()
/obj/screen/ai/call_shuttle
name = "Call Emergency Shuttle"
icon_state = "call_shuttle"
/obj/screen/ai/call_shuttle/Click()
var/mob/living/silicon/ai/AI = usr
AI.ai_call_shuttle()
/obj/screen/ai/state_laws
name = "State Laws"
icon_state = "state_laws"
/obj/screen/ai/state_laws/Click()
var/mob/living/silicon/ai/AI = usr
AI.checklaws()
/obj/screen/ai/pda_msg_send
name = "PDA - Send Message"
icon_state = "pda_send"
/obj/screen/ai/pda_msg_send/Click()
var/mob/living/silicon/ai/AI = usr
AI.cmd_send_pdamesg(usr)
/obj/screen/ai/pda_msg_show
name = "PDA - Show Message Log"
icon_state = "pda_receive"
/obj/screen/ai/pda_msg_show/Click()
var/mob/living/silicon/ai/AI = usr
AI.cmd_show_message_log(usr)
/obj/screen/ai/image_take
name = "Take Image"
icon_state = "take_picture"
/obj/screen/ai/image_take/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aicamera.toggle_camera_mode()
else if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.aicamera.toggle_camera_mode()
/obj/screen/ai/image_view
name = "View Images"
icon_state = "view_images"
/obj/screen/ai/image_view/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aicamera.viewpictures()
else if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.aicamera.viewpictures()
/obj/screen/ai/sensors
name = "Sensor Augmentation"
icon_state = "ai_sensor"
/obj/screen/ai/sensors/Click()
var/mob/living/silicon/S = usr
S.sensor_mode()
/datum/hud/ai/New(mob/owner)
..()
var/obj/screen/using
//AI core
using = new /obj/screen/ai/aicore()
using.screen_loc = ui_ai_core
static_inventory += using
//Camera list
using = new /obj/screen/ai/camera_list()
using.screen_loc = ui_ai_camera_list
static_inventory += using
//Track
using = new /obj/screen/ai/camera_track()
using.screen_loc = ui_ai_track_with_camera
static_inventory += using
//Camera light
using = new /obj/screen/ai/camera_light()
using.screen_loc = ui_ai_camera_light
static_inventory += using
//Crew Monitoring
using = new /obj/screen/ai/crew_monitor()
using.screen_loc = ui_ai_crew_monitor
static_inventory += using
//Crew Manifest
using = new /obj/screen/ai/crew_manifest()
using.screen_loc = ui_ai_crew_manifest
static_inventory += using
//Alerts
using = new /obj/screen/ai/alerts()
using.screen_loc = ui_ai_alerts
static_inventory += using
//Announcement
using = new /obj/screen/ai/announcement()
using.screen_loc = ui_ai_announcement
static_inventory += using
//Shuttle
using = new /obj/screen/ai/call_shuttle()
using.screen_loc = ui_ai_shuttle
static_inventory += using
//Laws
using = new /obj/screen/ai/state_laws()
using.screen_loc = ui_ai_state_laws
static_inventory += using
//PDA message
using = new /obj/screen/ai/pda_msg_send()
using.screen_loc = ui_ai_pda_send
static_inventory += using
//PDA log
using = new /obj/screen/ai/pda_msg_show()
using.screen_loc = ui_ai_pda_log
static_inventory += using
//Take image
using = new /obj/screen/ai/image_take()
using.screen_loc = ui_ai_take_picture
static_inventory += using
//View images
using = new /obj/screen/ai/image_view()
using.screen_loc = ui_ai_view_images
static_inventory += using
//Medical/Security sensors
using = new /obj/screen/ai/sensors()
using.screen_loc = ui_ai_sensor
static_inventory += using
/mob/living/silicon/ai/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/ai(src)
+413
View File
@@ -0,0 +1,413 @@
//A system to manage and display alerts on screen without needing you to do it yourself
//PUBLIC - call these wherever you want
/mob/proc/throw_alert(category, type, severity, obj/new_master)
/* Proc to create or update an alert. Returns the alert if the alert is new or updated, 0 if it was thrown already
category is a text string. Each mob may only have one alert per category; the previous one will be replaced
path is a type path of the actual alert type to throw
severity is an optional number that will be placed at the end of the icon_state for this alert
For example, high pressure's icon_state is "highpressure" and can be serverity 1 or 2 to get "highpressure1" or "highpressure2"
new_master is optional and sets the alert's icon state to "template" in the ui_style icons with the master as an overlay.
Clicks are forwarded to master */
if(!category)
return
var/obj/screen/alert/alert
if(alerts[category])
alert = alerts[category]
if(new_master && new_master != alert.master)
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [alert.master]")
clear_alert(category)
return .()
else if(alert.type != type)
clear_alert(category)
return .()
else if(!severity || severity == alert.severity)
if(alert.timeout)
clear_alert(category)
return .()
else //no need to update
return 0
else
alert = PoolOrNew(type)
if(new_master)
var/old_layer = new_master.layer
new_master.layer = FLOAT_LAYER
alert.overlays += new_master
new_master.layer = old_layer
alert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts()
alert.master = new_master
else
alert.icon_state = "[initial(alert.icon_state)][severity]"
alert.severity = severity
alerts[category] = alert
if(client && hud_used)
hud_used.reorganize_alerts()
alert.transform = matrix(32, 6, MATRIX_TRANSLATE)
animate(alert, transform = matrix(), time = 2.5, easing = CUBIC_EASING)
if(alert.timeout)
spawn(alert.timeout)
if(alert.timeout && alerts[category] == alert && world.time >= alert.timeout)
clear_alert(category)
alert.timeout = world.time + alert.timeout - world.tick_lag
return alert
// Proc to clear an existing alert.
/mob/proc/clear_alert(category)
var/obj/screen/alert/alert = alerts[category]
if(!alert)
return 0
alerts -= category
if(client && hud_used)
hud_used.reorganize_alerts()
client.screen -= alert
qdel(alert)
/obj/screen/alert
icon = 'icons/mob/screen_alert.dmi'
icon_state = "default"
name = "Alert"
desc = "Something seems to have gone wrong with this alert, so report this bug please"
mouse_opacity = 1
var/timeout = 0 //If set to a number, this alert will clear itself after that many deciseconds
var/severity = 0
var/alerttooltipstyle = ""
/obj/screen/alert/MouseEntered(location,control,params)
openToolTip(usr,src,params,title = name,content = desc,theme = alerttooltipstyle)
/obj/screen/alert/MouseExited()
closeToolTip(usr)
//Gas alerts
/obj/screen/alert/oxy
name = "Choking (No O2)"
desc = "You're not getting enough oxygen. Find some good air before you pass out! \
The box in your backpack has an oxygen tank and breath mask in it."
icon_state = "oxy"
/obj/screen/alert/too_much_oxy
name = "Choking (O2)"
desc = "There's too much oxygen in the air, and you're breathing it in! Find some good air before you pass out!"
icon_state = "too_much_oxy"
/obj/screen/alert/not_enough_co2
name = "Choking (No CO2)"
desc = "You're not getting enough carbon dioxide. Find some good air before you pass out!"
icon_state = "not_enough_co2"
/obj/screen/alert/too_much_co2
name = "Choking (CO2)"
desc = "There's too much carbon dioxide in the air, and you're breathing it in! Find some good air before you pass out!"
icon_state = "too_much_co2"
/obj/screen/alert/not_enough_tox
name = "Choking (No Plasma)"
desc = "You're not getting enough plasma. Find some good air before you pass out!"
icon_state = "not_enough_tox"
/obj/screen/alert/tox_in_air
name = "Choking (Plasma)"
desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. \
The box in your backpack has an oxygen tank and gas mask in it."
icon_state = "tox_in_air"
//End gas alerts
/obj/screen/alert/fat
name = "Fat"
desc = "You ate too much food, lardass. Run around the station and lose some weight."
icon_state = "fat"
/obj/screen/alert/hungry
name = "Hungry"
desc = "Some food would be good right about now."
icon_state = "hungry"
/obj/screen/alert/starving
name = "Starving"
desc = "You're severely malnourished. The hunger pains make moving around a chore."
icon_state = "starving"
/obj/screen/alert/hot
name = "Too Hot"
desc = "You're flaming hot! Get somewhere cooler and take off any insulating clothing like a fire suit."
icon_state = "hot"
/obj/screen/alert/cold
name = "Too Cold"
desc = "You're freezing cold! Get somewhere warmer and take off any insulating clothing like a space suit."
icon_state = "cold"
/obj/screen/alert/lowpressure
name = "Low Pressure"
desc = "The air around you is hazardously thin. A space suit would protect you."
icon_state = "lowpressure"
/obj/screen/alert/highpressure
name = "High Pressure"
desc = "The air around you is hazardously thick. A fire suit would protect you."
icon_state = "highpressure"
/obj/screen/alert/blind
name = "Blind"
desc = "You can't see! This may be caused by a genetic defect, eye trauma, being unconscious, \
or something covering your eyes."
icon_state = "blind"
/obj/screen/alert/high
name = "High"
desc = "Whoa man, you're tripping balls! Careful you don't get addicted... if you aren't already."
icon_state = "high"
/obj/screen/alert/drunk //Not implemented
name = "Drunk"
desc = "All that alcohol you've been drinking is impairing your speech, motor skills, and mental cognition. Make sure to act like it."
icon_state = "drunk"
/obj/screen/alert/embeddedobject
name = "Embedded Object"
desc = "Something got lodged into your flesh and is causing major bleeding. It might fall out with time, but surgery is the safest way. \
If you're feeling frisky, click yourself in help intent to pull the object out."
icon_state = "embeddedobject"
/obj/screen/alert/embeddedobject/Click()
if(isliving(usr))
var/mob/living/carbon/human/M = usr
return M.help_shake_act(M)
/obj/screen/alert/asleep
name = "Asleep"
desc = "You've fallen asleep. Wait a bit and you should wake up. Unless you don't, considering how helpless you are."
icon_state = "asleep"
/obj/screen/alert/weightless
name = "Weightless"
desc = "Gravity has ceased affecting you, and you're floating around aimlessly. You'll need something large and heavy, like a \
wall or lattice, to push yourself off if you want to move. A jetpack would enable free range of motion. A pair of \
magboots would let you walk around normally on the floor. Barring those, you can throw things, use a fire extinguisher, \
or shoot a gun to move around via Newton's 3rd Law of Motion."
icon_state = "weightless"
/obj/screen/alert/fire
name = "On Fire"
desc = "You're on fire. Stop, drop and roll to put the fire out or move to a vacuum area."
icon_state = "fire"
/obj/screen/alert/fire/Click()
if(isliving(usr))
var/mob/living/L = usr
return L.resist()
//ALIENS
/obj/screen/alert/alien_tox
name = "Plasma"
desc = "There's flammable plasma in the air. If it lights up, you'll be toast."
icon_state = "alien_tox"
alerttooltipstyle = "alien"
/obj/screen/alert/alien_fire
// This alert is temporarily gonna be thrown for all hot air but one day it will be used for literally being on fire
name = "Too Hot"
desc = "It's too hot! Flee to space or at least away from the flames. Standing on weeds will heal you."
icon_state = "alien_fire"
alerttooltipstyle = "alien"
/obj/screen/alert/alien_vulnerable
name = "Severed Matriarchy"
desc = "Your queen has been killed, you will suffer movement penalties and loss of hivemind. A new queen cannot be made until you recover."
icon_state = "alien_noqueen"
alerttooltipstyle = "alien"
//BLOBS
/obj/screen/alert/nofactory
name = "No Factory"
desc = "You have no factory, and are slowly dying!"
icon_state = "blobbernaut_nofactory"
alerttooltipstyle = "blob"
//GUARDIANS
/obj/screen/alert/cancharge
name = "Charge Ready"
desc = "You are ready to charge at a location!"
icon_state = "guardian_charge"
alerttooltipstyle = "parasite"
/obj/screen/alert/canstealth
name = "Stealth Ready"
desc = "You are ready to enter stealth!"
icon_state = "guardian_canstealth"
alerttooltipstyle = "parasite"
/obj/screen/alert/instealth
name = "In Stealth"
desc = "You are in stealth and your next attack will do bonus damage!"
icon_state = "guardian_instealth"
alerttooltipstyle = "parasite"
//SILICONS
/obj/screen/alert/nocell
name = "Missing Power Cell"
desc = "Unit has no power cell. No modules available until a power cell is reinstalled. Robotics may provide assistance."
icon_state = "nocell"
/obj/screen/alert/emptycell
name = "Out of Power"
desc = "Unit's power cell has no charge remaining. No modules available until power cell is recharged. \
Recharging stations are available in robotics, the dormitory bathrooms, and the AI satellite."
icon_state = "emptycell"
/obj/screen/alert/lowcell
name = "Low Charge"
desc = "Unit's power cell is running low. Recharging stations are available in robotics, the dormitory bathrooms, and the AI satellite."
icon_state = "lowcell"
//Need to cover all use cases - emag, illegal upgrade module, malf AI hack, traitor cyborg
/obj/screen/alert/hacked
name = "Hacked"
desc = "Hazardous non-standard equipment detected. Please ensure any usage of this equipment is in line with unit's laws, if any."
icon_state = "hacked"
/obj/screen/alert/locked
name = "Locked Down"
desc = "Unit has been remotely locked down. Usage of a Robotics Control Console like the one in the Research Director's \
office by your AI master or any qualified human may resolve this matter. Robotics may provide further assistance if necessary."
icon_state = "locked"
/obj/screen/alert/newlaw
name = "Law Update"
desc = "Laws have potentially been uploaded to or removed from this unit. Please be aware of any changes \
so as to remain in compliance with the most up-to-date laws."
icon_state = "newlaw"
timeout = 300
//MECHS
/obj/screen/alert/low_mech_integrity
name = "Mech Damaged"
desc = "Mech integrity is low."
icon_state = "low_mech_integrity"
//GHOSTS
//TODO: expand this system to replace the pollCandidates/CheckAntagonist/"choose quickly"/etc Yes/No messages
/obj/screen/alert/notify_cloning
name = "Revival"
desc = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!"
icon_state = "template"
timeout = 300
/obj/screen/alert/notify_cloning/Click()
if(!usr || !usr.client) return
var/mob/dead/observer/G = usr
G.reenter_corpse()
/obj/screen/alert/notify_action
name = "Body created"
desc = "A body was created. You can enter it."
icon_state = "template"
timeout = 300
var/atom/target = null
var/action = NOTIFY_JUMP
/obj/screen/alert/notify_action/Click()
if(!usr || !usr.client) return
if(!target) return
var/mob/dead/observer/G = usr
if(!istype(G)) return
switch(action)
if(NOTIFY_ATTACK)
target.attack_ghost(G)
if(NOTIFY_JUMP)
var/turf/T = get_turf(target)
if(T && isturf(T))
G.loc = T
if(NOTIFY_ORBIT)
G.ManualFollow(target)
//OBJECT-BASED
/obj/screen/alert/restrained/buckled
name = "Buckled"
desc = "You've been buckled to something. Click the alert to unbuckle unless you're handcuffed."
/obj/screen/alert/restrained/handcuffed
name = "Handcuffed"
desc = "You're handcuffed and can't act. If anyone drags you, you won't be able to move. Click the alert to free yourself."
/obj/screen/alert/restrained/legcuffed
name = "Legcuffed"
desc = "You're legcuffed, which slows you down considerably. Click the alert to free yourself."
/obj/screen/alert/restrained/Click()
if(isliving(usr))
var/mob/living/L = usr
return L.resist()
// PRIVATE = only edit, use, or override these if you're editing the system as a whole
// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
/datum/hud/proc/reorganize_alerts()
var/list/alerts = mymob.alerts
var/icon_pref
if(!hud_shown)
for(var/i = 1, i <= alerts.len, i++)
mymob.client.screen -= alerts[alerts[i]]
return 1
for(var/i = 1, i <= alerts.len, i++)
var/obj/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template")
if(!icon_pref)
icon_pref = ui_style2icon(mymob.client.prefs.UI_style)
alert.icon = icon_pref
switch(i)
if(1)
. = ui_alert1
if(2)
. = ui_alert2
if(3)
. = ui_alert3
if(4)
. = ui_alert4
if(5)
. = ui_alert5 // Right now there's 5 slots
else
. = ""
alert.screen_loc = .
mymob.client.screen |= alert
return 1
/mob
var/list/alerts = list() // contains /obj/screen/alert only // On /mob so clientless mobs will throw alerts properly
/obj/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
return
var/paramslist = params2list(params)
if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat
usr << "<span class='boldnotice'>[name]</span> - <span class='info'>[desc]</span>"
return
if(master)
return usr.client.Click(master, location, control, params)
/obj/screen/alert/Destroy()
..()
severity = 0
master = null
screen_loc = ""
return QDEL_HINT_PUTINPOOL //Don't destroy me, I have a family!
+142
View File
@@ -0,0 +1,142 @@
/obj/screen/alien
icon = 'icons/mob/screen_alien.dmi'
/obj/screen/alien/leap
name = "toggle leap"
icon_state = "leap_off"
/obj/screen/alien/leap/Click()
if(istype(usr, /mob/living/carbon/alien/humanoid/hunter))
var/mob/living/carbon/alien/humanoid/hunter/AH = usr
AH.toggle_leap()
/obj/screen/alien/nightvision
name = "toggle night-vision"
icon_state = "nightvision1"
screen_loc = ui_alien_nightvision
/obj/screen/alien/nightvision/Click()
var/mob/living/carbon/alien/A = usr
var/obj/effect/proc_holder/alien/nightvisiontoggle/T = locate() in A.abilities
if(T)
T.fire(A)
/obj/screen/alien/plasma_display
icon = 'icons/mob/screen_gen.dmi'
icon_state = "power_display2"
name = "plasma stored"
screen_loc = ui_alienplasmadisplay
/datum/hud/alien/New(mob/living/carbon/alien/humanoid/owner)
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
//equippable shit
//hands
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
//begin buttons
using = new /obj/screen/swap_hand()
using.icon = 'icons/mob/screen_alien.dmi'
using.icon_state = "swap_1"
using.screen_loc = ui_swaphand1
static_inventory += using
using = new /obj/screen/swap_hand()
using.icon = 'icons/mob/screen_alien.dmi'
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
static_inventory += using
using = new /obj/screen/act_intent/alien()
using.icon_state = mymob.a_intent
static_inventory += using
action_intent = using
if(istype(mymob, /mob/living/carbon/alien/humanoid/hunter))
var/mob/living/carbon/alien/humanoid/hunter/H = mymob
H.leap_icon = new /obj/screen/alien/leap()
H.leap_icon.screen_loc = ui_alien_storage_r
static_inventory += H.leap_icon
using = new /obj/screen/drop()
using.icon = 'icons/mob/screen_alien.dmi'
using.screen_loc = ui_drop_throw
static_inventory += using
using = new /obj/screen/resist()
using.icon = 'icons/mob/screen_alien.dmi'
using.screen_loc = ui_pull_resist
hotkeybuttons += using
throw_icon = new /obj/screen/throw_catch()
throw_icon.icon = 'icons/mob/screen_alien.dmi'
throw_icon.screen_loc = ui_drop_throw
hotkeybuttons += throw_icon
pull_icon = new /obj/screen/pull()
pull_icon.icon = 'icons/mob/screen_alien.dmi'
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_pull_resist
static_inventory += pull_icon
//begin indicators
healths = new /obj/screen/healths/alien()
infodisplay += healths
nightvisionicon = new /obj/screen/alien/nightvision()
infodisplay += nightvisionicon
alien_plasma_display = new /obj/screen/alien/plasma_display()
infodisplay += alien_plasma_display
zone_select = new /obj/screen/zone_sel/alien()
zone_select.update_icon(mymob)
static_inventory += zone_select
for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/alien/persistant_inventory_update()
if(!mymob)
return
var/mob/living/carbon/alien/humanoid/H = mymob
if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.r_hand.screen_loc = ui_rhand
H.client.screen += H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = ui_lhand
H.client.screen += H.l_hand
else
if(H.r_hand)
H.r_hand.screen_loc = null
if(H.l_hand)
H.l_hand.screen_loc = null
/mob/living/carbon/alien/humanoid/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/alien(src)
+29
View File
@@ -0,0 +1,29 @@
/datum/hud/larva/New(mob/owner)
..()
var/obj/screen/using
using = new /obj/screen/act_intent/alien()
using.icon_state = mymob.a_intent
static_inventory += using
action_intent = using
healths = new /obj/screen/healths/alien()
infodisplay += healths
nightvisionicon = new /obj/screen/alien/nightvision()
nightvisionicon.screen_loc = ui_alien_nightvision
infodisplay += nightvisionicon
pull_icon = new /obj/screen/pull()
pull_icon.icon = 'icons/mob/screen_alien.dmi'
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_pull_resist
hotkeybuttons += pull_icon
zone_select = new /obj/screen/zone_sel/alien()
zone_select.update_icon(mymob)
static_inventory += zone_select
/mob/living/carbon/alien/larva/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/larva(src)
+175
View File
@@ -0,0 +1,175 @@
/obj/screen/blob
icon = 'icons/mob/blob.dmi'
/obj/screen/blob/MouseEntered(location,control,params)
openToolTip(usr,src,params,title = name,content = desc, theme = "blob")
/obj/screen/blob/MouseExited()
closeToolTip(usr)
/obj/screen/blob/BlobHelp
icon_state = "ui_help"
name = "Blob Help"
desc = "Help on playing blob!"
/obj/screen/blob/BlobHelp/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.blob_help()
/obj/screen/blob/JumpToNode
icon_state = "ui_tonode"
name = "Jump to Node"
desc = "Moves your camera to a selected blob node."
/obj/screen/blob/JumpToNode/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.jump_to_node()
/obj/screen/blob/JumpToCore
icon_state = "ui_tocore"
name = "Jump to Core"
desc = "Moves your camera to your blob core."
/obj/screen/blob/JumpToCore/MouseEntered(location,control,params)
if(isovermind(usr))
var/mob/camera/blob/B = usr
if(!B.placed)
openToolTip(usr,src,params,title = "Place Blob Core",content = "Attempt to place your blob core at this location.", theme = "blob")
else
..()
/obj/screen/blob/JumpToCore/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
if(!B.placed)
B.place_blob_core(B.base_point_rate, 0)
B.transport_core()
/obj/screen/blob/Blobbernaut
icon_state = "ui_blobbernaut"
name = "Produce Blobbernaut (40)"
desc = "Produces a strong, smart blobbernaut from a factory blob for 40 points.<br>The factory blob used will become fragile and unable to produce spores."
/obj/screen/blob/Blobbernaut/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.create_blobbernaut()
/obj/screen/blob/ResourceBlob
icon_state = "ui_resource"
name = "Produce Resource Blob (40)"
desc = "Produces a resource blob for 40 points.<br>Resource blobs will give you points every few seconds."
/obj/screen/blob/ResourceBlob/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.create_resource()
/obj/screen/blob/NodeBlob
icon_state = "ui_node"
name = "Produce Node Blob (60)"
desc = "Produces a node blob for 60 points.<br>Node blobs will expand and activate nearby resource and factory blobs."
/obj/screen/blob/NodeBlob/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.create_node()
/obj/screen/blob/FactoryBlob
icon_state = "ui_factory"
name = "Produce Factory Blob (60)"
desc = "Produces a factory blob for 60 points.<br>Factory blobs will produce spores every few seconds."
/obj/screen/blob/FactoryBlob/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.create_factory()
/obj/screen/blob/ReadaptChemical
icon_state = "ui_chemswap"
name = "Readapt Chemical (40)"
desc = "Randomly rerolls your chemical for 40 points."
/obj/screen/blob/ReadaptChemical/MouseEntered(location,control,params)
if(isovermind(usr))
var/mob/camera/blob/B = usr
if(B.free_chem_rerolls)
openToolTip(usr,src,params,title = "Readapt Chemical (FREE)",content = "Randomly rerolls your chemical for free.", theme = "blob")
else
..()
/obj/screen/blob/ReadaptChemical/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.chemical_reroll()
/obj/screen/blob/RelocateCore
icon_state = "ui_swap"
name = "Relocate Core (80)"
desc = "Swaps a node and your core for 80 points."
/obj/screen/blob/RelocateCore/Click()
if(isovermind(usr))
var/mob/camera/blob/B = usr
B.relocate_core()
/datum/hud/blob_overmind/New(mob/owner)
..()
var/obj/screen/using
blobpwrdisplay = new /obj/screen()
blobpwrdisplay.name = "blob power"
blobpwrdisplay.icon_state = "block"
blobpwrdisplay.screen_loc = ui_health
blobpwrdisplay.mouse_opacity = 0
blobpwrdisplay.layer = ABOVE_HUD_LAYER
infodisplay += blobpwrdisplay
healths = new /obj/screen/healths/blob()
infodisplay += healths
using = new /obj/screen/blob/BlobHelp()
using.screen_loc = "WEST:6,NORTH:-3"
static_inventory += using
using = new /obj/screen/blob/JumpToNode()
using.screen_loc = ui_inventory
static_inventory += using
using = new /obj/screen/blob/JumpToCore()
using.screen_loc = ui_zonesel
static_inventory += using
using = new /obj/screen/blob/Blobbernaut()
using.screen_loc = ui_belt
static_inventory += using
using = new /obj/screen/blob/ResourceBlob()
using.screen_loc = ui_back
static_inventory += using
using = new /obj/screen/blob/NodeBlob()
using.screen_loc = ui_lhand
static_inventory += using
using = new /obj/screen/blob/FactoryBlob()
using.screen_loc = ui_rhand
static_inventory += using
using = new /obj/screen/blob/ReadaptChemical()
using.screen_loc = ui_storage1
static_inventory += using
using = new /obj/screen/blob/RelocateCore()
using.screen_loc = ui_storage2
static_inventory += using
/mob/camera/blob/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/blob_overmind(src)
+13
View File
@@ -0,0 +1,13 @@
/datum/hud/blobbernaut/New(mob/owner)
..()
blobpwrdisplay = new /obj/screen/healths/blob/naut/core()
infodisplay += blobpwrdisplay
healths = new /obj/screen/healths/blob/naut()
infodisplay += healths
/mob/living/simple_animal/hostile/blob/blobbernaut/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/blobbernaut(src)
+82
View File
@@ -0,0 +1,82 @@
//Soul counter is stored with the humans, it does weird when you place it here apparently...
/datum/hud/devil/New(mob/owner, ui_style = 'icons/mob/screen_midnight.dmi')
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
using = new /obj/screen/drop()
using.icon = ui_style
using.screen_loc = ui_drone_drop
static_inventory += using
pull_icon = new /obj/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_drone_pull
static_inventory += pull_icon
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
using = new /obj/screen/inventory()
using.name = "hand"
using.icon = ui_style
using.icon_state = "swap_1_m"
using.screen_loc = ui_swaphand1
using.layer = HUD_LAYER
static_inventory += using
using = new /obj/screen/inventory()
using.name = "hand"
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
using.layer = HUD_LAYER
static_inventory += using
zone_select = new /obj/screen/zone_sel()
zone_select.icon = ui_style
zone_select.update_icon(mymob)
lingchemdisplay = new /obj/screen/ling/chems()
devilsouldisplay = new /obj/screen/devil/soul_counter
infodisplay += devilsouldisplay
/datum/hud/devil/persistant_inventory_update()
if(!mymob)
return
var/mob/living/carbon/true_devil/D = mymob
if(hud_version != HUD_STYLE_NOHUD)
if(D.r_hand)
D.r_hand.screen_loc = ui_rhand
D.client.screen += D.r_hand
if(D.l_hand)
D.l_hand.screen_loc = ui_lhand
D.client.screen += D.l_hand
else
if(D.r_hand)
D.r_hand.screen_loc = null
if(D.l_hand)
D.l_hand.screen_loc = null
/mob/living/carbon/true_devil/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/devil(src, ui_style2icon(client.prefs.UI_style))
+111
View File
@@ -0,0 +1,111 @@
/datum/hud/drone/New(mob/owner, ui_style = 'icons/mob/screen_midnight.dmi')
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
using = new /obj/screen/drop()
using.icon = ui_style
using.screen_loc = ui_drone_drop
static_inventory += using
pull_icon = new /obj/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_drone_pull
static_inventory += pull_icon
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "internal storage"
inv_box.icon = ui_style
inv_box.icon_state = "suit_storage"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_drone_storage
inv_box.slot_id = slot_drone_storage
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "head/mask"
inv_box.icon = ui_style
inv_box.icon_state = "mask"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_drone_head
inv_box.slot_id = slot_head
static_inventory += inv_box
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_1_m"
using.screen_loc = ui_swaphand1
static_inventory += using
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
static_inventory += using
zone_select = new /obj/screen/zone_sel()
zone_select.icon = ui_style
zone_select.update_icon(mymob)
using = new /obj/screen/inventory/craft
using.icon = ui_style
static_inventory += using
for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/drone/persistant_inventory_update()
if(!mymob)
return
var/mob/living/simple_animal/drone/D = mymob
if(hud_shown)
if(D.internal_storage)
D.internal_storage.screen_loc = ui_drone_storage
D.client.screen += D.internal_storage
if(D.head)
D.head.screen_loc = ui_drone_head
D.client.screen += D.head
else
if(D.internal_storage)
D.internal_storage.screen_loc = null
if(D.head)
D.head.screen_loc = null
if(hud_version != HUD_STYLE_NOHUD)
if(D.r_hand)
D.r_hand.screen_loc = ui_rhand
D.client.screen += D.r_hand
if(D.l_hand)
D.l_hand.screen_loc = ui_lhand
D.client.screen += D.l_hand
else
if(D.r_hand)
D.r_hand.screen_loc = null
if(D.l_hand)
D.l_hand.screen_loc = null
/mob/living/simple_animal/drone/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/drone(src, ui_style2icon(client.prefs.UI_style))
+108
View File
@@ -0,0 +1,108 @@
/mob
var/list/screens = list()
/mob/proc/overlay_fullscreen(category, type, severity)
var/obj/screen/fullscreen/screen
if(screens[category])
screen = screens[category]
if(screen.type != type)
clear_fullscreen(category, FALSE)
return .()
else if(!severity || severity == screen.severity)
return null
else
screen = PoolOrNew(type)
screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity
screens[category] = screen
if(client && stat != DEAD)
client.screen += screen
return screen
/mob/proc/clear_fullscreen(category, animated = 10)
var/obj/screen/fullscreen/screen = screens[category]
if(!screen)
return
screens -= category
if(animated)
spawn(0)
animate(screen, alpha = 0, time = animated)
sleep(animated)
if(client)
client.screen -= screen
qdel(screen)
else
if(client)
client.screen -= screen
qdel(screen)
/mob/proc/clear_fullscreens()
for(var/category in screens)
clear_fullscreen(category)
/mob/proc/hide_fullscreens()
if(client)
for(var/category in screens)
client.screen -= screens[category]
/mob/proc/reload_fullscreen()
if(client && stat != DEAD) //dead mob do not see any of the fullscreen overlays that he has.
for(var/category in screens)
client.screen |= screens[category]
/obj/screen/fullscreen
icon = 'icons/mob/screen_full.dmi'
icon_state = "default"
screen_loc = "CENTER-7,CENTER-7"
layer = FULLSCREEN_LAYER
mouse_opacity = 0
var/severity = 0
/obj/screen/fullscreen/Destroy()
..()
severity = 0
return QDEL_HINT_PUTINPOOL
/obj/screen/fullscreen/brute
icon_state = "brutedamageoverlay"
layer = UI_DAMAGE_LAYER
/obj/screen/fullscreen/oxy
icon_state = "oxydamageoverlay"
layer = UI_DAMAGE_LAYER
/obj/screen/fullscreen/crit
icon_state = "passage"
layer = CRIT_LAYER
/obj/screen/fullscreen/blind
icon_state = "blackimageoverlay"
layer = BLIND_LAYER
/obj/screen/fullscreen/impaired
icon_state = "impairedoverlay"
/obj/screen/fullscreen/blurry
icon = 'icons/mob/screen_gen.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
icon_state = "blurry"
/obj/screen/fullscreen/flash
icon = 'icons/mob/screen_gen.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
icon_state = "flash"
/obj/screen/fullscreen/flash/noise
icon = 'icons/mob/screen_gen.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
icon_state = "noise"
/obj/screen/fullscreen/high
icon = 'icons/mob/screen_gen.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
icon_state = "druggy"
+63
View File
@@ -0,0 +1,63 @@
//Used for normal mobs that have hands.
/datum/hud/dextrous/New(mob/living/owner, ui_style = 'icons/mob/screen_midnight.dmi')
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
using = new /obj/screen/drop()
using.icon = ui_style
using.screen_loc = ui_drone_drop
static_inventory += using
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_1_m"
using.screen_loc = ui_swaphand1
static_inventory += using
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
static_inventory += using
mymob.client.screen = list()
for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/dextrous/persistant_inventory_update()
if(!mymob)
return
var/mob/living/D = mymob
if(hud_version != HUD_STYLE_NOHUD)
if(D.r_hand)
D.r_hand.screen_loc = ui_rhand
D.client.screen += D.r_hand
if(D.l_hand)
D.l_hand.screen_loc = ui_lhand
D.client.screen += D.l_hand
else
if(D.r_hand)
D.r_hand.screen_loc = null
if(D.l_hand)
D.l_hand.screen_loc = null
+74
View File
@@ -0,0 +1,74 @@
/obj/screen/ghost
icon = 'icons/mob/screen_ghost.dmi'
/obj/screen/ghost/MouseEntered()
flick(icon_state + "_anim", src)
/obj/screen/ghost/jumptomob
name = "Jump to mob"
icon_state = "jumptomob"
/obj/screen/ghost/jumptomob/Click()
var/mob/dead/observer/G = usr
G.jumptomob()
/obj/screen/ghost/orbit
name = "Orbit"
icon_state = "orbit"
/obj/screen/ghost/orbit/Click()
var/mob/dead/observer/G = usr
G.follow()
/obj/screen/ghost/reenter_corpse
name = "Reenter corpse"
icon_state = "reenter_corpse"
/obj/screen/ghost/reenter_corpse/Click()
var/mob/dead/observer/G = usr
G.reenter_corpse()
/obj/screen/ghost/teleport
name = "Teleport"
icon_state = "teleport"
/obj/screen/ghost/teleport/Click()
var/mob/dead/observer/G = usr
G.dead_tele()
/datum/hud/ghost/New(mob/owner)
..()
var/mob/dead/observer/G = mymob
if(!G.client.prefs.ghost_hud)
mymob.client.screen = null
return
var/obj/screen/using
using = new /obj/screen/ghost/jumptomob()
using.screen_loc = ui_ghost_jumptomob
static_inventory += using
using = new /obj/screen/ghost/orbit()
using.screen_loc = ui_ghost_orbit
static_inventory += using
using = new /obj/screen/ghost/reenter_corpse()
using.screen_loc = ui_ghost_reenter_corpse
static_inventory += using
using = new /obj/screen/ghost/teleport()
using.screen_loc = ui_ghost_teleport
static_inventory += using
/datum/hud/ghost/show_hud()
var/mob/dead/observer/G = mymob
mymob.client.screen = list()
if(!G.client.prefs.ghost_hud)
return
mymob.client.screen += static_inventory
/mob/dead/observer/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/ghost(src)
+96
View File
@@ -0,0 +1,96 @@
/datum/hud/guardian/New(mob/living/simple_animal/hostile/guardian/owner)
..()
var/obj/screen/using
healths = new /obj/screen/healths/guardian()
infodisplay += healths
using = new /obj/screen/guardian/Manifest()
using.screen_loc = ui_rhand
static_inventory += using
using = new /obj/screen/guardian/Recall()
using.screen_loc = ui_lhand
static_inventory += using
using = new owner.toggle_button_type()
using.screen_loc = ui_storage1
static_inventory += using
using = new /obj/screen/guardian/ToggleLight()
using.screen_loc = ui_inventory
static_inventory += using
using = new /obj/screen/guardian/Communicate()
using.screen_loc = ui_back
static_inventory += using
/mob/living/simple_animal/hostile/guardian/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/guardian(src)
/obj/screen/guardian
icon = 'icons/mob/guardian.dmi'
/obj/screen/guardian/Manifest
icon_state = "manifest"
name = "Manifest"
desc = "Spring forth into battle!"
/obj/screen/guardian/Manifest/Click()
if(isguardian(usr))
var/mob/living/simple_animal/hostile/guardian/G = usr
G.Manifest()
/obj/screen/guardian/Recall
icon_state = "recall"
name = "Recall"
desc = "Return to your user."
/obj/screen/guardian/Recall/Click()
if(isguardian(usr))
var/mob/living/simple_animal/hostile/guardian/G = usr
G.Recall()
/obj/screen/guardian/ToggleMode
icon_state = "toggle"
name = "Toggle Mode"
desc = "Switch between ability modes."
/obj/screen/guardian/ToggleMode/Click()
if(isguardian(usr))
var/mob/living/simple_animal/hostile/guardian/G = usr
G.ToggleMode()
/obj/screen/guardian/ToggleMode/Inactive
icon_state = "notoggle" //greyed out so it doesn't look like it'll work
/obj/screen/guardian/ToggleMode/Assassin
icon_state = "stealth"
name = "Toggle Stealth"
desc = "Enter or exit stealth."
/obj/screen/guardian/Communicate
icon_state = "communicate"
name = "Communicate"
desc = "Communicate telepathically with your user."
/obj/screen/guardian/Communicate/Click()
if(isguardian(usr))
var/mob/living/simple_animal/hostile/guardian/G = usr
G.Communicate()
/obj/screen/guardian/ToggleLight
icon_state = "light"
name = "Toggle Light"
desc = "Glow like star dust."
/obj/screen/guardian/ToggleLight/Click()
if(isguardian(usr))
var/mob/living/simple_animal/hostile/guardian/G = usr
G.ToggleLight()
+208
View File
@@ -0,0 +1,208 @@
/*
The hud datum
Used to show and hide huds for all the different mob types,
including inventories and item quick actions.
*/
/datum/hud
var/mob/mymob
var/hud_shown = 1 //Used for the HUD toggle (F12)
var/hud_version = 1 //Current displayed version of the HUD
var/inventory_shown = 1 //the inventory
var/show_intent_icons = 0
var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons)
var/obj/screen/ling/chems/lingchemdisplay
var/obj/screen/ling/sting/lingstingdisplay
var/obj/screen/blobpwrdisplay
var/obj/screen/alien_plasma_display
var/obj/screen/devil/soul_counter/devilsouldisplay
var/obj/screen/deity_power_display
var/obj/screen/deity_follower_display
var/obj/screen/nightvisionicon
var/obj/screen/action_intent
var/obj/screen/zone_select
var/obj/screen/pull_icon
var/obj/screen/throw_icon
var/obj/screen/module_store_icon
var/list/static_inventory = list() //the screen objects which are static
var/list/toggleable_inventory = list() //the screen objects which can be hidden
var/list/obj/screen/hotkeybuttons = list() //the buttons that can be used via hotkeys
var/list/infodisplay = list() //the screen objects that display mob info (health, alien plasma, etc...)
var/list/screenoverlays = list() //the screen objects used as whole screen overlays (flash, damageoverlay, etc...)
var/list/inv_slots[slots_amt] // /obj/screen/inventory objects, ordered by their slot ID.
var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = 0
var/obj/screen/healths
var/obj/screen/healthdoll
var/obj/screen/internals
/datum/hud/New(mob/owner)
mymob = owner
hide_actions_toggle = new
hide_actions_toggle.InitialiseIcon(mymob)
/datum/hud/Destroy()
if(mymob.hud_used == src)
mymob.hud_used = null
qdel(hide_actions_toggle)
hide_actions_toggle = null
qdel(module_store_icon)
module_store_icon = null
if(static_inventory.len)
for(var/thing in static_inventory)
qdel(thing)
static_inventory.Cut()
inv_slots.Cut()
action_intent = null
zone_select = null
pull_icon = null
if(toggleable_inventory.len)
for(var/thing in toggleable_inventory)
qdel(thing)
toggleable_inventory.Cut()
if(hotkeybuttons.len)
for(var/thing in hotkeybuttons)
qdel(thing)
hotkeybuttons.Cut()
throw_icon = null
if(infodisplay.len)
for(var/thing in infodisplay)
qdel(thing)
infodisplay.Cut()
healths = null
healthdoll = null
internals = null
lingchemdisplay = null
devilsouldisplay = null
lingstingdisplay = null
blobpwrdisplay = null
alien_plasma_display = null
deity_power_display = null
deity_follower_display = null
nightvisionicon = null
if(screenoverlays.len)
for(var/thing in screenoverlays)
qdel(thing)
screenoverlays.Cut()
mymob = null
return ..()
/mob/proc/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud(src)
//Version denotes which style should be displayed. blank or 0 means "next version"
/datum/hud/proc/show_hud(version = 0)
if(!ismob(mymob))
return 0
if(!mymob.client)
return 0
mymob.client.screen = list()
var/display_hud_version = version
if(!display_hud_version) //If 0 or blank, display the next hud version
display_hud_version = hud_version + 1
if(display_hud_version > HUD_VERSIONS) //If the requested version number is greater than the available versions, reset back to the first version
display_hud_version = 1
switch(display_hud_version)
if(HUD_STYLE_STANDARD) //Default HUD
hud_shown = 1 //Governs behavior of other procs
if(static_inventory.len)
mymob.client.screen += static_inventory
if(toggleable_inventory.len && inventory_shown)
mymob.client.screen += toggleable_inventory
if(hotkeybuttons.len && !hotkey_ui_hidden)
mymob.client.screen += hotkeybuttons
if(infodisplay.len)
mymob.client.screen += infodisplay
mymob.client.screen += hide_actions_toggle
if(action_intent)
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position
if(HUD_STYLE_REDUCED) //Reduced HUD
hud_shown = 0 //Governs behavior of other procs
if(static_inventory.len)
mymob.client.screen -= static_inventory
if(toggleable_inventory.len)
mymob.client.screen -= toggleable_inventory
if(hotkeybuttons.len)
mymob.client.screen -= hotkeybuttons
if(infodisplay.len)
mymob.client.screen += infodisplay
//These ones are a part of 'static_inventory', 'toggleable_inventory' or 'hotkeybuttons' but we want them to stay
if(inv_slots[slot_l_hand])
mymob.client.screen += inv_slots[slot_l_hand] //we want the hands to be visible
if(inv_slots[slot_r_hand])
mymob.client.screen += inv_slots[slot_r_hand] //we want the hands to be visible
if(action_intent)
mymob.client.screen += action_intent //we want the intent switcher visible
action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
if(HUD_STYLE_NOHUD) //No HUD
hud_shown = 0 //Governs behavior of other procs
if(static_inventory.len)
mymob.client.screen -= static_inventory
if(toggleable_inventory.len)
mymob.client.screen -= toggleable_inventory
if(hotkeybuttons.len)
mymob.client.screen -= hotkeybuttons
if(infodisplay.len)
mymob.client.screen -= infodisplay
hud_version = display_hud_version
persistant_inventory_update()
mymob.update_action_buttons(1)
reorganize_alerts()
mymob.reload_fullscreen()
/datum/hud/human/show_hud(version = 0)
..()
hidden_inventory_update()
/datum/hud/robot/show_hud(version = 0)
..()
update_robot_modules_display()
/datum/hud/proc/hidden_inventory_update()
return
/datum/hud/proc/persistant_inventory_update()
return
//Triggered when F12 is pressed (Unless someone changed something in the DMF)
/mob/verb/button_pressed_F12()
set name = "F12"
set hidden = 1
if(hud_used && client)
hud_used.show_hud() //Shows the next hud preset
usr << "<span class ='info'>Switched HUD mode. Press F12 to toggle.</span>"
else
usr << "<span class ='warning'>This mob type does not use a HUD.</span>"
+414
View File
@@ -0,0 +1,414 @@
/obj/screen/human
icon = 'icons/mob/screen_midnight.dmi'
/obj/screen/human/toggle
name = "toggle"
icon_state = "toggle"
/obj/screen/human/toggle/Click()
if(usr.hud_used.inventory_shown)
usr.hud_used.inventory_shown = 0
usr.client.screen -= usr.hud_used.toggleable_inventory
else
usr.hud_used.inventory_shown = 1
usr.client.screen += usr.hud_used.toggleable_inventory
usr.hud_used.hidden_inventory_update()
/obj/screen/human/equip
name = "equip"
icon_state = "act_equip"
/obj/screen/human/equip/Click()
if(istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
return 1
var/mob/living/carbon/human/H = usr
H.quick_equip()
/obj/screen/devil
invisibility = INVISIBILITY_ABSTRACT
/obj/screen/devil/soul_counter
icon = 'icons/mob/screen_gen.dmi'
name = "souls owned"
icon_state = "Devil-6"
screen_loc = ui_devilsouldisplay
/obj/screen/devil/soul_counter/proc/update_counter(souls = 0)
invisibility = 0
maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#FF0000'>[souls]</font></div>"
switch(souls)
if(0,null)
icon_state = "Devil-1"
if(1,2)
icon_state = "Devil-2"
if(3 to 5)
icon_state = "Devil-3"
if(6 to 8)
icon_state = "Devil-4"
if(9 to INFINITY)
icon_state = "Devil-5"
else
icon_state = "Devil-6"
/obj/screen/devil/soul_counter/proc/clear()
invisibility = INVISIBILITY_ABSTRACT
/obj/screen/ling
invisibility = INVISIBILITY_ABSTRACT
/obj/screen/ling/sting
name = "current sting"
screen_loc = ui_lingstingdisplay
/obj/screen/ling/sting/Click()
var/mob/living/carbon/U = usr
U.unset_sting()
/obj/screen/ling/chems
name = "chemical storage"
icon_state = "power_display"
screen_loc = ui_lingchemdisplay
/mob/living/carbon/human/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/human(src, ui_style2icon(client.prefs.UI_style))
/datum/hud/human/New(mob/living/carbon/human/owner, ui_style = 'icons/mob/screen_midnight.dmi')
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
using = new /obj/screen/inventory/craft
using.icon = ui_style
static_inventory += using
using = new /obj/screen/act_intent()
using.icon_state = mymob.a_intent
static_inventory += using
action_intent = using
using = new /obj/screen/mov_intent()
using.icon = ui_style
using.icon_state = (mymob.m_intent == "run" ? "running" : "walking")
using.screen_loc = ui_movi
static_inventory += using
using = new /obj/screen/drop()
using.icon = ui_style
using.screen_loc = ui_drop_throw
static_inventory += using
inv_box = new /obj/screen/inventory()
inv_box.name = "i_clothing"
inv_box.icon = ui_style
inv_box.slot_id = slot_w_uniform
inv_box.icon_state = "uniform"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_iclothing
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "o_clothing"
inv_box.icon = ui_style
inv_box.slot_id = slot_wear_suit
inv_box.icon_state = "suit"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_oclothing
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_1"
using.screen_loc = ui_swaphand1
static_inventory += using
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
static_inventory += using
inv_box = new /obj/screen/inventory()
inv_box.name = "id"
inv_box.icon = ui_style
inv_box.icon_state = "id"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_id
inv_box.slot_id = slot_wear_id
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "mask"
inv_box.icon = ui_style
inv_box.icon_state = "mask"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_mask
inv_box.slot_id = slot_wear_mask
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "back"
inv_box.icon = ui_style
inv_box.icon_state = "back"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_back
inv_box.slot_id = slot_back
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "storage1"
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_storage1
inv_box.slot_id = slot_l_store
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "storage2"
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_storage2
inv_box.slot_id = slot_r_store
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "suit storage"
inv_box.icon = ui_style
inv_box.icon_state = "suit_storage"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_sstore1
inv_box.slot_id = slot_s_store
static_inventory += inv_box
using = new /obj/screen/resist()
using.icon = ui_style
using.screen_loc = ui_pull_resist
hotkeybuttons += using
using = new /obj/screen/human/toggle()
using.icon = ui_style
using.screen_loc = ui_inventory
static_inventory += using
using = new /obj/screen/human/equip()
using.icon = ui_style
using.screen_loc = ui_equip
static_inventory += using
inv_box = new /obj/screen/inventory()
inv_box.name = "gloves"
inv_box.icon = ui_style
inv_box.icon_state = "gloves"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_gloves
inv_box.slot_id = slot_gloves
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "eyes"
inv_box.icon = ui_style
inv_box.icon_state = "glasses"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_glasses
inv_box.slot_id = slot_glasses
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "ears"
inv_box.icon = ui_style
inv_box.icon_state = "ears"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_ears
inv_box.slot_id = slot_ears
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "head"
inv_box.icon = ui_style
inv_box.icon_state = "head"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_head
inv_box.slot_id = slot_head
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "shoes"
inv_box.icon = ui_style
inv_box.icon_state = "shoes"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_shoes
inv_box.slot_id = slot_shoes
toggleable_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "belt"
inv_box.icon = ui_style
inv_box.icon_state = "belt"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_belt
inv_box.slot_id = slot_belt
static_inventory += inv_box
throw_icon = new /obj/screen/throw_catch()
throw_icon.icon = ui_style
throw_icon.screen_loc = ui_drop_throw
hotkeybuttons += throw_icon
internals = new /obj/screen/internals()
infodisplay += internals
healths = new /obj/screen/healths()
infodisplay += healths
healthdoll = new /obj/screen/healthdoll()
infodisplay += healthdoll
pull_icon = new /obj/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_pull_resist
static_inventory += pull_icon
lingchemdisplay = new /obj/screen/ling/chems()
infodisplay += lingchemdisplay
lingstingdisplay = new /obj/screen/ling/sting()
infodisplay += lingstingdisplay
devilsouldisplay = new /obj/screen/devil/soul_counter
infodisplay += devilsouldisplay
zone_select = new /obj/screen/zone_sel()
zone_select.icon = ui_style
zone_select.update_icon(mymob)
static_inventory += zone_select
inventory_shown = 0
for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/human/hidden_inventory_update()
if(!mymob)
return
var/mob/living/carbon/human/H = mymob
if(inventory_shown && hud_shown)
if(H.shoes)
H.shoes.screen_loc = ui_shoes
H.client.screen += H.shoes
if(H.gloves)
H.gloves.screen_loc = ui_gloves
H.client.screen += H.gloves
if(H.ears)
H.ears.screen_loc = ui_ears
H.client.screen += H.ears
if(H.glasses)
H.glasses.screen_loc = ui_glasses
H.client.screen += H.glasses
if(H.w_uniform)
H.w_uniform.screen_loc = ui_iclothing
H.client.screen += H.w_uniform
if(H.wear_suit)
H.wear_suit.screen_loc = ui_oclothing
H.client.screen += H.wear_suit
if(H.wear_mask)
H.wear_mask.screen_loc = ui_mask
H.client.screen += H.wear_mask
if(H.head)
H.head.screen_loc = ui_head
H.client.screen += H.head
else
if(H.shoes) H.shoes.screen_loc = null
if(H.gloves) H.gloves.screen_loc = null
if(H.ears) H.ears.screen_loc = null
if(H.glasses) H.glasses.screen_loc = null
if(H.w_uniform) H.w_uniform.screen_loc = null
if(H.wear_suit) H.wear_suit.screen_loc = null
if(H.wear_mask) H.wear_mask.screen_loc = null
if(H.head) H.head.screen_loc = null
/datum/hud/human/persistant_inventory_update()
if(!mymob)
return
var/mob/living/carbon/human/H = mymob
if(hud_shown)
if(H.s_store)
H.s_store.screen_loc = ui_sstore1
H.client.screen += H.s_store
if(H.wear_id)
H.wear_id.screen_loc = ui_id
H.client.screen += H.wear_id
if(H.belt)
H.belt.screen_loc = ui_belt
H.client.screen += H.belt
if(H.back)
H.back.screen_loc = ui_back
H.client.screen += H.back
if(H.l_store)
H.l_store.screen_loc = ui_storage1
H.client.screen += H.l_store
if(H.r_store)
H.r_store.screen_loc = ui_storage2
H.client.screen += H.r_store
else
if(H.s_store)
H.s_store.screen_loc = null
if(H.wear_id)
H.wear_id.screen_loc = null
if(H.belt)
H.belt.screen_loc = null
if(H.back)
H.back.screen_loc = null
if(H.l_store)
H.l_store.screen_loc = null
if(H.r_store)
H.r_store.screen_loc = null
if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.r_hand.screen_loc = ui_rhand
H.client.screen += H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = ui_lhand
H.client.screen += H.l_hand
else
if(H.r_hand)
H.r_hand.screen_loc = null
if(H.l_hand)
H.l_hand.screen_loc = null
/mob/living/carbon/human/verb/toggle_hotkey_verbs()
set category = "OOC"
set name = "Toggle hotkey buttons"
set desc = "This disables or enables the user interface buttons which can be used with hotkeys."
if(hud_used.hotkey_ui_hidden)
client.screen += hud_used.hotkeybuttons
hud_used.hotkey_ui_hidden = 0
else
client.screen -= hud_used.hotkeybuttons
hud_used.hotkey_ui_hidden = 1
+159
View File
@@ -0,0 +1,159 @@
/datum/hud/monkey/New(mob/living/carbon/monkey/owner, ui_style = 'icons/mob/screen_midnight.dmi')
..()
var/obj/screen/using
var/obj/screen/inventory/inv_box
using = new /obj/screen/act_intent()
using.icon = ui_style
using.icon_state = mymob.a_intent
using.screen_loc = ui_acti
static_inventory += using
action_intent = using
using = new /obj/screen/mov_intent()
using.icon = ui_style
using.icon_state = (mymob.m_intent == "run" ? "running" : "walking")
using.screen_loc = ui_movi
static_inventory += using
using = new /obj/screen/drop()
using.icon = ui_style
using.screen_loc = ui_drop_throw
static_inventory += using
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "right hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
static_inventory += inv_box
inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
static_inventory += inv_box
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_1_m" //extra wide!
using.screen_loc = ui_swaphand1
static_inventory += using
using = new /obj/screen/swap_hand()
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand2
static_inventory += using
inv_box = new /obj/screen/inventory()
inv_box.name = "mask"
inv_box.icon = ui_style
inv_box.icon_state = "mask"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_monkey_mask
inv_box.slot_id = slot_wear_mask
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "head"
inv_box.icon = ui_style
inv_box.icon_state = "head"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_monkey_head
inv_box.slot_id = slot_head
static_inventory += inv_box
inv_box = new /obj/screen/inventory()
inv_box.name = "back"
inv_box.icon = ui_style
inv_box.icon_state = "back"
inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_back
inv_box.slot_id = slot_back
static_inventory += inv_box
throw_icon = new /obj/screen/throw_catch()
throw_icon.icon = ui_style
throw_icon.screen_loc = ui_drop_throw
hotkeybuttons += throw_icon
internals = new /obj/screen/internals()
infodisplay += internals
healths = new /obj/screen/healths()
infodisplay += healths
pull_icon = new /obj/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_pull_resist
static_inventory += pull_icon
lingchemdisplay = new /obj/screen/ling/chems()
infodisplay += lingchemdisplay
lingstingdisplay = new /obj/screen/ling/sting()
infodisplay += lingstingdisplay
zone_select = new /obj/screen/zone_sel()
zone_select.icon = ui_style
zone_select.update_icon(mymob)
static_inventory += zone_select
mymob.client.screen = list()
using = new /obj/screen/resist()
using.icon = ui_style
using.screen_loc = ui_pull_resist
hotkeybuttons += using
for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/monkey/persistant_inventory_update()
if(!mymob)
return
var/mob/living/carbon/monkey/M = mymob
if(hud_shown)
if(M.back)
M.back.screen_loc = ui_back
M.client.screen += M.back
if(M.wear_mask)
M.wear_mask.screen_loc = ui_monkey_mask
M.client.screen += M.wear_mask
if(M.head)
M.head.screen_loc = ui_monkey_head
M.client.screen += M.head
else
if(M.back)
M.back.screen_loc = null
if(M.wear_mask)
M.wear_mask.screen_loc = null
if(M.head)
M.head.screen_loc = null
if(hud_version != HUD_STYLE_NOHUD)
if(M.r_hand)
M.r_hand.screen_loc = ui_rhand
M.client.screen += M.r_hand
if(M.l_hand)
M.l_hand.screen_loc = ui_lhand
M.client.screen += M.l_hand
else
if(M.r_hand)
M.r_hand.screen_loc = null
if(M.l_hand)
M.l_hand.screen_loc = null
/mob/living/carbon/monkey/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/monkey(src, ui_style2icon(client.prefs.UI_style))
@@ -0,0 +1,85 @@
//////////////////////////
//Movable Screen Objects//
// By RemieRichards //
//////////////////////////
//Movable Screen Object
//Not tied to the grid, places it's center where the cursor is
/obj/screen/movable
var/snap2grid = FALSE
var/moved = FALSE
//Snap Screen Object
//Tied to the grid, snaps to the nearest turf
/obj/screen/movable/snap
snap2grid = TRUE
/obj/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params)
var/list/PM = params2list(params)
//No screen-loc information? abort.
if(!PM || !PM["screen-loc"])
return
//Split screen-loc up into X+Pixel_X and Y+Pixel_Y
var/list/screen_loc_params = splittext(PM["screen-loc"], ",")
//Split X+Pixel_X up into list(X, Pixel_X)
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
if(snap2grid) //Discard Pixel Values
screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]"
else //Normalise Pixel Values (So the object drops at the center of the mouse, not 16 pixels off)
var/pix_X = text2num(screen_loc_X[2]) - 16
var/pix_Y = text2num(screen_loc_Y[2]) - 16
screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]"
moved = screen_loc
//Debug procs
/client/proc/test_movable_UI()
set category = "Debug"
set name = "Spawn Movable UI Object"
var/obj/screen/movable/M = new()
M.name = "Movable UI Object"
M.icon_state = "block"
M.maptext = "Movable"
M.maptext_width = 64
var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text
if(!screen_l)
return
M.screen_loc = screen_l
screen += M
/client/proc/test_snap_UI()
set category = "Debug"
set name = "Spawn Snap UI Object"
var/obj/screen/movable/snap/S = new()
S.name = "Snap UI Object"
S.icon_state = "block"
S.maptext = "Snap"
S.maptext_width = 64
var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text
if(!screen_l)
return
S.screen_loc = screen_l
screen += S
+41
View File
@@ -0,0 +1,41 @@
/datum/hud/brain/show_hud(version = 0)
if(!ismob(mymob))
return 0
if(!mymob.client)
return 0
mymob.client.screen = list()
mymob.client.screen += mymob.client.void
/mob/living/carbon/brain/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/brain(src)
/datum/hud/hog_god/New(mob/owner)
..()
healths = new /obj/screen/healths/deity()
infodisplay += healths
deity_power_display = new /obj/screen/deity_power_display()
infodisplay += deity_power_display
deity_follower_display = new /obj/screen/deity_follower_display()
infodisplay += deity_follower_display
/mob/camera/god/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/hog_god(src)
/obj/screen/deity_power_display
name = "Faith"
icon_state = "deity_power"
screen_loc = ui_deitypower
layer = HUD_LAYER
/obj/screen/deity_follower_display
name = "Followers"
icon_state = "deity_followers"
screen_loc = ui_deityfollowers
layer = HUD_LAYER
+10
View File
@@ -0,0 +1,10 @@
/datum/hud/revenant/New(mob/owner)
..()
healths = new /obj/screen/healths/revenant()
infodisplay += healths
/mob/living/simple_animal/revenant/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/revenant(src)
+242
View File
@@ -0,0 +1,242 @@
/obj/screen/robot
icon = 'icons/mob/screen_cyborg.dmi'
/obj/screen/robot/module
name = "cyborg module"
icon_state = "nomod"
/obj/screen/robot/module/Click()
var/mob/living/silicon/robot/R = usr
if(R.module)
R.hud_used.toggle_show_robot_modules()
return 1
R.pick_module()
/obj/screen/robot/module1
name = "module1"
icon_state = "inv1"
/obj/screen/robot/module1/Click()
var/mob/living/silicon/robot/R = usr
R.toggle_module(1)
/obj/screen/robot/module2
name = "module2"
icon_state = "inv2"
/obj/screen/robot/module2/Click()
var/mob/living/silicon/robot/R = usr
R.toggle_module(2)
/obj/screen/robot/module3
name = "module3"
icon_state = "inv3"
/obj/screen/robot/module3/Click()
var/mob/living/silicon/robot/R = usr
R.toggle_module(3)
/obj/screen/robot/radio
name = "radio"
icon_state = "radio"
/obj/screen/robot/radio/Click()
var/mob/living/silicon/robot/R = usr
R.radio.interact(R)
/obj/screen/robot/store
name = "store"
icon_state = "store"
/obj/screen/robot/store/Click()
var/mob/living/silicon/robot/R = usr
R.uneq_active()
/obj/screen/robot/lamp
name = "headlamp"
icon_state = "lamp0"
/obj/screen/robot/lamp/Click()
var/mob/living/silicon/robot/R = usr
R.control_headlamp()
/obj/screen/robot/thrusters
name = "ion thrusters"
icon_state = "ionpulse0"
/obj/screen/robot/thrusters/Click()
var/mob/living/silicon/robot/R = usr
R.toggle_ionpulse()
/datum/hud/robot/New(mob/owner)
..()
var/mob/living/silicon/robot/mymobR = mymob
var/obj/screen/using
//Radio
using = new /obj/screen/robot/radio()
using.screen_loc = ui_borg_radio
static_inventory += using
//Module select
using = new /obj/screen/robot/module1()
using.screen_loc = ui_inv1
static_inventory += using
mymobR.inv1 = using
using = new /obj/screen/robot/module2()
using.screen_loc = ui_inv2
static_inventory += using
mymobR.inv2 = using
using = new /obj/screen/robot/module3()
using.screen_loc = ui_inv3
static_inventory += using
mymobR.inv3 = using
//End of module select
//Photography stuff
using = new /obj/screen/ai/image_take()
using.screen_loc = ui_borg_camera
static_inventory += using
using = new /obj/screen/ai/image_view()
using.screen_loc = ui_borg_album
static_inventory += using
//Sec/Med HUDs
using = new /obj/screen/ai/sensors()
using.screen_loc = ui_borg_sensor
static_inventory += using
//Headlamp control
using = new /obj/screen/robot/lamp()
using.screen_loc = ui_borg_lamp
static_inventory += using
mymobR.lamp_button = using
//Thrusters
using = new /obj/screen/robot/thrusters()
using.screen_loc = ui_borg_thrusters
static_inventory += using
mymobR.thruster_button = using
//Intent
using = new /obj/screen/act_intent/robot()
using.icon_state = mymob.a_intent
static_inventory += using
action_intent = using
//Health
healths = new /obj/screen/healths/robot()
infodisplay += healths
//Installed Module
mymob.hands = new /obj/screen/robot/module()
mymob.hands.screen_loc = ui_borg_module
static_inventory += mymob.hands
//Store
module_store_icon = new /obj/screen/robot/store()
module_store_icon.screen_loc = ui_borg_store
pull_icon = new /obj/screen/pull()
pull_icon.icon = 'icons/mob/screen_cyborg.dmi'
pull_icon.update_icon(mymob)
pull_icon.screen_loc = ui_borg_pull
hotkeybuttons += pull_icon
zone_select = new /obj/screen/zone_sel/robot()
zone_select.update_icon(mymob)
static_inventory += zone_select
/datum/hud/proc/toggle_show_robot_modules()
if(!isrobot(mymob)) return
var/mob/living/silicon/robot/r = mymob
r.shown_robot_modules = !r.shown_robot_modules
update_robot_modules_display()
/datum/hud/proc/update_robot_modules_display()
if(!isrobot(mymob)) return
var/mob/living/silicon/robot/r = mymob
if(!r.client)
return
if(!r.module)
return
if(r.shown_robot_modules && hud_shown)
//Modules display is shown
r.client.screen += module_store_icon //"store" icon
if(!r.module.modules)
usr << "<span class='danger'>Selected module has no modules to select</span>"
return
if(!r.robot_modules_background)
return
var/display_rows = Ceiling(length(r.module.get_inactive_modules()) / 8)
r.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
r.client.screen += r.robot_modules_background
var/x = -4 //Start at CENTER-4,SOUTH+1
var/y = 1
for(var/atom/movable/A in r.module.get_inactive_modules())
//Module is not currently active
r.client.screen += A
if(x < 0)
A.screen_loc = "CENTER[x]:16,SOUTH+[y]:7"
else
A.screen_loc = "CENTER+[x]:16,SOUTH+[y]:7"
A.layer = ABOVE_HUD_LAYER
x++
if(x == 4)
x = -4
y++
else
//Modules display is hidden
r.client.screen -= module_store_icon //"store" icon
for(var/atom/A in r.module.get_inactive_modules())
//Module is not currently active
r.client.screen -= A
r.shown_robot_modules = 0
r.client.screen -= r.robot_modules_background
/mob/living/silicon/robot/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/robot(src)
/datum/hud/robot/persistant_inventory_update()
if(!mymob)
return
var/mob/living/silicon/robot/R = mymob
if(hud_shown)
if(R.module_state_1)
R.module_state_1.screen_loc = ui_inv1
R.client.screen += R.module_state_1
if(R.module_state_2)
R.module_state_2.screen_loc = ui_inv2
R.client.screen += R.module_state_2
if(R.module_state_3)
R.module_state_3.screen_loc = ui_inv3
R.client.screen += R.module_state_3
else
if(R.module_state_1)
R.module_state_1.screen_loc = null
if(R.module_state_2)
R.module_state_2.screen_loc = null
if(R.module_state_3)
R.module_state_3.screen_loc = null
+467
View File
@@ -0,0 +1,467 @@
/*
Screen objects
Todo: improve/re-implement
Screen objects are only used for the hud and should not appear anywhere "in-game".
They are used with the client/screen list and the screen_loc var.
For more information, see the byond documentation on the screen_loc and screen vars.
*/
/obj/screen
name = ""
icon = 'icons/mob/screen_gen.dmi'
layer = ABOVE_HUD_LAYER
unacidable = 1
appearance_flags = APPEARANCE_UI
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
var/datum/hud/hud = null // A reference to the owner HUD, if any.
/obj/screen/Destroy()
master = null
return ..()
/obj/screen/text
icon = null
icon_state = null
mouse_opacity = 0
screen_loc = "CENTER-7,CENTER-7"
maptext_height = 480
maptext_width = 480
/obj/screen/swap_hand
layer = HUD_LAYER
name = "swap hand"
/obj/screen/swap_hand/Click()
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
return 1
if(usr.incapacitated())
return 1
if(ismob(usr))
var/mob/M = usr
M.swap_hand()
return 1
/obj/screen/inventory/craft
name = "crafting menu"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "craft"
screen_loc = ui_crafting
/obj/screen/inventory/craft/Click()
var/mob/living/M = usr
M.OpenCraftingMenu()
/obj/screen/inventory
var/slot_id // The indentifier for the slot. It has nothing to do with ID cards.
var/icon_empty // Icon when empty. For now used only by humans.
var/icon_full // Icon when contains an item. For now used only by humans.
layer = HUD_LAYER
/obj/screen/inventory/Click()
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
return 1
if(usr.incapacitated())
return 1
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
return 1
if(usr.attack_ui(slot_id))
usr.update_inv_l_hand(0)
usr.update_inv_r_hand(0)
return 1
/obj/screen/inventory/update_icon()
if(!icon_empty)
icon_empty = icon_state
if(hud && hud.mymob && slot_id && icon_full)
if(hud.mymob.get_item_by_slot(slot_id))
icon_state = icon_full
else
icon_state = icon_empty
/obj/screen/inventory/hand
var/image/active_overlay
var/image/handcuff_overlay
var/image/blocked_overlay
/obj/screen/inventory/hand/update_icon()
..()
if(!active_overlay)
active_overlay = image("icon"=icon, "icon_state"="hand_active")
if(!handcuff_overlay)
var/state = (slot_id == slot_r_hand) ? "markus" : "gabrielle"
handcuff_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state"=state)
if(!blocked_overlay)
blocked_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state"="blocked")
cut_overlays()
if(hud && hud.mymob)
if(iscarbon(hud.mymob))
var/mob/living/carbon/C = hud.mymob
if(C.handcuffed)
add_overlay(handcuff_overlay)
if(slot_id == slot_r_hand)
if(!C.has_right_hand())
add_overlay(blocked_overlay)
else if(slot_id == slot_l_hand)
if(!C.has_left_hand())
add_overlay(blocked_overlay)
if(slot_id == slot_l_hand && hud.mymob.hand)
add_overlay(active_overlay)
else if(slot_id == slot_r_hand && !hud.mymob.hand)
add_overlay(active_overlay)
/obj/screen/inventory/hand/Click()
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
return 1
if(usr.incapacitated())
return 1
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
return 1
if(ismob(usr))
var/mob/M = usr
switch(name)
if("right hand", "r_hand")
M.activate_hand("r")
if("left hand", "l_hand")
M.activate_hand("l")
return 1
/obj/screen/close
name = "close"
/obj/screen/close/Click()
if(istype(master, /obj/item/weapon/storage))
var/obj/item/weapon/storage/S = master
S.close(usr)
return 1
/obj/screen/drop
name = "drop"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_drop"
layer = HUD_LAYER
/obj/screen/drop/Click()
usr.drop_item_v()
/obj/screen/act_intent
name = "intent"
icon_state = "help"
screen_loc = ui_acti
/obj/screen/act_intent/Click(location, control, params)
if(ishuman(usr) && (usr.client.prefs.toggles & INTENT_STYLE))
var/_x = text2num(params2list(params)["icon-x"])
var/_y = text2num(params2list(params)["icon-y"])
if(_x<=16 && _y<=16)
usr.a_intent_change("harm")
else if(_x<=16 && _y>=17)
usr.a_intent_change("help")
else if(_x>=17 && _y<=16)
usr.a_intent_change("grab")
else if(_x>=17 && _y>=17)
usr.a_intent_change("disarm")
else
usr.a_intent_change("right")
/obj/screen/act_intent/alien
icon = 'icons/mob/screen_alien.dmi'
screen_loc = ui_movi
/obj/screen/act_intent/robot
icon = 'icons/mob/screen_cyborg.dmi'
screen_loc = ui_borg_intents
/obj/screen/internals
name = "toggle internals"
icon_state = "internal0"
screen_loc = ui_internal
/obj/screen/internals/Click()
if(!iscarbon(usr))
return
var/mob/living/carbon/C = usr
if(C.incapacitated())
return
if(C.internal)
C.internal = null
C << "<span class='notice'>You are no longer running on internals.</span>"
icon_state = "internal0"
else
if(!C.getorganslot("breathing_tube"))
if(!istype(C.wear_mask, /obj/item/clothing/mask))
C << "<span class='warning'>You are not wearing an internals mask!</span>"
return 1
else
var/obj/item/clothing/mask/M = C.wear_mask
if(M.mask_adjusted) // if mask on face but pushed down
M.adjustmask(C) // adjust it back
if( !(M.flags & MASKINTERNALS) )
C << "<span class='warning'>You are not wearing an internals mask!</span>"
return
if(istype(C.l_hand, /obj/item/weapon/tank))
C << "<span class='notice'>You are now running on internals from the [C.l_hand] on your left hand.</span>"
C.internal = C.l_hand
else if(istype(C.r_hand, /obj/item/weapon/tank))
C << "<span class='notice'>You are now running on internals from the [C.r_hand] on your right hand.</span>"
C.internal = C.r_hand
else if(ishuman(C))
var/mob/living/carbon/human/H = C
if(istype(H.s_store, /obj/item/weapon/tank))
H << "<span class='notice'>You are now running on internals from the [H.s_store] on your [H.wear_suit].</span>"
H.internal = H.s_store
else if(istype(H.belt, /obj/item/weapon/tank))
H << "<span class='notice'>You are now running on internals from the [H.belt] on your belt.</span>"
H.internal = H.belt
else if(istype(H.l_store, /obj/item/weapon/tank))
H << "<span class='notice'>You are now running on internals from the [H.l_store] in your left pocket.</span>"
H.internal = H.l_store
else if(istype(H.r_store, /obj/item/weapon/tank))
H << "<span class='notice'>You are now running on internals from the [H.r_store] in your right pocket.</span>"
H.internal = H.r_store
//Seperate so CO2 jetpacks are a little less cumbersome.
if(!C.internal && istype(C.back, /obj/item/weapon/tank))
C << "<span class='notice'>You are now running on internals from the [C.back] on your back.</span>"
C.internal = C.back
if(C.internal)
icon_state = "internal1"
else
C << "<span class='warning'>You don't have an oxygen tank!</span>"
return
C.update_action_buttons_icon()
/obj/screen/mov_intent
name = "run/walk toggle"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "running"
/obj/screen/mov_intent/Click()
switch(usr.m_intent)
if("run")
usr.m_intent = "walk"
icon_state = "walking"
if("walk")
usr.m_intent = "run"
icon_state = "running"
usr.update_icons()
/obj/screen/pull
name = "stop pulling"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "pull"
/obj/screen/pull/Click()
usr.stop_pulling()
/obj/screen/pull/update_icon(mob/mymob)
if(!mymob) return
if(mymob.pulling)
icon_state = "pull"
else
icon_state = "pull0"
/obj/screen/resist
name = "resist"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_resist"
layer = HUD_LAYER
/obj/screen/resist/Click()
if(isliving(usr))
var/mob/living/L = usr
L.resist()
/obj/screen/storage
name = "storage"
/obj/screen/storage/Click(location, control, params)
if(world.time <= usr.next_move)
return 1
if(usr.stat || usr.paralysis || usr.stunned || usr.weakened)
return 1
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
return 1
if(master)
var/obj/item/I = usr.get_active_hand()
if(I)
master.attackby(I, usr, params)
return 1
/obj/screen/throw_catch
name = "throw/catch"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_throw_off"
/obj/screen/throw_catch/Click()
if(iscarbon(usr))
var/mob/living/carbon/C = usr
C.toggle_throw_mode()
/obj/screen/zone_sel
name = "damage zone"
icon_state = "zone_sel"
screen_loc = ui_zonesel
var/selecting = "chest"
/obj/screen/zone_sel/Click(location, control,params)
var/list/PL = params2list(params)
var/icon_x = text2num(PL["icon-x"])
var/icon_y = text2num(PL["icon-y"])
var/old_selecting = selecting //We're only going to update_icon() if there's been a change
switch(icon_y)
if(1 to 9) //Legs
switch(icon_x)
if(10 to 15)
selecting = "r_leg"
if(17 to 22)
selecting = "l_leg"
else
return 1
if(10 to 13) //Hands and groin
switch(icon_x)
if(8 to 11)
selecting = "r_arm"
if(12 to 20)
selecting = "groin"
if(21 to 24)
selecting = "l_arm"
else
return 1
if(14 to 22) //Chest and arms to shoulders
switch(icon_x)
if(8 to 11)
selecting = "r_arm"
if(12 to 20)
selecting = "chest"
if(21 to 24)
selecting = "l_arm"
else
return 1
if(23 to 30) //Head, but we need to check for eye or mouth
if(icon_x in 12 to 20)
selecting = "head"
switch(icon_y)
if(23 to 24)
if(icon_x in 15 to 17)
selecting = "mouth"
if(26) //Eyeline, eyes are on 15 and 17
if(icon_x in 14 to 18)
selecting = "eyes"
if(25 to 27)
if(icon_x in 15 to 17)
selecting = "eyes"
if(old_selecting != selecting)
update_icon(usr)
return 1
/obj/screen/zone_sel/update_icon(mob/user)
cut_overlays()
add_overlay(image('icons/mob/screen_gen.dmi', "[selecting]"))
user.zone_selected = selecting
/obj/screen/zone_sel/alien
icon = 'icons/mob/screen_alien.dmi'
/obj/screen/zone_sel/alien/update_icon(mob/user)
cut_overlays()
add_overlay(image('icons/mob/screen_alien.dmi', "[selecting]"))
user.zone_selected = selecting
/obj/screen/zone_sel/robot
icon = 'icons/mob/screen_cyborg.dmi'
/obj/screen/flash
name = "flash"
icon_state = "blank"
blend_mode = BLEND_ADD
screen_loc = "WEST,SOUTH to EAST,NORTH"
layer = FLASH_LAYER
/obj/screen/damageoverlay
icon = 'icons/mob/screen_full.dmi'
icon_state = "oxydamageoverlay0"
name = "dmg"
blend_mode = BLEND_MULTIPLY
screen_loc = "CENTER-7,CENTER-7"
mouse_opacity = 0
layer = UI_DAMAGE_LAYER
/obj/screen/healths
name = "health"
icon_state = "health0"
screen_loc = ui_health
/obj/screen/healths/alien
icon = 'icons/mob/screen_alien.dmi'
screen_loc = ui_alien_health
/obj/screen/healths/robot
icon = 'icons/mob/screen_cyborg.dmi'
screen_loc = ui_borg_health
/obj/screen/healths/deity
name = "Nexus Health"
icon_state = "deity_nexus"
screen_loc = ui_deityhealth
/obj/screen/healths/blob
name = "blob health"
icon_state = "block"
screen_loc = ui_internal
mouse_opacity = 0
/obj/screen/healths/blob/naut
name = "health"
icon = 'icons/mob/blob.dmi'
icon_state = "nauthealth"
/obj/screen/healths/blob/naut/core
name = "overmind health"
screen_loc = ui_health
icon_state = "corehealth"
/obj/screen/healths/guardian
name = "summoner health"
icon = 'icons/mob/guardian.dmi'
icon_state = "base"
screen_loc = ui_health
mouse_opacity = 0
/obj/screen/healths/revenant
name = "essence"
icon = 'icons/mob/actions.dmi'
icon_state = "bg_revenant"
screen_loc = ui_health
mouse_opacity = 0
/obj/screen/healthdoll
name = "health doll"
screen_loc = ui_healthdoll
+97
View File
@@ -0,0 +1,97 @@
/obj/screen/swarmer
icon = 'icons/mob/swarmer.dmi'
/obj/screen/swarmer/FabricateTrap
icon_state = "ui_trap"
name = "Create trap (Costs 5 Resources)"
desc = "Creates a trap that will nonlethally shock any non-swarmer that attempts to cross it. (Costs 5 resources)"
/obj/screen/swarmer/FabricateTrap/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateTrap()
/obj/screen/swarmer/Barricade
icon_state = "ui_barricade"
name = "Create barricade (Costs 5 Resources)"
desc = "Creates a destructible barricade that will stop any non swarmer from passing it. Also allows disabler beams to pass through. (Costs 5 resources)"
/obj/screen/swarmer/Barricade/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateBarricade()
/obj/screen/swarmer/Replicate
icon_state = "ui_replicate"
name = "Replicate (Costs 50 Resources)"
desc = "Creates a another of our kind."
/obj/screen/swarmer/Replicate/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateSwarmer()
/obj/screen/swarmer/RepairSelf
icon_state = "ui_self_repair"
name = "Repair self"
desc = "Repairs damage to our body."
/obj/screen/swarmer/RepairSelf/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.RepairSelf()
/obj/screen/swarmer/ToggleLight
icon_state = "ui_light"
name = "Toggle light"
desc = "Toggles our inbuilt light on or off."
/obj/screen/swarmer/ToggleLight/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.ToggleLight()
/obj/screen/swarmer/ContactSwarmers
icon_state = "ui_contact_swarmers"
name = "Contact swarmers"
desc = "Sends a message to all other swarmers, should they exist."
/obj/screen/swarmer/ContactSwarmers/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.ContactSwarmers()
/datum/hud/swarmer/New(mob/owner)
..()
var/obj/screen/using
using = new /obj/screen/swarmer/FabricateTrap()
using.screen_loc = ui_rhand
static_inventory += using
using = new /obj/screen/swarmer/Barricade()
using.screen_loc = ui_lhand
static_inventory += using
using = new /obj/screen/swarmer/Replicate()
using.screen_loc = ui_zonesel
static_inventory += using
using = new /obj/screen/swarmer/RepairSelf()
using.screen_loc = ui_storage1
static_inventory += using
using = new /obj/screen/swarmer/ToggleLight()
using.screen_loc = ui_back
static_inventory += using
using = new /obj/screen/swarmer/ContactSwarmers()
using.screen_loc = ui_inventory
static_inventory += using
/mob/living/simple_animal/hostile/swarmer/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud/swarmer(src)
+113
View File
@@ -0,0 +1,113 @@
// Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown.
/obj/item/proc/attack_self(mob/user)
return
// No comment
/atom/proc/attackby(obj/item/W, mob/user, params)
return
/obj/attackby(obj/item/I, mob/living/user, params)
return I.attack_obj(src, user)
/mob/living/attackby(obj/item/I, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(user.a_intent == "harm" && stat == DEAD && butcher_results) //can we butcher it?
var/sharpness = I.is_sharp()
if(sharpness)
user << "<span class='notice'>You begin to butcher [src]...</span>"
playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1)
if(do_mob(user, src, 80/sharpness))
harvest(user)
return 1
return I.attack(src, user)
/obj/item/proc/attack(mob/living/M, mob/living/user)
if(flags & NOBLUDGEON)
return
if(!force)
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)
else if(hitsound)
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
user.lastattacked = M
M.lastattacker = user
M.attacked_by(src, user)
add_logs(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
add_fingerprint(user)
//the equivalent of the standard version of attack() but for object targets.
/obj/item/proc/attack_obj(obj/O, mob/living/user)
if(flags & NOBLUDGEON)
return
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(O)
O.attacked_by(src, user)
/atom/movable/proc/attacked_by()
return
/obj/attacked_by(obj/item/I, mob/living/user)
if(I.force)
user.visible_message("<span class='danger'>[user] has hit [src] with [I]!</span>", "<span class='danger'>You hit [src] with [I]!</span>")
/mob/living/attacked_by(obj/item/I, mob/living/user)
if(user != src)
user.do_attack_animation(src)
if(send_item_attack_message(I, user))
if(apply_damage(I.force, I.damtype))
if(I.damtype == BRUTE)
if(prob(33))
I.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
return TRUE
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
// Click parameters is the params string from byond Click() code, see that documentation.
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
return
/obj/item/proc/get_clamped_volume()
if(w_class)
if(force)
return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
else
return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
var/message_verb = "attacked"
if(I.attack_verb.len)
message_verb = "[pick(I.attack_verb)]"
else if(!I.force)
return 0
var/message_hit_area = ""
if(hit_area)
message_hit_area = " in the [hit_area]"
var/attack_message = "[src] has been [message_verb][message_hit_area] with [I]."
if(user in viewers(src, null))
attack_message = "[user] has [message_verb] [src][message_hit_area] with [I]!"
visible_message("<span class='danger'>[attack_message]</span>",
"<span class='userdanger'>[attack_message]</span>")
return 1
/mob/living/simple_animal/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
if(!I.force)
user.visible_message("<span class='warning'>[user] gently taps [src] with [I].</span>",\
"<span class='warning'>This weapon is ineffective, it does no damage!</span>")
else if(I.force < force_threshold || I.damtype == STAMINA)
visible_message("<span class='warning'>[I] bounces harmlessly off of [src].</span>",\
"<span class='warning'>[I] bounces harmlessly off of [src]!</span>")
else
return ..()
+100
View File
@@ -0,0 +1,100 @@
/mob/dead/observer/DblClickOn(var/atom/A, var/params)
if(client.click_intercept)
if(call(client.click_intercept,"InterceptClickOn")(src,params,A))
return
if(can_reenter_corpse && mind && mind.current)
if(A == mind.current || (mind.current in A)) // double click your corpse or whatever holds it
reenter_corpse() // (cloning scanner, body bag, closet, mech, etc)
return // seems legit.
// Things you might plausibly want to follow
if(istype(A, /atom/movable))
ManualFollow(A)
// Otherwise jump
else if(A.loc)
loc = get_turf(A)
/mob/dead/observer/ClickOn(var/atom/A, var/params)
if(client.click_intercept)
if(call(client.click_intercept,"InterceptClickOn")(src,params,A))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"] && modifiers["middle"])
ShiftMiddleClickOn(A)
return
if(modifiers["middle"])
MiddleClickOn(A)
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"])
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
if(world.time <= next_move)
return
// You are responsible for checking config.ghost_interaction when you override this function
// Not all of them require checking, see below
A.attack_ghost(src)
// Oh by the way this didn't work with old click code which is why clicking shit didn't spam you
/atom/proc/attack_ghost(mob/dead/observer/user)
if(user.client)
if(IsAdminGhost(user))
attack_ai(user)
if(user.client.prefs.inquisitive_ghost)
user.examinate(src)
// ---------------------------------------
// And here are some good things for free:
// Now you can click through portals, wormholes, gateways, and teleporters while observing. -Sayu
/obj/machinery/teleport/hub/attack_ghost(mob/user)
var/atom/l = loc
var/obj/machinery/computer/teleporter/com = locate(/obj/machinery/computer/teleporter, locate(l.x - 2, l.y, l.z))
if(com && com.locked)
user.forceMove(get_turf(com.locked))
/obj/effect/portal/attack_ghost(mob/user)
if(target)
user.forceMove(get_turf(target))
/obj/machinery/gateway/centerstation/attack_ghost(mob/user)
if(awaygate)
user.forceMove(awaygate.loc)
else
user << "[src] has no destination."
/obj/machinery/gateway/centeraway/attack_ghost(mob/user)
if(stationgate)
user.forceMove(stationgate.loc)
else
user << "[src] has no destination."
/obj/item/weapon/storage/attack_ghost(mob/user)
orient2hud(user)
show_to(user)
/obj/machinery/teleport/hub/attack_ghost(mob/user)
if(power_station && power_station.engaged && power_station.teleporter_console && power_station.teleporter_console.target)
user.forceMove(get_turf(power_station.teleporter_console.target))
// -------------------------------------------
// This was supposed to be used by adminghosts
// I think it is a *terrible* idea
// but I'm leaving it here anyway
// commented out, of course.
/*
/atom/proc/attack_admin(mob/user as mob)
if(!user || !user.client || !user.client.holder)
return
attack_hand(user)
*/
+147
View File
@@ -0,0 +1,147 @@
/*
Humans:
Adds an exception for gloves, to allow special glove types like the ninja ones.
Otherwise pretty standard.
*/
/mob/living/carbon/human/UnarmedAttack(atom/A, proximity)
if(!has_active_hand()) //can't attack without a hand.
src << "<span class='notice'>You look at your arm and sigh.</span>"
return
// Special glove functions:
// If the gloves do anything, have them return 1 to stop
// normal attack_hand() here.
var/obj/item/clothing/gloves/G = gloves // not typecast specifically enough in defines
if(proximity && istype(G) && G.Touch(A,1))
return
var/override = 0
for(var/datum/mutation/human/HM in dna.mutations)
override += HM.on_attack_hand(src, A)
if(override)
return
A.attack_hand(src)
/atom/proc/attack_hand(mob/user)
return
/atom/proc/interact(mob/user)
return
/*
/mob/living/carbon/human/RestrainedClickOn(var/atom/A) ---carbons will handle this
return
*/
/mob/living/carbon/RestrainedClickOn(atom/A)
return 0
/mob/living/carbon/human/RangedAttack(atom/A)
if(gloves)
var/obj/item/clothing/gloves/G = gloves
if(istype(G) && G.Touch(A,0)) // for magic gloves
return
for(var/datum/mutation/human/HM in dna.mutations)
HM.on_ranged_attack(src, A)
var/turf/T = A
if(istype(T) && get_dist(src,T) <= 1)
src.Move_Pulled(T)
/*
Animals & All Unspecified
*/
/mob/living/UnarmedAttack(atom/A)
A.attack_animal(src)
/mob/living/simple_animal/hostile/UnarmedAttack(atom/A)
target = A
AttackingTarget()
/atom/proc/attack_animal(mob/user)
return
/mob/living/RestrainedClickOn(atom/A)
return
/*
Monkeys
*/
/mob/living/carbon/monkey/UnarmedAttack(atom/A)
A.attack_paw(src)
/atom/proc/attack_paw(mob/user)
return
/*
Monkey RestrainedClickOn() was apparently the
one and only use of all of the restrained click code
(except to stop you from doing things while handcuffed);
moving it here instead of various hand_p's has simplified
things considerably
*/
/mob/living/carbon/monkey/RestrainedClickOn(atom/A)
if(..())
return
if(a_intent != "harm" || !ismob(A))
return
if(is_muzzled())
return
var/mob/living/carbon/ML = A
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/obj/item/bodypart/affecting = null
if(ishuman(ML))
var/mob/living/carbon/human/H = ML
affecting = H.get_bodypart(ran_zone(dam_zone))
var/armor = ML.run_armor_check(affecting, "melee")
if(prob(75))
ML.apply_damage(rand(1,3), BRUTE, affecting, armor)
ML.visible_message("<span class='danger'>[name] bites [ML]!</span>", \
"<span class='userdanger'>[name] bites [ML]!</span>")
if(armor >= 2)
return
for(var/datum/disease/D in viruses)
ML.ForceContractDisease(D)
else
ML.visible_message("<span class='danger'>[src] has attempted to bite [ML]!</span>")
/*
Aliens
Defaults to same as monkey in most places
*/
/mob/living/carbon/alien/UnarmedAttack(atom/A)
A.attack_alien(src)
/atom/proc/attack_alien(mob/user)
attack_paw(user)
return
/mob/living/carbon/alien/RestrainedClickOn(atom/A)
return
// Babby aliens
/mob/living/carbon/alien/larva/UnarmedAttack(atom/A)
A.attack_larva(src)
/atom/proc/attack_larva(mob/user)
return
/*
Slimes
Nothing happening here
*/
/mob/living/simple_animal/slime/UnarmedAttack(atom/A)
A.attack_slime(src)
/atom/proc/attack_slime(mob/user)
return
/mob/living/simple_animal/slime/RestrainedClickOn(atom/A)
return
/*
New Players:
Have no reason to click on anything at all.
*/
/mob/new_player/ClickOn()
return
+35
View File
@@ -0,0 +1,35 @@
// Blob Overmind Controls
/mob/camera/blob/ClickOn(var/atom/A, var/params) //Expand blob
var/list/modifiers = params2list(params)
if(modifiers["middle"])
MiddleClickOn(A)
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"])
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
var/turf/T = get_turf(A)
if(T)
expand_blob(T)
/mob/camera/blob/MiddleClickOn(atom/A) //Rally spores
var/turf/T = get_turf(A)
if(T)
rally_spores(T)
/mob/camera/blob/CtrlClickOn(atom/A) //Create a shield
var/turf/T = get_turf(A)
if(T)
create_shield(T)
/mob/camera/blob/AltClickOn(atom/A) //Remove a blob
var/turf/T = get_turf(A)
if(T)
remove_blob(T)
+221
View File
@@ -0,0 +1,221 @@
/*
Telekinesis
This needs more thinking out, but I might as well.
*/
var/const/tk_maxrange = 15
/*
Telekinetic attack:
By default, emulate the user's unarmed attack
*/
/atom/proc/attack_tk(mob/user)
if(user.stat)
return
user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc
return
/*
This is similar to item attack_self, but applies to anything
that you can grab with a telekinetic grab.
It is used for manipulating things at range, for example, opening and closing closets.
There are not a lot of defaults at this time, add more where appropriate.
*/
/atom/proc/attack_self_tk(mob/user)
return
/obj/item/attack_self_tk(mob/user)
attack_self(user)
/obj/attack_tk(mob/user)
if(user.stat)
return
if(anchored)
..()
return
var/obj/item/tk_grab/O = new(src)
user.put_in_active_hand(O)
O.host = user
O.focus_object(src)
return
/obj/item/attack_tk(mob/user)
if(user.stat)
return
var/obj/item/tk_grab/O = new(src)
user.put_in_active_hand(O)
O.host = user
O.focus_object(src)
return
/mob/attack_tk(mob/user)
return // needs more thinking about
/*
TK Grab Item (the workhorse of old TK)
* If you have not grabbed something, do a normal tk attack
* If you have something, throw it at the target. If it is already adjacent, do a normal attackby()
* If you click what you are holding, or attack_self(), do an attack_self_tk() on it.
* Deletes itself if it is ever not in your hand, or if you should have no access to TK.
*/
/obj/item/tk_grab
name = "Telekinetic Grab"
desc = "Magic"
icon = 'icons/obj/magic.dmi'//Needs sprites
icon_state = "2"
flags = NOBLUDGEON | ABSTRACT | DROPDEL
//item_state = null
w_class = 10
layer = ABOVE_HUD_LAYER
var/last_throw = 0
var/atom/movable/focus = null
var/mob/living/host = null
/obj/item/tk_grab/dropped(mob/user)
if(focus && user && loc != user && loc != user.loc) // drop_item() gets called when you tk-attack a table/closet with an item
if(focus.Adjacent(loc))
focus.loc = loc
. = ..()
//stops TK grabs being equipped anywhere but into hands
/obj/item/tk_grab/equipped(mob/user, slot)
if( (slot == slot_l_hand) || (slot== slot_r_hand) )
return
qdel(src)
return
/obj/item/tk_grab/attack_self(mob/user)
if(!focus)
return
if(qdeleted(focus))
qdel(src)
return
focus.attack_self_tk(user)
/obj/item/tk_grab/afterattack(atom/target, mob/living/carbon/user, proximity, params)//TODO: go over this
if(!target || !user)
return
if(last_throw+3 > world.time)
return
if(!host || host != user)
qdel(src)
return
if(!(user.dna.check_mutation(TK)))
qdel(src)
return
if(isobj(target) && !isturf(target.loc))
return
if(!tkMaxRangeCheck(user, target, focus))
return
if(!focus)
focus_object(target, user)
return
if(focus.anchored)
qdel(src)
if(target == focus)
target.attack_self_tk(user)
return // todo: something like attack_self not laden with assumptions inherent to attack_self
if(!istype(target, /turf) && istype(focus,/obj/item) && target.Adjacent(focus))
var/obj/item/I = focus
var/resolved = target.attackby(I, user, params)
if(!resolved && target && I)
I.afterattack(target,user,1) // for splashing with beakers
else
apply_focus_overlay()
focus.throw_at(target, 10, 1,user)
last_throw = world.time
user.changeNext_move(CLICK_CD_MELEE)
return
/proc/tkMaxRangeCheck(mob/user, atom/target, atom/focus)
var/d = get_dist(user, target)
if(focus)
d = max(d,get_dist(user,focus)) // whichever is further
if(d > tk_maxrange)
user << "<span class ='warning'>Your mind won't reach that far.</span>"
return 0
return 1
/obj/item/tk_grab/attack(mob/living/M, mob/living/user, def_zone)
return
/obj/item/tk_grab/proc/focus_object(obj/target, mob/living/user)
if(!istype(target,/obj))
return//Cant throw non objects atm might let it do mobs later
if(target.anchored || !isturf(target.loc))
qdel(src)
return
focus = target
update_icon()
apply_focus_overlay()
return
/obj/item/tk_grab/proc/apply_focus_overlay()
if(!focus)
return
var/obj/effect/overlay/O = new /obj/effect/overlay(locate(focus.x,focus.y,focus.z))
O.name = "sparkles"
O.anchored = 1
O.density = 0
O.layer = FLY_LAYER
O.setDir(pick(cardinal))
O.icon = 'icons/effects/effects.dmi'
O.icon_state = "nothing"
flick("empdisable",O)
spawn(5)
qdel(O)
/obj/item/tk_grab/update_icon()
cut_overlays()
if(focus && focus.icon && focus.icon_state)
add_overlay(icon(focus.icon,focus.icon_state))
return
/obj/item/tk_grab/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is using \his telekinesis to choke \himself! It looks like \he's trying to commit suicide.</span>")
return (OXYLOSS)
/*Not quite done likely needs to use something thats not get_step_to
/obj/item/tk_grab/proc/check_path()
var/turf/ref = get_turf(src.loc)
var/turf/target = get_turf(focus.loc)
if(!ref || !target)
return 0
var/distance = get_dist(ref, target)
if(distance >= 10)
return 0
for(var/i = 1 to distance)
ref = get_step_to(ref, target, 0)
if(ref != target)
return 0
return 1
*/
//equip_to_slot_or_del(obj/item/W, slot, qdel_on_fail = 1)
/*
if(istype(user, /mob/living/carbon))
if(user:mutations & TK && get_dist(source, user) <= 7)
if(user:get_active_hand())
return 0
var/X = source:x
var/Y = source:y
var/Z = source:z
*/