Merge pull request #16052 from SandPoot/update-to-action-buttons

Action button refactor/rework: Enhanced Dragging
This commit is contained in:
deathride58
2024-01-16 14:39:51 -05:00
committed by GitHub
580 changed files with 3433 additions and 2624 deletions
+2
View File
@@ -0,0 +1,2 @@
//The button used for dragging (only sent for unrelated mouse up/down messages during a drag)
#define DRAG "drag"
-12
View File
@@ -196,18 +196,6 @@
#define COMSIG_ENTER_AREA "enter_area" //from base of area/Entered(): (/area)
#define COMSIG_EXIT_AREA "exit_area" //from base of area/Exited(): (/area)
#define COMSIG_CLICK "atom_click" //from base of atom/Click(): (location, control, params, mob/user)
#define COMSIG_CLICK_SHIFT "shift_click" //from base of atom/ShiftClick(): (/mob), return flags also used by other signals.
#define COMPONENT_ALLOW_EXAMINATE 1
#define COMPONENT_DENY_EXAMINATE 2 //Higher priority compared to the above one
#define COMSIG_CLICK_CTRL "ctrl_click" //from base of atom/CtrlClickOn(): (/mob)
#define COMSIG_CLICK_ALT "alt_click" //from base of atom/AltClick(): (/mob)
#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" //from base of atom/CtrlShiftClick(/mob)
#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" //from base of atom/MouseDrop(): (/atom/over, /mob/user)
#define COMPONENT_NO_MOUSEDROP 1
#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" //from base of atom/MouseDrop_T: (/atom/from, /mob/user)
// /area signals
#define COMSIG_AREA_ENTERED "area_entered" //from base of area/Entered(): (atom/movable/M)
#define COMSIG_AREA_EXITED "area_exited" //from base of area/Exited(): (atom/movable/M)
@@ -0,0 +1,6 @@
/// From base of /datum/action/cooldown/proc/PreActivate(), sent to the action owner: (datum/action/cooldown/activated)
#define COMSIG_MOB_ABILITY_STARTED "mob_ability_base_started"
/// Return to block the ability from starting / activating
#define COMPONENT_BLOCK_ABILITY_START (1<<0)
/// From base of /datum/action/cooldown/proc/PreActivate(), sent to the action owner: (datum/action/cooldown/finished)
#define COMSIG_MOB_ABILITY_FINISHED "mob_ability_base_finished"
@@ -0,0 +1,25 @@
// mouse signals. Format:
// When the signal is called: (signal arguments)
// All signals send the source datum of the signal as the first argument
///from base of client/Click(): (atom/target, atom/location, control, params, mob/user)
#define COMSIG_CLIENT_CLICK "atom_client_click"
///from base of atom/Click(): (atom/location, control, params, mob/user)
#define COMSIG_CLICK "atom_click"
///from base of atom/ShiftClick(): (/mob)
#define COMSIG_CLICK_SHIFT "shift_click"
/// Allows the user to examinate regardless of client.eye.
#define COMPONENT_ALLOW_EXAMINATE (1<<0)
/// Higher priority compared to the above one
#define COMPONENT_DENY_EXAMINATE (1<<1)
///from base of atom/CtrlClickOn(): (/mob)
#define COMSIG_CLICK_CTRL "ctrl_click"
///from base of atom/AltClick(): (/mob)
#define COMSIG_CLICK_ALT "alt_click"
///from base of atom/CtrlShiftClick(/mob)
#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click"
///from base of atom/MouseDrop(): (/atom/over, /mob/user)
#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto"
#define COMPONENT_NO_MOUSEDROP (1<<0)
///from base of atom/MouseDrop_T: (/atom/from, /mob/user)
#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" //from base of atom/MouseDrop_T: (/atom/from, /mob/user)
+227 -4
View File
@@ -1,12 +1,235 @@
//HUD styles. Index order defines how they are cycled in F12.
#define HUD_STYLE_STANDARD 1 //Standard hud
#define HUD_STYLE_REDUCED 2 //Reduced hud (just hands and intent switcher)
#define HUD_STYLE_NOHUD 3 //No hud (for screenshots)
/// Standard hud
#define HUD_STYLE_STANDARD 1
/// Reduced hud (just hands and intent switcher)
#define HUD_STYLE_REDUCED 2
/// No hud (for screenshots)
#define HUD_STYLE_NOHUD 3
#define HUD_VERSIONS 3 //Used in show_hud(); Please ensure this is the same as the maximum index.
/// Used in show_hud(); Please ensure this is the same as the maximum index.
#define HUD_VERSIONS 3
// Consider these images/atoms as part of the UI/HUD (apart of the appearance_flags)
/// Used for progress bars and chat messages
#define APPEARANCE_UI_IGNORE_ALPHA (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE)
/// Used for HUD objects
#define APPEARANCE_UI (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|PIXEL_SCALE)
/*
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"
*/
/proc/ui_hand_position(i) //values based on old hand ui positions (CENTER:-/+16,SOUTH:5)
var/x_off = -(!(i % 2))
var/y_off = round((i-1) / 2)
return"CENTER+[x_off]:16,SOUTH+[y_off]:5"
/proc/ui_equip_position(mob/M)
var/y_off = round((M.held_items.len-1) / 2) //values based on old equip ui position (CENTER: +/-16,SOUTH+1:5)
return "CENTER:-16,SOUTH+[y_off+1]:5"
/proc/ui_swaphand_position(mob/M, which = 1) //values based on old swaphand ui positions (CENTER: +/-16,SOUTH+1:5)
var/x_off = which == 1 ? -1 : 0
var/y_off = round((M.held_items.len-1) / 2)
return "CENTER+[x_off]:16,SOUTH+[y_off+1]:5"
//Lower left, persistent menu
#define ui_inventory "WEST:6,SOUTH:5"
//Middle left indicators
#define ui_lingchemdisplay "WEST,CENTER-1:15"
#define ui_lingstingdisplay "WEST:6,CENTER-3:11"
#define ui_devilsouldisplay "WEST:6,CENTER-1:15"
//Lower center, persistent 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_storage1 "CENTER+1:18,SOUTH:5"
#define ui_storage2 "CENTER+2:20,SOUTH:5"
#define ui_combo "CENTER+4:24,SOUTH+1:7" // combo meter for martial arts
//Lower right, persistent 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_sprintbufferloc "EAST-2:26,SOUTH:18"
#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_crafting "EAST-5:20,SOUTH:5"//CIT CHANGE - moves this over one tile to accommodate for combat mode toggle
#define ui_building "EAST-5:20,SOUTH:21"//CIT CHANGE - ditto
#define ui_language_menu "EAST-5:4,SOUTH:21"//CIT CHANGE - ditto
#define ui_voremode "EAST-5:20,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"
//Upper left (action buttons)
#define ui_action_palette "WEST+0:23,NORTH-1:5"
#define ui_action_palette_offset(north_offset) ("WEST+0:23,NORTH-[1+north_offset]:5")
#define ui_palette_scroll "WEST+1:8,NORTH-6:28"
#define ui_palette_scroll_offset(north_offset) ("WEST+1:8,NORTH-[6+north_offset]:28")
//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+1:19"//CIT CHANGE - moves internal icon up a little bit to accommodate for the stamina meter
#define ui_mood "EAST-1:28,CENTER-3:10"
// #define ui_spacesuit "EAST-1:28,CENTER-4:10"
//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+3:11"
#define ui_mask "WEST+1:8,SOUTH+2:9"
#define ui_ears "WEST+2:10,SOUTH+2:9"
#define ui_neck "WEST:6,SOUTH+2:9"
#define ui_head "WEST+1:8,SOUTH+3:11"
//Generic living
#define ui_living_pull "EAST-1:28,CENTER-2:15"
#define ui_living_health "EAST-1:28,CENTER:15"
#define ui_living_healthdoll "EAST-1:28,CENTER-1:15"
//Monkeys
#define ui_monkey_head "CENTER-5:13,SOUTH:5"
#define ui_monkey_mask "CENTER-4:14,SOUTH:5"
#define ui_monkey_neck "CENTER-3:15,SOUTH:5"
#define ui_monkey_back "CENTER-2:16,SOUTH:5"
//Drones
#define ui_drone_drop "CENTER+1:18,SOUTH:5"
#define ui_drone_pull "CENTER+2:2,SOUTH:5"
#define ui_drone_storage "CENTER-2:14,SOUTH:5"
#define ui_drone_head "CENTER-3:14,SOUTH:5"
//Cyborgs
#define ui_borg_health "EAST-1:28,CENTER-1:15"
#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"
#define ui_borg_lamp "CENTER-3:16, SOUTH:5"
#define ui_borg_tablet "CENTER-4:16, SOUTH:5"
#define ui_inv1 "CENTER-2:16,SOUTH:5"
#define ui_inv2 "CENTER-1 :16,SOUTH:5"
#define ui_inv3 "CENTER :16,SOUTH:5"
#define ui_borg_module "CENTER+1:16,SOUTH:5"
#define ui_borg_store "CENTER+2:16,SOUTH:5"
#define ui_borg_camera "CENTER+3:21,SOUTH:5"
#define ui_borg_alerts "CENTER+4:21,SOUTH:5"
#define ui_borg_language_menu "CENTER+4:21,SOUTH+1:5"
#define ui_borg_pda_send "CENTER+5:21,SOUTH:5" // To the right of the alert panel
#define ui_borg_pda_log "CENTER+6:21,SOUTH:5"
#define ui_borg_sensor "CENTER-6:16, SOUTH:5" //LEGACY
#define ui_borg_thrusters "CENTER-5:16, SOUTH:5" //LEGACY
//Aliens
#define ui_alien_health "EAST,CENTER-1:15"
#define ui_alienplasmadisplay "EAST,CENTER-2:15"
#define ui_alien_queen_finder "EAST,CENTER-3:15"
#define ui_alien_storage_r "CENTER+1:18,SOUTH:5"
#define ui_alien_language_menu "EAST-3:26,SOUTH:5"
//Constructs
#define ui_construct_pull "EAST,CENTER-2:15"
#define ui_construct_health "EAST,CENTER:15"
//AI
#define ui_ai_core "BOTTOM:6,RIGHT-4"
#define ui_ai_shuttle "BOTTOM:6,RIGHT-3"
#define ui_ai_announcement "BOTTOM:6,RIGHT-2"
#define ui_ai_state_laws "BOTTOM:6,RIGHT-1"
#define ui_ai_pda_log "BOTTOM:6,RIGHT"
#define ui_ai_pda_send "BOTTOM+1:6,RIGHT"
#define ui_ai_language_menu "BOTTOM+1:8,RIGHT-2:30"
#define ui_ai_crew_monitor "BOTTOM:6,CENTER-1"
#define ui_ai_crew_manifest "BOTTOM:6,CENTER"
#define ui_ai_alerts "BOTTOM:6,CENTER+1"
#define ui_ai_view_images "BOTTOM:6,LEFT+4"
#define ui_ai_camera_list "BOTTOM:6,LEFT+3"
#define ui_ai_track_with_camera "BOTTOM:6,LEFT+2"
#define ui_ai_camera_light "BOTTOM:6,LEFT+1"
#define ui_ai_sensor "BOTTOM:6,LEFT"
#define ui_ai_multicam "BOTTOM+1:6,LEFT+1"
#define ui_ai_add_multicam "BOTTOM+1:6,LEFT"
#define ui_ai_take_picture "BOTTOM+2:6,LEFT"
// pAI
// #define ui_pai_software "SOUTH:6,WEST"
// #define ui_pai_shell "SOUTH:6,WEST+1"
// #define ui_pai_chassis "SOUTH:6,WEST+2"
// #define ui_pai_rest "SOUTH:6,WEST+3"
// #define ui_pai_light "SOUTH:6,WEST+4"
// #define ui_pai_newscaster "SOUTH:6,WEST+5"
// #define ui_pai_host_monitor "SOUTH:6,WEST+6"
// #define ui_pai_crew_manifest "SOUTH:6,WEST+7"
// #define ui_pai_state_laws "SOUTH:6,WEST+8"
// #define ui_pai_pda_send "SOUTH:6,WEST+9"
// #define ui_pai_pda_log "SOUTH:6,WEST+10"
// #define ui_pai_take_picture "SOUTH:6,WEST+12"
// #define ui_pai_view_images "SOUTH:6,WEST+13"
//Ghosts
#define ui_ghost_jumptomob "SOUTH:6,CENTER-3:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-2:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER-1:24"
#define ui_ghost_teleport "SOUTH:6,CENTER:24"
#define ui_ghost_pai "SOUTH: 6, CENTER+1:24"
#define ui_ghost_mafia "SOUTH: 6, CENTER+2:24"
#define ui_ghost_spawners "SOUTH: 6, CENTER+1:24" // LEGACY. SAME LOC AS PAI
//UI position overrides for 1:1 screen layout. (default is 7:5)
#define ui_stamina "EAST-1:28,CENTER:17" // replacing internals button
#define ui_overridden_resist "EAST-3:24,SOUTH+1:7"
#define ui_clickdelay "CENTER,SOUTH+1:-31"
#define ui_resistdelay "EAST-3:24,SOUTH+1:4"
#define ui_combat_toggle "EAST-4:22,SOUTH:5"
#define ui_boxcraft "EAST-4:22,SOUTH+1:6"
#define ui_boxarea "EAST-4:6,SOUTH+1:6"
#define ui_boxlang "EAST-5:22,SOUTH+1:6"
#define ui_boxvore "EAST-5:22,SOUTH+1:6"
#define ui_wanted_lvl "NORTH,11"
// Defines relating to action button positions
/// Whatever the base action datum thinks is best
#define SCRN_OBJ_DEFAULT "default"
/// Floating somewhere on the hud, not in any predefined place
#define SCRN_OBJ_FLOATING "floating"
/// In the list of buttons stored at the top of the screen
#define SCRN_OBJ_IN_LIST "list"
/// In the collapseable palette
#define SCRN_OBJ_IN_PALETTE "palette"
/// The filter name for the hover outline
#define HOVER_OUTLINE_FILTER "hover_outline"
+2
View File
@@ -30,6 +30,8 @@
#define CEILING(x, y) ( -round(-(x) / (y)) * (y) )
#define ROUND_UP(x) ( -round(-(x)))
// round() acts like floor(x, 1) by default but can't handle other values
#define FLOOR(x, y) ( round((x) / (y)) * (y) )
+2 -5
View File
@@ -304,10 +304,6 @@ GLOBAL_LIST_INIT(pda_reskins, list(
*/
// Consider these images/atoms as part of the UI/HUD
#define APPEARANCE_UI_IGNORE_ALPHA (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE)
#define APPEARANCE_UI (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|PIXEL_SCALE)
//Just space
#define SPACE_ICON_STATE "[((x + y) ^ ~(x * y) + z) % 25]"
@@ -525,7 +521,8 @@ GLOBAL_LIST_INIT(pda_reskins, list(
#define VARSET_TO_LIST(L, V) if(L) L[#V] = V
#define VARSET_TO_LIST_IF(L, V, C...) if(L && (C)) L[#V] = V
#define PREF_SAVELOAD_COOLDOWN 5
#define PREF_LOAD_COOLDOWN 5
#define PREF_SAVE_COOLDOWN 2 SECONDS
#define VOMIT_TOXIC 1
#define VOMIT_PURPLE 2
+1 -1
View File
@@ -16,7 +16,7 @@
/proc/Get_Angle(atom/movable/start,atom/movable/end)//For beams.
if(!start || !end)
return 0
return FALSE
var/dy
var/dx
dy=(32*end.y+end.pixel_y)-(32*start.y+start.pixel_y)
+2 -2
View File
@@ -45,12 +45,12 @@
var/time_to_wait = GLOB.fileaccess_timer - world.time
if(time_to_wait > 0)
to_chat(src, "<font color='red'>Error: file_spam_check(): Spam. Please wait [DisplayTimeText(time_to_wait)].</font>")
return 1
return TRUE
var/delay = FTPDELAY
if(holder)
delay *= ADMIN_FTPDELAY_MODIFIER
GLOB.fileaccess_timer = world.time + delay
return 0
return FALSE
#undef FTPDELAY
#undef ADMIN_FTPDELAY_MODIFIER
+9 -9
View File
@@ -97,8 +97,8 @@
if(C == must_be_alone)
continue
if(our_area == get_area(C))
return 0
return 1
return FALSE
return TRUE
//We used to use linear regression to approximate the answer, but Mloc realized this was actually faster.
//And lo and behold, it is, and it's more accurate to boot.
@@ -310,14 +310,14 @@
var/turf/T
if(X1==X2)
if(Y1==Y2)
return 1 //Light cannot be blocked on same tile
return TRUE //Light cannot be blocked on same tile
else
var/s = SIGN(Y2-Y1)
Y1+=s
while(Y1!=Y2)
T=locate(X1,Y1,Z)
if(T.opacity)
return 0
return FALSE
Y1+=s
else
var/m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1))
@@ -333,8 +333,8 @@
X1+=signX //Line exits tile horizontally
T=locate(X1,Y1,Z)
if(T.opacity)
return 0
return 1
return FALSE
return TRUE
#undef SIGNV
@@ -343,13 +343,13 @@
var/turf/Bturf = get_turf(B)
if(!Aturf || !Bturf)
return 0
return FALSE
if(inLineOfSight(Aturf.x,Aturf.y, Bturf.x,Bturf.y,Aturf.z))
return 1
return TRUE
else
return 0
return FALSE
/proc/get_cardinal_step_away(atom/start, atom/finish) //returns the position of a step from start away from finish, in one of the cardinal directions
+2 -2
View File
@@ -29,7 +29,7 @@
//(i.e the max or the min dependant on the comparison function)
/datum/heap/proc/pop()
if(!length(L))
return 0
return FALSE
. = L[1]
L[1] = L[length(L)]
@@ -60,7 +60,7 @@
//or 0 if there's no child
/datum/heap/proc/get_greater_child(index)
if(index * 2 > length(L))
return 0
return FALSE
if(index * 2 + 1 > length(L))
return index * 2
+3 -3
View File
@@ -56,7 +56,7 @@
/proc/calculate_adjacencies(atom/A)
if(!A.loc)
return 0
return FALSE
var/adjacencies = 0
@@ -64,7 +64,7 @@
if(ismovable(A))
AM = A
if(AM.can_be_unanchored && !AM.anchored)
return 0
return FALSE
for(var/direction in GLOB.cardinals)
AM = find_type_in_direction(A, direction)
@@ -374,7 +374,7 @@
if(N_SOUTH|N_EAST|N_SOUTHEAST)
return SOUTHEAST
else
return 0
return FALSE
//SSicon_smooth
/proc/queue_smooth_neighbors(atom/A)
+4 -4
View File
@@ -1027,15 +1027,15 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
//Returns the same icon specifed in the argument, but with the pixel drawn
/proc/DrawPixel(icon/I,colour,drawX,drawY)
if(!I)
return 0
return FALSE
var/Iwidth = I.Width()
var/Iheight = I.Height()
if(drawX > Iwidth || drawX <= 0)
return 0
return FALSE
if(drawY > Iheight || drawY <= 0)
return 0
return FALSE
I.DrawBox(colour,drawX, drawY)
return I
@@ -1048,7 +1048,7 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
if(J) //Only set the icon if it succeeded, the icon without the pixel is 1000x better than a black square.
icon = J
return J
return 0
return FALSE
//For creating consistent icons for human looking simple animals
/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs, dummy_key, showDirs = GLOB.cardinals, outfit_override = null, no_anim = FALSE)
+1 -1
View File
@@ -668,7 +668,7 @@
SSticker.show_roundend_report(owner.client)
/datum/action/report/IsAvailable()
return 1
return TRUE
/datum/action/report/Topic(href,href_list)
if(usr != owner)
+91
View File
@@ -0,0 +1,91 @@
/// Takes a screen loc string in the format
/// "+-left-offset:+-pixel,+-bottom-offset:+-pixel"
/// Where the :pixel is optional, and returns
/// A list in the format (x_offset, y_offset)
/// We require context to get info out of screen locs that contain relative info, so NORTH, SOUTH, etc
/proc/screen_loc_to_offset(screen_loc, view)
if(!screen_loc)
return list(64, 64)
var/list/view_size = view_to_pixels(view)
var/x = 0
var/y = 0
// Time to parse for directional relative offsets
if(findtext(screen_loc, "EAST")) // If you're starting from the east, we start from the east too
x += view_size[1]
if(findtext(screen_loc, "WEST")) // HHHHHHHHHHHHHHHHHHHHHH WEST is technically a 1 tile offset from the start. Shoot me please
x += world.icon_size
if(findtext(screen_loc, "NORTH"))
y += view_size[2]
if(findtext(screen_loc, "SOUTH"))
y += world.icon_size
// Cut out everything we just parsed
screen_loc = cut_relative_direction(screen_loc)
var/list/x_and_y = splittext(screen_loc, ",")
var/list/x_pack = splittext(x_and_y[1], ":")
var/list/y_pack = splittext(x_and_y[2], ":")
x += text2num(x_pack[1]) * world.icon_size
y += text2num(y_pack[1]) * world.icon_size
if(length(x_pack) > 1)
x += text2num(x_pack[2])
if(length(y_pack) > 1)
y += text2num(y_pack[2])
return list(x, y)
/// Takes a list in the form (x_offset, y_offset)
/// And converts it to a screen loc string
/// Accepts an optional view string/size to force the screen_loc around, so it can't go out of scope
/proc/offset_to_screen_loc(x_offset, y_offset, view = null)
if(view)
var/list/view_bounds = view_to_pixels(view)
x_offset = clamp(x_offset, world.icon_size, view_bounds[1])
y_offset = clamp(y_offset, world.icon_size, view_bounds[2])
// Round with no argument is floor, so we get the non pixel offset here
var/x = round(x_offset / world.icon_size)
var/pixel_x = x_offset % world.icon_size
var/y = round(y_offset / world.icon_size)
var/pixel_y = y_offset % world.icon_size
var/list/generated_loc = list()
generated_loc += "[x]"
if(pixel_x)
generated_loc += ":[pixel_x]"
generated_loc += ",[y]"
if(pixel_y)
generated_loc += ":[pixel_y]"
return jointext(generated_loc, "")
/**
* Returns a valid location to place a screen object without overflowing the viewport
*
* * target: The target location as a purely number based screen_loc string "+-left-offset:+-pixel,+-bottom-offset:+-pixel"
* * target_offset: The amount we want to offset the target location by. We explictly don't care about direction here, we will try all 4
* * view: The view variable of the client we're doing this for. We use this to get the size of the screen
*
* Returns a screen loc representing the valid location
**/
/proc/get_valid_screen_location(target_loc, target_offset, view)
var/list/offsets = screen_loc_to_offset(target_loc)
var/base_x = offsets[1]
var/base_y = offsets[2]
var/list/view_size = view_to_pixels(view)
// Bias to the right, down, left, and then finally up
if(base_x + target_offset < view_size[1])
return offset_to_screen_loc(base_x + target_offset, base_y, view)
if(base_y - target_offset > world.icon_size)
return offset_to_screen_loc(base_x, base_y - target_offset, view)
if(base_x - target_offset > world.icon_size)
return offset_to_screen_loc(base_x - target_offset, base_y, view)
if(base_y + target_offset < view_size[2])
return offset_to_screen_loc(base_x, base_y + target_offset, view)
stack_trace("You passed in a scren location {[target_loc]} and offset {[target_offset]} that can't be fit in the viewport Width {[view_size[1]]}, Height {[view_size[2]]}. what did you do lad")
return null // The fuck did you do lad
/// Takes a screen_loc string and cut out any directions like NORTH or SOUTH
/proc/cut_relative_direction(fragment)
var/static/regex/regex = regex(@"([A-Z])\w+", "g")
return regex.Replace(fragment, "")
+1 -1
View File
@@ -138,7 +138,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new())
var/runHi = lo + 1
if(runHi >= hi)
return 1
return TRUE
var/last = fetchElement(L,lo)
var/current = fetchElement(L,runHi++)
+7 -7
View File
@@ -228,15 +228,15 @@
/proc/text_in_list(haystack, list/needle_list, start=1, end=0)
for(var/needle in needle_list)
if(findtext(haystack, needle, start, end))
return 1
return 0
return TRUE
return FALSE
//Like above, but case sensitive
/proc/text_in_list_case(haystack, list/needle_list, start=1, end=0)
for(var/needle in needle_list)
if(findtextEx(haystack, needle, start, end))
return 1
return 0
return TRUE
return FALSE
//Adds 'char' ahead of 'text' until there are 'count' characters total
/proc/add_leading(text, count, char = " ")
@@ -301,7 +301,7 @@
else if(b == replace) //if B is the replacement char
newtext = copytext(newtext, 1, newtext_it) + a + copytext(newtext, newtext_it + length(newtext[newtext_it]))
else //The lists disagree, Uh-oh!
return 0
return FALSE
text_it += length(a)
comp_it += length(b)
newtext_it += length(newtext[newtext_it])
@@ -311,7 +311,7 @@
//This proc returns the number of chars of the string that is the character
//This is used for detective work to determine fingerprint completion.
if(!text || !character)
return 0
return FALSE
var/count = 0
var/lentext = length(text)
var/a = ""
@@ -403,7 +403,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
. = findtextEx(haystack, char, start, end)
if(.)
return
return 0
return FALSE
/proc/parsemarkdown_basic_step1(t, limited=FALSE)
if(length(t) <= 0)
+2 -2
View File
@@ -14,7 +14,7 @@
var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month
var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day
if(month == MM && day == DD)
return 1
return TRUE
//returns timestamp in a sql and a not-quite-compliant ISO 8601 friendly format
/proc/SQLtime(timevar)
@@ -41,7 +41,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
if(28 to INFINITY)
return 5
else
return 1
return TRUE
//Takes a value of time in deciseconds.
//Returns a text value of that number in hours, minutes, or seconds.
+4 -4
View File
@@ -158,7 +158,7 @@
/proc/dir2angle(D)
switch(D)
if(NORTH)
return 0
return FALSE
if(SOUTH)
return 180
if(EAST)
@@ -301,7 +301,7 @@
/proc/unix2date(timestamp, seperator = "-")
if(timestamp < 0)
return 0 //Do not accept negative values
return FALSE //Do not accept negative values
var/year = 1970 //Unix Epoc begins 1970-01-01
var/dayInSeconds = 86400 //60secs*60mins*24hours
@@ -363,7 +363,7 @@
var/list/covered_parts = list()
if(!bpc)
return 0
return FALSE
if(bpc & FULL_BODY)
covered_parts |= list(BODY_ZONE_L_ARM,BODY_ZONE_R_ARM,BODY_ZONE_HEAD,BODY_ZONE_CHEST,BODY_ZONE_L_LEG,BODY_ZONE_R_LEG)
@@ -557,7 +557,7 @@
//assumes format #RRGGBB #rrggbb
/proc/color_hex2num(A)
if(!A || length(A) != length_char(A))
return 0
return FALSE
var/R = hex2num(copytext(A, 2, 4))
var/G = hex2num(copytext(A, 4, 6))
var/B = hex2num(copytext(A, 6, 0))
+31 -31
View File
@@ -394,7 +394,7 @@ Turf and target are separate in case you want to teleport some distance from a t
/proc/get_edge_target_turf(atom/A, direction)
var/turf/target = locate(A.x, A.y, A.z)
if(!A || !target)
return 0
return FALSE
//since NORTHEAST == NORTH|EAST, etc, doing it this way allows for diagonal mass drivers in the future
//and isn't really any more complicated
@@ -512,35 +512,35 @@ Turf and target are separate in case you want to teleport some distance from a t
current = get_step_towards(current, target_turf)
while(current != target_turf)
if(steps > length)
return 0
return FALSE
if(current.opacity)
return 0
return FALSE
for(var/thing in current)
var/atom/A = thing
if(A.opacity)
return 0
return FALSE
current = get_step_towards(current, target_turf)
steps++
return 1
return TRUE
/proc/is_blocked_turf(turf/T, exclude_mobs)
if(T.density)
return 1
return TRUE
for(var/i in T)
var/atom/A = i
if(A.density && (!exclude_mobs || !ismob(A)))
return 1
return 0
return TRUE
return FALSE
/proc/is_anchored_dense_turf(turf/T) //like the older version of the above, fails only if also anchored
if(T.density)
return 1
return TRUE
for(var/i in T)
var/atom/movable/A = i
if(A.density && A.anchored)
return 1
return 0
return TRUE
return FALSE
/proc/get_step_towards2(atom/ref , atom/trg)
var/base_dir = get_dir(ref, get_step_towards(ref,trg))
@@ -577,9 +577,9 @@ Turf and target are separate in case you want to teleport some distance from a t
//Returns: 1 if found, 0 if not.
/proc/hasvar(datum/A, varname)
if(A.vars.Find(lowertext(varname)))
return 1
return TRUE
else
return 0
return FALSE
/proc/get_cardinal_dir(atom/A, atom/B)
var/dx = abs(B.x - A.x)
@@ -700,7 +700,7 @@ Turf and target are separate in case you want to teleport some distance from a t
//of course mathematically this is just adding world.icon_size on again
/proc/getPixelDistance(atom/A, atom/B, centered = TRUE)
if(!istype(A)||!istype(B))
return 0
return FALSE
. = bounds_dist(A, B) + sqrt((((A.pixel_x+B.pixel_x)**2) + ((A.pixel_y+B.pixel_y)**2)))
if(centered)
. += world.icon_size
@@ -741,28 +741,28 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
//Direction works sometimes
if(is_type_in_typecache(O, GLOB.WALLITEMS_INVERSE))
if(O.dir == turn(dir, 180))
return 1
return TRUE
else if(O.dir == dir)
return 1
return TRUE
//Some stuff doesn't use dir properly, so we need to check pixel instead
//That's exactly what get_turf_pixel() does
if(get_turf_pixel(O) == locdir)
return 1
return TRUE
if(is_type_in_typecache(O, GLOB.WALLITEMS_EXTERNAL) && check_external)
if(is_type_in_typecache(O, GLOB.WALLITEMS_INVERSE))
if(O.dir == turn(dir, 180))
return 1
return TRUE
else if(O.dir == dir)
return 1
return TRUE
//Some stuff is placed directly on the wallturf (signs)
for(var/obj/O in locdir)
if(is_type_in_typecache(O, GLOB.WALLITEMS) && check_external != 2)
if(O.pixel_x == 0 && O.pixel_y == 0)
return 1
return 0
return TRUE
return FALSE
/proc/check_target_facings(mob/living/initator, mob/living/target)
/*This can be used to add additional effects on interactions between mobs depending on how the mobs are facing each other, such as adding a crit damage to blows to the back of a guy's head.
@@ -835,25 +835,25 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
/proc/IsValidSrc(datum/D)
if(istype(D))
return !QDELETED(D)
return 0
return FALSE
//Compare A's dir, the clockwise dir of A and the anticlockwise dir of A
//To the opposite dir of the dir returned by get_dir(B,A)
//If one of them is a match, then A is facing B
/proc/is_A_facing_B(atom/A,atom/B)
if(!istype(A) || !istype(B))
return 0
return FALSE
if(isliving(A))
var/mob/living/LA = A
if(LA.lying)
return 0
return FALSE
var/goal_dir = get_dir(A,B)
var/clockwise_A_dir = turn(A.dir, -45)
var/anticlockwise_A_dir = turn(A.dir, 45)
if(A.dir == goal_dir || clockwise_A_dir == goal_dir || anticlockwise_A_dir == goal_dir)
return 1
return 0
return TRUE
return FALSE
/*
@@ -1046,10 +1046,10 @@ B --><-- A
/atom/proc/contains(var/atom/A)
if(!A)
return 0
return FALSE
for(var/atom/location = A.loc, location, location = location.loc)
if(location == src)
return 1
return TRUE
/proc/flick_overlay_static(O, atom/A, duration)
set waitfor = 0
@@ -1149,7 +1149,7 @@ GLOBAL_REAL_VAR(list/stack_trace_storage)
/proc/stoplag(initial_delay)
if (!Master || !(Master.current_runlevel & RUNLEVELS_DEFAULT))
sleep(world.tick_lag)
return 1
return TRUE
if (!initial_delay)
initial_delay = world.tick_lag
. = 0
@@ -1568,11 +1568,11 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
/proc/num2sign(numeric)
if(numeric > 0)
return 1
return TRUE
else if(numeric < 0)
return -1
else
return 0
return FALSE
// Converts browser keycodes to BYOND keycodes.
/proc/browser_keycode_to_byond(keycode)
+11 -7
View File
@@ -1,15 +1,19 @@
/proc/getviewsize(view)
var/viewX
var/viewY
if(isnum(view))
var/totalviewrange = (view < 0 ? -1 : 1) + 2 * view
viewX = totalviewrange
viewY = totalviewrange
return list(totalviewrange, totalviewrange)
else
var/list/viewrangelist = splittext(view,"x")
viewX = text2num(viewrangelist[1])
viewY = text2num(viewrangelist[2])
return list(viewX, viewY)
return list(text2num(viewrangelist[1]), text2num(viewrangelist[2]))
/// Takes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)
/proc/view_to_pixels(view)
if(!view)
return list(0, 0)
var/list/view_info = getviewsize(view)
view_info[1] *= world.icon_size
view_info[2] *= world.icon_size
return view_info
/proc/in_view_range(mob/user, atom/A)
var/list/view_range = getviewsize(user.client.view)
+8 -8
View File
@@ -11,7 +11,7 @@
to check that the mob is not inside of something
*/
/atom/proc/Adjacent(atom/neighbor) // basic inheritance, unused
return 0
return FALSE
// Not a sane use of the function and (for now) indicative of an error elsewhere
/area/Adjacent(var/atom/neighbor)
@@ -57,9 +57,9 @@
if(!src.ClickCross(get_dir(src,T1), border_only = 1, target_atom = target, mover = mover))
continue // could not enter src
return 1 // we don't care about our own density
return TRUE // we don't care about our own density
return 0
return FALSE
/*
Adjacency (to anything else):
@@ -78,11 +78,11 @@
// This is necessary for storage items not on your person.
/obj/item/Adjacent(var/atom/neighbor, var/recurse = 1)
if(neighbor == loc)
return 1
return TRUE
if(isitem(loc))
if(recurse > 0)
return loc.Adjacent(neighbor,recurse - 1)
return 0
return FALSE
return ..()
/*
@@ -99,7 +99,7 @@
if( O.flags_1&ON_BORDER_1) // 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
return FALSE //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
return FALSE
return TRUE
+9 -8
View File
@@ -92,11 +92,11 @@
. = 1
//Please don't roast me too hard
/client/MouseMove(object,location,control,params)
/client/MouseMove(object, location, control, params)
mouseParams = params
mouseLocation = location
mouseObject = object
mouseControlObject = control
mouse_location_ref = WEAKREF(location)
mouse_object_ref = WEAKREF(object)
mouse_control_object = control
if(mob)
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOUSEMOVE, object, location, control, params)
// god forgive me for i have sinned - used for autoparry. currently at 5 objects.
@@ -107,15 +107,16 @@
/client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params)
mouseParams = params
mouseLocation = over_location
mouseObject = over_object
mouseControlObject = over_control
if(selected_target[1] && over_object && over_object.IsAutoclickable())
mouse_location_ref = WEAKREF(over_location)
mouse_object_ref = WEAKREF(over_object)
mouse_control_object = over_control
if(selected_target[1] && over_object?.IsAutoclickable())
selected_target[1] = over_object
selected_target[2] = params
if(active_mousedown_item)
active_mousedown_item.onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
SEND_SIGNAL(src, COMSIG_CLIENT_MOUSEDRAG, src_object, over_object, src_location, over_location, src_control, over_control, params)
return ..()
/obj/item/proc/onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
return
-195
View File
@@ -1,195 +0,0 @@
/*
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"
*/
/proc/ui_hand_position(i) //values based on old hand ui positions (CENTER:-/+16,SOUTH:5)
var/x_off = -(!(i % 2))
var/y_off = round((i-1) / 2)
return"CENTER+[x_off]:16,SOUTH+[y_off]:5"
/proc/ui_equip_position(mob/M)
var/y_off = round((M.held_items.len-1) / 2) //values based on old equip ui position (CENTER: +/-16,SOUTH+1:5)
return "CENTER:-16,SOUTH+[y_off+1]:5"
/proc/ui_swaphand_position(mob/M, which = 1) //values based on old swaphand ui positions (CENTER: +/-16,SOUTH+1:5)
var/x_off = which == 1 ? -1 : 0
var/y_off = round((M.held_items.len-1) / 2)
return "CENTER+[x_off]:16,SOUTH+[y_off+1]:5"
//Lower left, persistent menu
#define ui_inventory "WEST:6,SOUTH:5"
//Middle left indicators
#define ui_lingchemdisplay "WEST,CENTER-1:15"
#define ui_lingstingdisplay "WEST:6,CENTER-3:11"
#define ui_devilsouldisplay "WEST:6,CENTER-1:15"
//Lower center, persistent 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_storage1 "CENTER+1:18,SOUTH:5"
#define ui_storage2 "CENTER+2:20,SOUTH:5"
#define ui_combo "CENTER+4:24,SOUTH+1:7" // combo meter for martial arts
//Lower right, persistent 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_sprintbufferloc "EAST-2:26,SOUTH:18"
#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_crafting "EAST-5:20,SOUTH:5"//CIT CHANGE - moves this over one tile to accommodate for combat mode toggle
#define ui_building "EAST-5:20,SOUTH:21"//CIT CHANGE - ditto
#define ui_language_menu "EAST-5:4,SOUTH:21"//CIT CHANGE - ditto
#define ui_voremode "EAST-5:20,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+1:19"//CIT CHANGE - moves internal icon up a little bit to accommodate for the stamina meter
#define ui_mood "EAST-1:28,CENTER-3:10"
// #define ui_spacesuit "EAST-1:28,CENTER-4:10"
//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+3:11"
#define ui_mask "WEST+1:8,SOUTH+2:9"
#define ui_ears "WEST+2:10,SOUTH+2:9"
#define ui_neck "WEST:6,SOUTH+2:9"
#define ui_head "WEST+1:8,SOUTH+3:11"
//Generic living
#define ui_living_pull "EAST-1:28,CENTER-2:15"
#define ui_living_health "EAST-1:28,CENTER:15"
#define ui_living_healthdoll "EAST-1:28,CENTER-1:15"
//Monkeys
#define ui_monkey_head "CENTER-5:13,SOUTH:5"
#define ui_monkey_mask "CENTER-4:14,SOUTH:5"
#define ui_monkey_neck "CENTER-3:15,SOUTH:5"
#define ui_monkey_back "CENTER-2:16,SOUTH:5"
//Drones
#define ui_drone_drop "CENTER+1:18,SOUTH:5"
#define ui_drone_pull "CENTER+2:2,SOUTH:5"
#define ui_drone_storage "CENTER-2:14,SOUTH:5"
#define ui_drone_head "CENTER-3:14,SOUTH:5"
//Cyborgs
#define ui_borg_health "EAST-1:28,CENTER-1:15"
#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"
#define ui_borg_lamp "CENTER-3:16, SOUTH:5"
#define ui_borg_tablet "CENTER-4:16, SOUTH:5"
#define ui_inv1 "CENTER-2:16,SOUTH:5"
#define ui_inv2 "CENTER-1 :16,SOUTH:5"
#define ui_inv3 "CENTER :16,SOUTH:5"
#define ui_borg_module "CENTER+1:16,SOUTH:5"
#define ui_borg_store "CENTER+2:16,SOUTH:5"
#define ui_borg_camera "CENTER+3:21,SOUTH:5"
#define ui_borg_alerts "CENTER+4:21,SOUTH:5"
#define ui_borg_language_menu "CENTER+4:21,SOUTH+1:5"
#define ui_borg_sensor "CENTER-6:16, SOUTH:5" //LEGACY
#define ui_borg_thrusters "CENTER-5:16, SOUTH:5" //LEGACY
//Aliens
#define ui_alien_health "EAST,CENTER-1:15"
#define ui_alienplasmadisplay "EAST,CENTER-2:15"
#define ui_alien_queen_finder "EAST,CENTER-3:15"
#define ui_alien_storage_r "CENTER+1:18,SOUTH:5"
#define ui_alien_language_menu "EAST-3:26,SOUTH:5"
//Constructs
#define ui_construct_pull "EAST,CENTER-2:15"
#define ui_construct_health "EAST,CENTER:15"
//AI
#define ui_ai_core "BOTTOM:6,RIGHT-4"
#define ui_ai_shuttle "BOTTOM:6,RIGHT-3"
#define ui_ai_announcement "BOTTOM:6,RIGHT-2"
#define ui_ai_state_laws "BOTTOM:6,RIGHT-1"
#define ui_ai_pda_log "BOTTOM:6,RIGHT"
#define ui_ai_pda_send "BOTTOM+1:6,RIGHT"
#define ui_ai_language_menu "BOTTOM+1:8,RIGHT-2:30"
#define ui_ai_crew_monitor "BOTTOM:6,CENTER-1"
#define ui_ai_crew_manifest "BOTTOM:6,CENTER"
#define ui_ai_alerts "BOTTOM:6,CENTER+1"
#define ui_ai_view_images "BOTTOM:6,LEFT+4"
#define ui_ai_camera_list "BOTTOM:6,LEFT+3"
#define ui_ai_track_with_camera "BOTTOM:6,LEFT+2"
#define ui_ai_camera_light "BOTTOM:6,LEFT+1"
#define ui_ai_sensor "BOTTOM:6,LEFT"
#define ui_ai_multicam "BOTTOM+1:6,LEFT+1"
#define ui_ai_add_multicam "BOTTOM+1:6,LEFT"
#define ui_ai_take_picture "BOTTOM+2:6,LEFT"
// pAI
// #define ui_pai_software "SOUTH:6,WEST"
// #define ui_pai_shell "SOUTH:6,WEST+1"
// #define ui_pai_chassis "SOUTH:6,WEST+2"
// #define ui_pai_rest "SOUTH:6,WEST+3"
// #define ui_pai_light "SOUTH:6,WEST+4"
// #define ui_pai_newscaster "SOUTH:6,WEST+5"
// #define ui_pai_host_monitor "SOUTH:6,WEST+6"
// #define ui_pai_crew_manifest "SOUTH:6,WEST+7"
// #define ui_pai_state_laws "SOUTH:6,WEST+8"
// #define ui_pai_pda_send "SOUTH:6,WEST+9"
// #define ui_pai_pda_log "SOUTH:6,WEST+10"
// #define ui_pai_take_picture "SOUTH:6,WEST+12"
// #define ui_pai_view_images "SOUTH:6,WEST+13"
//Ghosts
#define ui_ghost_jumptomob "SOUTH:6,CENTER-3:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-2:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER-1:24"
#define ui_ghost_teleport "SOUTH:6,CENTER:24"
#define ui_ghost_pai "SOUTH: 6, CENTER+1:24"
#define ui_ghost_mafia "SOUTH: 6, CENTER+2:24"
#define ui_ghost_spawners "SOUTH: 6, CENTER+1:24" // LEGACY. SAME LOC AS PAI
//UI position overrides for 1:1 screen layout. (default is 7:5)
#define ui_stamina "EAST-1:28,CENTER:17" // replacing internals button
#define ui_overridden_resist "EAST-3:24,SOUTH+1:7"
#define ui_clickdelay "CENTER,SOUTH+1:-31"
#define ui_resistdelay "EAST-3:24,SOUTH+1:4"
#define ui_combat_toggle "EAST-4:22,SOUTH:5"
#define ui_boxcraft "EAST-4:22,SOUTH+1:6"
#define ui_boxarea "EAST-4:6,SOUTH+1:6"
#define ui_boxlang "EAST-5:22,SOUTH+1:6"
#define ui_boxvore "EAST-5:22,SOUTH+1:6"
#define ui_wanted_lvl "NORTH,11"
+334 -177
View File
@@ -2,186 +2,156 @@
/atom/movable/screen/movable/action_button
var/datum/action/linked_action
var/datum/hud/our_hud
var/actiontooltipstyle = ""
screen_loc = null
var/button_icon_state
var/appearance_cache
/// Where we are currently placed on the hud. SCRN_OBJ_DEFAULT asks the linked action what it thinks
var/location = SCRN_OBJ_DEFAULT
/// A unique bitflag, combined with the name of our linked action this lets us persistently remember any user changes to our position
var/id
var/ordered = TRUE //If the button gets placed into the default bar
/// A weakref of the last thing we hovered over
/// God I hate how dragging works
var/datum/weakref/last_hovored_ref
/atom/movable/screen/movable/action_button/Destroy()
if(our_hud)
var/mob/viewer = our_hud.mymob
our_hud.hide_action(src)
viewer?.client?.screen -= src
linked_action.viewers -= our_hud
viewer.update_action_buttons()
our_hud = null
linked_action = null
return ..()
/atom/movable/screen/movable/action_button/proc/can_use(mob/user)
if (linked_action)
return linked_action.owner == user
if(linked_action.viewers[user.hud_used])
return TRUE
return FALSE
else if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
else
return TRUE
/atom/movable/screen/movable/action_button/MouseDrop(over_object)
if(!can_use(usr))
return
if((istype(over_object, /atom/movable/screen/movable/action_button) && !istype(over_object, /atom/movable/screen/movable/action_button/hide_toggle)))
if(locked)
to_chat(usr, "<span class='warning'>Action button \"[name]\" is locked, unlock it first.</span>")
return
var/atom/movable/screen/movable/action_button/B = over_object
var/list/actions = usr.actions
actions.Swap(actions.Find(src.linked_action), actions.Find(B.linked_action))
moved = FALSE
ordered = TRUE
B.moved = FALSE
B.ordered = TRUE
usr.update_action_buttons()
else
return ..()
/atom/movable/screen/movable/action_button/Click(location,control,params)
if (!can_use(usr))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"])
if(locked)
to_chat(usr, "<span class='warning'>Action button \"[name]\" is locked, unlock it first.</span>")
return TRUE
moved = 0
usr.update_action_buttons() //redraw buttons that are no longer considered "moved"
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "<span class='notice'>Action button \"[name]\" [locked ? "" : "un"]locked.</span>")
if(id && usr.client) //try to (un)remember position
usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = locked ? moved : null
var/datum/hud/our_hud = usr.hud_used
our_hud.position_action(src, SCRN_OBJ_DEFAULT)
return TRUE
linked_action.Trigger()
return TRUE
//Hide/Show Action Buttons ... Button
/atom/movable/screen/movable/action_button/hide_toggle
name = "Hide Buttons"
desc = "Shift-click any button to reset its position, and Control-click it to lock it in place. Alt-click this button to reset all buttons to their default positions."
icon = 'icons/mob/actions.dmi'
icon_state = "bg_default"
var/hidden = 0
var/hide_icon = 'icons/mob/actions.dmi'
var/hide_state = "hide"
var/show_state = "show"
var/mutable_appearance/hide_appearance
var/mutable_appearance/show_appearance
/atom/movable/screen/movable/action_button/hide_toggle/Initialize(mapload)
// Entered and Exited won't fire while you're dragging something, because you're still "holding" it
// Very much byond logic, but I want nice behavior, so we fake it with drag
/atom/movable/screen/movable/action_button/MouseDrag(atom/over_object, src_location, over_location, src_control, over_control, params)
. = ..()
var/static/list/icon_cache = list()
if(!can_use(usr))
return
if(IS_WEAKREF_OF(over_object, last_hovored_ref))
return
var/atom/old_object
if(last_hovored_ref)
old_object = last_hovored_ref?.resolve()
else // If there's no current ref, we assume it was us. We also treat this as our "first go" location
old_object = src
var/datum/hud/our_hud = usr.hud_used
our_hud?.generate_landings(src)
var/cache_key = "[hide_icon][hide_state]"
hide_appearance = icon_cache[cache_key]
if(!hide_appearance)
hide_appearance = icon_cache[cache_key] = mutable_appearance(hide_icon, hide_state)
if(old_object)
old_object.MouseExited(over_location, over_control, params)
cache_key = "[hide_icon][show_state]"
show_appearance = icon_cache[cache_key]
if(!show_appearance)
show_appearance = icon_cache[cache_key] = mutable_appearance(hide_icon, show_state)
last_hovored_ref = WEAKREF(over_object)
over_object.MouseEntered(over_location, over_control, params)
/atom/movable/screen/movable/action_button/hide_toggle/Click(location,control,params)
if (!can_use(usr))
/atom/movable/screen/movable/action_button/MouseEntered(location, control, params)
. = ..()
if(!QDELETED(src))
openToolTip(usr, src, params, title = name, content = desc, theme = actiontooltipstyle)
/atom/movable/screen/movable/action_button/MouseExited(location, control, params)
closeToolTip(usr)
return ..()
/atom/movable/screen/movable/action_button/MouseDrop(over_object)
last_hovored_ref = null
if(!can_use(usr))
return
var/datum/hud/our_hud = usr.hud_used
if(over_object == src)
our_hud.hide_landings()
return
if(istype(over_object, /atom/movable/screen/action_landing))
var/atom/movable/screen/action_landing/reserve = over_object
reserve.hit_by(src)
our_hud.hide_landings()
save_position()
return
var/list/modifiers = params2list(params)
if(modifiers["shift"])
if(locked)
to_chat(usr, "<span class='warning'>Action button \"[name]\" is locked, unlock it first.</span>")
return TRUE
moved = FALSE
usr.update_action_buttons(TRUE)
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "<span class='notice'>Action button \"[name]\" [locked ? "" : "un"]locked.</span>")
if(id && usr.client) //try to (un)remember position
usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = locked ? moved : null
return TRUE
if(modifiers["alt"])
for(var/V in usr.actions)
var/datum/action/A = V
var/atom/movable/screen/movable/action_button/B = A.button
B.moved = FALSE
if(B.id && usr.client)
usr.client.prefs.action_buttons_screen_locs["[B.name]_[B.id]"] = null
B.locked = usr.client.prefs.buttons_locked
locked = usr.client.prefs.buttons_locked
moved = FALSE
if(id && usr.client)
usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = null
usr.update_action_buttons(TRUE)
to_chat(usr, "<span class='notice'>Action button positions have been reset.</span>")
return TRUE
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"
update_icon()
usr.update_action_buttons()
/atom/movable/screen/movable/action_button/hide_toggle/AltClick(mob/user)
for(var/V in user.actions)
var/datum/action/A = V
var/atom/movable/screen/movable/action_button/B = A.button
B.moved = FALSE
if(moved)
moved = FALSE
user.update_action_buttons(TRUE)
to_chat(user, "<span class='notice'>Action button positions have been reset.</span>")
return TRUE
/atom/movable/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(datum/hud/owner_hud)
var/settings = owner_hud.get_action_buttons_icons()
icon = settings["bg_icon"]
icon_state = settings["bg_state"]
hide_icon = settings["toggle_icon"]
hide_state = settings["toggle_hide"]
show_state = settings["toggle_show"]
update_icon()
/atom/movable/screen/movable/action_button/hide_toggle/update_overlays()
our_hud.hide_landings()
if(istype(over_object, /atom/movable/screen/button_palette) || istype(over_object, /atom/movable/screen/palette_scroll))
our_hud.position_action(src, SCRN_OBJ_IN_PALETTE)
save_position()
return
if(istype(over_object, /atom/movable/screen/movable/action_button))
var/atom/movable/screen/movable/action_button/button = over_object
our_hud.position_action_relative(src, button)
save_position()
return
. = ..()
if(hidden)
. += show_appearance
else
. += hide_appearance
our_hud.position_action(src, screen_loc)
save_position()
/atom/movable/screen/movable/action_button/proc/save_position()
var/mob/user = our_hud.mymob
if(!user?.client)
return
var/position_info = ""
switch(location)
if(SCRN_OBJ_FLOATING)
position_info = screen_loc
if(SCRN_OBJ_IN_LIST)
position_info = SCRN_OBJ_IN_LIST
if(SCRN_OBJ_IN_PALETTE)
position_info = SCRN_OBJ_IN_PALETTE
/atom/movable/screen/movable/action_button/MouseEntered(location,control,params)
if(!QDELETED(src))
openToolTip(usr,src,params,title = name,content = desc,theme = actiontooltipstyle)
user.client.prefs.action_buttons_screen_locs["[name]_[id]"] = position_info
user.client.prefs.queue_save_pref(1 SECONDS, TRUE)
/atom/movable/screen/movable/action_button/proc/load_position()
var/mob/user = our_hud.mymob
if(!user)
return
var/position_info = user.client?.prefs?.action_buttons_screen_locs["[name]_[id]"] || SCRN_OBJ_DEFAULT
user.hud_used.position_action(src, position_info)
/atom/movable/screen/movable/action_button/MouseExited()
closeToolTip(usr)
/atom/movable/screen/movable/action_button/proc/dump_save()
var/mob/user = our_hud.mymob
if(!user?.client)
return
user.client.prefs.action_buttons_screen_locs -= "[name]_[id]"
user.client.prefs.queue_save_pref(1 SECONDS, TRUE)
/datum/hud/proc/get_action_buttons_icons()
. = list()
.["bg_icon"] = ui_style
.["bg_state"] = "template"
//TODO : Make these fit theme
.["toggle_icon"] = 'icons/mob/actions.dmi'
.["toggle_hide"] = "hide"
.["toggle_show"] = "show"
//see human and alien hud for specific implementations.
/mob/proc/update_action_buttons_icon(status_only = FALSE)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon(status_only)
A.UpdateButtons(status_only)
//This is the proc used to update all the action buttons.
/mob/proc/update_action_buttons(reload_screen)
@@ -191,56 +161,243 @@
if(hud_used.hud_shown != HUD_STYLE_STANDARD)
return
var/button_number = 0
var/list/cview = getviewsize(client.view)
var/supportedcolumns = cview[1]-2
for(var/datum/action/action as anything in actions)
var/atom/movable/screen/movable/action_button/button = action.viewers[hud_used]
action.UpdateButtons()
if(reload_screen)
client.screen += button
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)
A.UpdateButtonIcon()
var/atom/movable/screen/movable/action_button/B = A.button
if(B.ordered)
button_number++
if(B.moved)
B.screen_loc = B.moved
else
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number, supportedcolumns)
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, supportedcolumns)
else
hud_used.hide_actions_toggle.screen_loc = hud_used.hide_actions_toggle.moved
if(reload_screen)
client.screen += hud_used.hide_actions_toggle
hud_used.update_our_owner()
// This holds the logic for the palette buttons
hud_used.palette_actions.refresh_actions()
/datum/hud/proc/ButtonNumberToScreenCoords(number, supportedcolumns) // TODO : Make this zero-indexed for readabilty
var/row = round((number - 1)/supportedcolumns)
var/col = ((number - 1)%(supportedcolumns)) + 1
/atom/movable/screen/button_palette
desc = "<b>Drag</b> buttons to move them<br><b>Shift-click</b> any button to reset it<br><b>Alt-click</b> this to reset all buttons"
icon = 'icons/hud/64x16_actions.dmi'
icon_state = "screen_gen_palette"
screen_loc = ui_action_palette
var/datum/hud/our_hud
var/expanded = FALSE
/// Id of any currently running timers that set our color matrix
var/color_timer_id
var/coord_col = "+[col-1]"
var/coord_col_offset = 2 + 2 * col
/atom/movable/screen/button_palette/Destroy()
if(our_hud)
our_hud.mymob?.client?.screen -= src
our_hud.toggle_palette = null
our_hud = null
return ..()
var/coord_row = "[row ? -row : "+0"]"
/atom/movable/screen/button_palette/Initialize(mapload)
. = ..()
update_appearance()
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-6"
/atom/movable/screen/button_palette/proc/set_hud(datum/hud/our_hud)
src.our_hud = our_hud
refresh_owner()
/datum/hud/proc/SetButtonCoords(atom/movable/screen/button,number, supportedcolumns)
var/row = round((number-1)/supportedcolumns)
var/col = ((number - 1)%(supportedcolumns)) + 1
var/x_offset = 32*(col-1) + 4 + 2*col
var/y_offset = -32*(row+1) + 26
/atom/movable/screen/button_palette/update_name(updates)
. = ..()
if(expanded)
name = "Hide Buttons"
else
name = "Show Buttons"
var/matrix/M = matrix()
M.Translate(x_offset,y_offset)
button.transform = M
/atom/movable/screen/button_palette/proc/refresh_owner()
var/mob/viewer = our_hud.mymob
if(viewer.client)
viewer.client.screen |= src
var/list/settings = our_hud.get_action_buttons_icons()
var/ui_icon = "[settings["bg_icon"]]"
var/list/ui_segments = splittext(ui_icon, ".")
var/list/ui_paths = splittext(ui_segments[1], "/")
var/ui_name = ui_paths[length(ui_paths)]
icon_state = "[ui_name]_palette"
/atom/movable/screen/button_palette/MouseEntered(location, control, params)
. = ..()
if(QDELETED(src))
return
show_tooltip(params)
/atom/movable/screen/button_palette/MouseExited()
closeToolTip(usr)
return ..()
/atom/movable/screen/button_palette/proc/show_tooltip(params)
openToolTip(usr, src, params, title = name, content = desc)
GLOBAL_LIST_INIT(palette_added_matrix, list(0.4,0.5,0.2,0, 0,1.4,0,0, 0,0.4,0.6,0, 0,0,0,1, 0,0,0,0))
GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,0, 0,0,0,1, 0,0,0,0))
/atom/movable/screen/button_palette/proc/play_item_added()
color_for_now(GLOB.palette_added_matrix)
/atom/movable/screen/button_palette/proc/play_item_removed()
color_for_now(GLOB.palette_removed_matrix)
/atom/movable/screen/button_palette/proc/color_for_now(list/color)
if(color_timer_id)
return
add_atom_colour(color, TEMPORARY_COLOUR_PRIORITY) //We unfortunately cannot animate matrix colors. Curse you lummy it would be ~~non~~trivial to interpolate between the two valuessssssssss
color_timer_id = addtimer(CALLBACK(src, .proc/remove_color, color), 2 SECONDS)
/atom/movable/screen/button_palette/proc/remove_color(list/to_remove)
color_timer_id = null
remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, to_remove)
/atom/movable/screen/button_palette/proc/can_use(mob/user)
if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
return TRUE
/atom/movable/screen/button_palette/Click(location, control, params)
if(!can_use(usr))
return
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, ALT_CLICK))
for(var/datum/action/action as anything in usr.actions) // Reset action positions to default
for(var/datum/hud/hud as anything in action.viewers)
var/atom/movable/screen/movable/action_button/button = action.viewers[hud]
hud.position_action(button, SCRN_OBJ_DEFAULT)
to_chat(usr, span_notice("Action button positions have been reset."))
return TRUE
set_expanded(!expanded)
/atom/movable/screen/button_palette/proc/clicked_while_open(datum/source, atom/target, atom/location, control, params, mob/user)
if(istype(target, /atom/movable/screen/movable/action_button) || istype(target, /atom/movable/screen/palette_scroll) || target == src) // If you're clicking on an action button, or us, you can live
return
set_expanded(FALSE)
if(source)
UnregisterSignal(source, COMSIG_CLIENT_CLICK)
/atom/movable/screen/button_palette/proc/set_expanded(new_expanded)
var/datum/action_group/our_group = our_hud.palette_actions
if(!length(our_group.actions)) //Looks dumb, trust me lad
new_expanded = FALSE
if(expanded == new_expanded)
return
expanded = new_expanded
our_group.refresh_actions()
update_appearance()
if(!usr.client)
return
if(expanded)
RegisterSignal(usr.client, COMSIG_CLIENT_CLICK, .proc/clicked_while_open)
else
UnregisterSignal(usr.client, COMSIG_CLIENT_CLICK)
closeToolTip(usr) //Our tooltips are now invalid, can't seem to update them in one frame, so here, just close them
/atom/movable/screen/palette_scroll
icon = 'icons/mob/screen_gen.dmi'
screen_loc = ui_palette_scroll
/// How should we move the palette's actions?
/// Positive scrolls down the list, negative scrolls back
var/scroll_direction = 0
var/datum/hud/our_hud
/atom/movable/screen/palette_scroll/proc/can_use(mob/user)
if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
return TRUE
/atom/movable/screen/palette_scroll/proc/set_hud(datum/hud/our_hud)
src.our_hud = our_hud
refresh_owner()
/atom/movable/screen/palette_scroll/proc/refresh_owner()
var/mob/viewer = our_hud.mymob
if(viewer.client)
viewer.client.screen |= src
var/list/settings = our_hud.get_action_buttons_icons()
icon = settings["bg_icon"]
/atom/movable/screen/palette_scroll/Click(location, control, params)
if(!can_use(usr))
return
our_hud.palette_actions.scroll(scroll_direction)
/atom/movable/screen/palette_scroll/MouseEntered(location, control, params)
. = ..()
if(QDELETED(src))
return
openToolTip(usr, src, params, title = name, content = desc)
/atom/movable/screen/palette_scroll/MouseExited()
closeToolTip(usr)
return ..()
/atom/movable/screen/palette_scroll/down
name = "Scroll Down"
desc = "<b>Click</b> on this to scroll the actions above down"
icon_state = "scroll_down"
scroll_direction = 1
/atom/movable/screen/palette_scroll/down/Destroy()
if(our_hud)
our_hud.mymob?.client?.screen -= src
our_hud.palette_down = null
our_hud = null
return ..()
/atom/movable/screen/palette_scroll/up
name = "Scroll Up"
desc = "<b>Click</b> on this to scroll the actions above up"
icon_state = "scroll_up"
scroll_direction = -1
/atom/movable/screen/palette_scroll/up/Destroy()
if(our_hud)
our_hud.mymob?.client?.screen -= src
our_hud.palette_up = null
our_hud = null
return ..()
/// Exists so you have a place to put your buttons when you move them around
/atom/movable/screen/action_landing
name = "Button Space"
desc = "<b>Drag and drop</b> a button into this spot<br>to add it to the group"
icon = 'icons/mob/screen_gen.dmi'
icon_state = "reserved"
// We want our whole 32x32 space to be clickable, so dropping's forgiving
mouse_opacity = MOUSE_OPACITY_OPAQUE
var/datum/action_group/owner
/atom/movable/screen/action_landing/Destroy()
if(owner)
owner.landing = null
owner?.owner?.mymob?.client?.screen -= src
owner.refresh_actions()
owner = null
return ..()
/atom/movable/screen/action_landing/proc/set_owner(datum/action_group/owner)
src.owner = owner
refresh_owner()
/atom/movable/screen/action_landing/proc/refresh_owner()
var/datum/hud/our_hud = owner.owner
var/mob/viewer = our_hud.mymob
if(viewer.client)
viewer.client.screen |= src
var/list/settings = our_hud.get_action_buttons_icons()
icon = settings["bg_icon"]
/// Reacts to having a button dropped on it
/atom/movable/screen/action_landing/proc/hit_by(atom/movable/screen/movable/action_button/button)
var/datum/hud/our_hud = owner.owner
our_hud.position_action(button, owner.location)
+4 -4
View File
@@ -75,9 +75,9 @@
/mob/proc/clear_alert(category, clear_override = FALSE)
var/atom/movable/screen/alert/alert = alerts[category]
if(!alert)
return 0
return FALSE
if(alert.override_alerts && !clear_override)
return 0
return FALSE
alerts -= category
if(client && hud_used)
@@ -784,7 +784,7 @@ so as to remain in compliance with the most up-to-date laws."
if(!hud_shown)
for(var/i = 1, i <= alerts.len, i++)
screenmob.client.screen -= alerts[alerts[i]]
return 1
return TRUE
for(var/i = 1, i <= alerts.len, i++)
var/atom/movable/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template")
@@ -807,7 +807,7 @@ so as to remain in compliance with the most up-to-date laws."
if(!viewmob)
for(var/M in mymob.observers)
reorganize_alerts(M)
return 1
return TRUE
/atom/movable/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
+337 -10
View File
@@ -76,8 +76,13 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
// We don't actually do proccalls really yet, so let's grab at prefs
var/atom/movable/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = FALSE
var/atom/movable/screen/button_palette/toggle_palette
var/atom/movable/screen/palette_scroll/down/palette_down
var/atom/movable/screen/palette_scroll/up/palette_up
var/datum/action_group/palette/palette_actions
var/datum/action_group/listed/listed_actions
var/list/floating_actions
var/atom/movable/screen/healths
var/atom/movable/screen/healthdoll
@@ -94,10 +99,12 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
// will fall back to the default if any of these are null
ui_style = ui_style2icon(owner.client && owner.client.prefs && owner.client.prefs.UI_style)
hide_actions_toggle = new
hide_actions_toggle.InitialiseIcon(src)
if(mymob.client)
hide_actions_toggle.locked = mymob.client.prefs.buttons_locked
toggle_palette = new()
toggle_palette.set_hud(src)
palette_down = new()
palette_down.set_hud(src)
palette_up = new()
palette_up.set_hud(src)
hand_slots = list()
@@ -113,7 +120,13 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
if(mymob.hud_used == src)
mymob.hud_used = null
QDEL_NULL(hide_actions_toggle)
QDEL_NULL(toggle_palette)
QDEL_NULL(palette_down)
QDEL_NULL(palette_up)
QDEL_NULL(palette_actions)
QDEL_NULL(listed_actions)
QDEL_LIST(floating_actions)
QDEL_NULL(module_store_icon)
QDEL_LIST(static_inventory)
@@ -151,10 +164,14 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
/mob/proc/create_mob_hud()
if(!client || hud_used)
return
hud_used = new hud_type(src)
set_hud_used(new hud_type(src))
update_sight()
SEND_SIGNAL(src, COMSIG_MOB_HUD_CREATED)
/mob/proc/set_hud_used(datum/hud/new_hud)
hud_used = new_hud
new_hud.build_action_groups()
//Version denotes which style should be displayed. blank or 0 means "next version"
/datum/hud/proc/show_hud(version = 0, mob/viewmob)
if(!ismob(mymob))
@@ -163,6 +180,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
if(!screenmob.client)
return FALSE
// This code is the absolute fucking worst, I want it to go die in a fire
// Seriously, why
screenmob.client.screen = list()
screenmob.client.update_clickcatcher()
@@ -184,7 +203,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
if(infodisplay.len)
screenmob.client.screen += infodisplay
screenmob.client.screen += hide_actions_toggle
screenmob.client.screen += toggle_palette
if(action_intent)
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position
@@ -275,7 +294,6 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
ui_style = new_ui_style
build_hand_slots()
hide_actions_toggle.InitialiseIcon(src)
//Triggered when F12 is pressed (Unless someone changed something in the DMF)
/mob/verb/button_pressed_F12()
@@ -323,3 +341,312 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
/datum/hud/proc/update_locked_slots()
return
/datum/hud/proc/position_action(atom/movable/screen/movable/action_button/button, position)
// This is kinda a hack, I'm sorry.
// Basically, FLOATING is never a valid position to pass into this proc. It exists as a generic marker for manually positioned buttons
// Not as a position to target
if(position == SCRN_OBJ_FLOATING)
return
if(button.location != SCRN_OBJ_DEFAULT)
hide_action(button)
switch(position)
if(SCRN_OBJ_DEFAULT) // Reset to the default
button.dump_save() // Nuke any existing saves
position_action(button, button.linked_action.default_button_position)
return
if(SCRN_OBJ_IN_LIST)
listed_actions.insert_action(button)
if(SCRN_OBJ_IN_PALETTE)
palette_actions.insert_action(button)
else // If we don't have it as a define, this is a screen_loc, and we should be floating
floating_actions += button
button.screen_loc = position
position = SCRN_OBJ_FLOATING
button.location = position
/datum/hud/proc/position_action_relative(atom/movable/screen/movable/action_button/button, atom/movable/screen/movable/action_button/relative_to)
if(button.location != SCRN_OBJ_DEFAULT)
hide_action(button)
switch(relative_to.location)
if(SCRN_OBJ_IN_LIST)
listed_actions.insert_action(button, listed_actions.index_of(relative_to))
if(SCRN_OBJ_IN_PALETTE)
palette_actions.insert_action(button, palette_actions.index_of(relative_to))
if(SCRN_OBJ_FLOATING) // If we don't have it as a define, this is a screen_loc, and we should be floating
floating_actions += button
var/client/our_client = mymob.client
if(!our_client)
position_action(button, button.linked_action.default_button_position)
return
button.screen_loc = get_valid_screen_location(relative_to.screen_loc, world.icon_size, our_client.view_size.getView()) // Asks for a location adjacent to our button that won't overflow the map
button.location = relative_to.location
/// Removes the passed in action from its current position on the screen
/datum/hud/proc/hide_action(atom/movable/screen/movable/action_button/button)
switch(button.location)
if(SCRN_OBJ_DEFAULT) // Invalid
CRASH("We just tried to hide an action buttion that somehow has the default position as its location, you done fucked up")
if(SCRN_OBJ_FLOATING)
floating_actions -= button
if(SCRN_OBJ_IN_LIST)
listed_actions.remove_action(button)
if(SCRN_OBJ_IN_PALETTE)
palette_actions.remove_action(button)
button.screen_loc = null
/// Generates visual landings for all groups that the button is not a memeber of
/datum/hud/proc/generate_landings(atom/movable/screen/movable/action_button/button)
listed_actions.generate_landing()
palette_actions.generate_landing()
/// Clears all currently visible landings
/datum/hud/proc/hide_landings()
listed_actions.clear_landing()
palette_actions.clear_landing()
// Updates any existing "owned" visuals, ensures they continue to be visible
/datum/hud/proc/update_our_owner()
toggle_palette.refresh_owner()
palette_down.refresh_owner()
palette_up.refresh_owner()
listed_actions.update_landing()
palette_actions.update_landing()
/// Ensures all of our buttons are properly within the bounds of our client's view, moves them if they're not
/datum/hud/proc/view_audit_buttons()
var/our_view = mymob?.client?.view
if(!our_view)
return
listed_actions.check_against_view()
palette_actions.check_against_view()
for(var/atom/movable/screen/movable/action_button/floating_button as anything in floating_actions)
var/list/current_offsets = screen_loc_to_offset(floating_button.screen_loc)
// We set the view arg here, so the output will be properly hemm'd in by our new view
floating_button.screen_loc = offset_to_screen_loc(current_offsets[1], current_offsets[2], view = our_view)
/// Generates and fills new action groups with our mob's current actions
/datum/hud/proc/build_action_groups()
listed_actions = new(src)
palette_actions = new(src)
floating_actions = list()
for(var/datum/action/action as anything in mymob.actions)
var/atom/movable/screen/movable/action_button/button = action.viewers[src]
if(!button)
action.ShowTo(mymob)
button = action.viewers[src]
else
position_action(button, button.location)
/datum/action_group
/// The hud we're owned by
var/datum/hud/owner
/// The actions we're managing
var/list/atom/movable/screen/movable/action_button/actions
/// The initial vertical offset of our action buttons
var/north_offset = 0
/// The pixel vertical offset of our action buttons
var/pixel_north_offset = 0
/// Max amount of buttons we can have per row
/// Indexes at 1
var/column_max = 0
/// How far "ahead" of the first row we start. Lets us "scroll" our rows
/// Indexes at 1
var/row_offset = 0
/// How many rows of actions we can have at max before we just stop hiding
/// Indexes at 1
var/max_rows = INFINITY
/// The screen location we go by
var/location
/// Our landing screen object
var/atom/movable/screen/action_landing/landing
/datum/action_group/New(datum/hud/owner)
..()
actions = list()
src.owner = owner
/datum/action_group/Destroy()
owner = null
QDEL_NULL(landing)
QDEL_LIST(actions)
return ..()
/datum/action_group/proc/insert_action(atom/movable/screen/action, index)
if(action in actions)
if(actions[index] == action)
return
actions -= action // Don't dupe, come on
if(!index)
index = length(actions) + 1
index = min(length(actions) + 1, index)
actions.Insert(index, action)
refresh_actions()
/datum/action_group/proc/remove_action(atom/movable/screen/action)
actions -= action
refresh_actions()
/datum/action_group/proc/refresh_actions()
// We don't use size() here because landings are not canon
var/total_rows = ROUND_UP(length(actions) / column_max)
total_rows -= max_rows // Lets get the amount of rows we're off from our max
row_offset = clamp(row_offset, 0, total_rows) // You're not allowed to offset so far that we have a row of blank space
var/button_number = 0
for(var/atom/movable/screen/button as anything in actions)
var/postion = ButtonNumberToScreenCoords(button_number )
button.screen_loc = postion
button_number++
if(landing)
var/postion = ButtonNumberToScreenCoords(button_number, landing = TRUE) // Need a good way to count buttons off screen, but allow this to display in the right place if it's being placed with no concern for dropdown
landing.screen_loc = postion
button_number++
/// Accepts a number represeting our position in the group, indexes at 0 to make the math nicer
/datum/action_group/proc/ButtonNumberToScreenCoords(number, landing = FALSE)
var/row = round(number / column_max)
row -= row_offset // If you're less then 0, you don't get to render, this lets us "scroll" rows ya feel?
if(row < 0)
return null
// Could use >= here, but I think it's worth noting that the two start at different places, since row is based on number here
if(row > max_rows - 1)
if(!landing) // If you're not a landing, go away please. thx
return null
// We always want to render landings, even if their action button can't be displayed.
// So we set a row equal to the max amount of rows + 1. Willing to overrun that max slightly to properly display the landing spot
row = max_rows // Remembering that max_rows indexes at 1, and row indexes at 0
// We're going to need to set our column to match the first item in the last row, so let's set number properly now
number = row * column_max
var/visual_row = row + north_offset
var/coord_row = visual_row ? "-[visual_row]" : "+0"
var/visual_column = number % column_max
var/coord_col = "+[visual_column]"
var/coord_col_offset = 4 + 2 * (visual_column + 1)
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-[pixel_north_offset]"
/datum/action_group/proc/check_against_view()
var/owner_view = owner?.mymob?.client?.view
if(!owner_view)
return
// Unlikey as it is, we may have been changed. Want to start from our target position and fail down
column_max = initial(column_max)
// Convert our viewer's view var into a workable offset
var/list/view_size = view_to_pixels(owner_view)
// We're primarially concerned about width here, if someone makes us 1x2000 I wish them a swift and watery death
var/furthest_screen_loc = ButtonNumberToScreenCoords(column_max - 1)
var/list/offsets = screen_loc_to_offset(furthest_screen_loc, owner_view)
if(offsets[1] > world.icon_size && offsets[1] < view_size[1] && offsets[2] > world.icon_size && offsets[2] < view_size[2]) // We're all good
return
for(column_max in column_max - 1 to 1 step -1) // Yes I could do this by unwrapping ButtonNumberToScreenCoords, but I don't feel like it
var/tested_screen_loc = ButtonNumberToScreenCoords(column_max)
offsets = screen_loc_to_offset(tested_screen_loc, owner_view)
// We've found a valid max length, pack it in
if(offsets[1] > world.icon_size && offsets[1] < view_size[1] && offsets[2] > world.icon_size && offsets[2] < view_size[2])
break
// Use our newly resized column max
refresh_actions()
/// Returns the amount of objects we're storing at the moment
/datum/action_group/proc/size()
var/amount = length(actions)
if(landing)
amount += 1
return amount
/datum/action_group/proc/index_of(atom/movable/screen/get_location)
return actions.Find(get_location)
/// Generates a landing object that can be dropped on to join this group
/datum/action_group/proc/generate_landing()
if(landing)
return
landing = new()
landing.set_owner(src)
refresh_actions()
/// Clears any landing objects we may currently have
/datum/action_group/proc/clear_landing()
QDEL_NULL(landing)
/datum/action_group/proc/update_landing()
if(!landing)
return
landing.refresh_owner()
/datum/action_group/proc/scroll(amount)
row_offset += amount
refresh_actions()
/datum/action_group/palette
north_offset = 2
column_max = 3
max_rows = 3
location = SCRN_OBJ_IN_PALETTE
/datum/action_group/palette/insert_action(atom/movable/screen/action, index)
. = ..()
var/atom/movable/screen/button_palette/palette = owner.toggle_palette
palette.play_item_added()
/datum/action_group/palette/remove_action(atom/movable/screen/action)
. = ..()
var/atom/movable/screen/button_palette/palette = owner.toggle_palette
palette.play_item_removed()
if(!length(actions))
palette.set_expanded(FALSE)
/datum/action_group/palette/refresh_actions()
var/atom/movable/screen/button_palette/palette = owner.toggle_palette
var/atom/movable/screen/palette_scroll/scroll_down = owner.palette_down
var/atom/movable/screen/palette_scroll/scroll_up = owner.palette_up
var/actions_above = round((owner.listed_actions.size() - 1) / owner.listed_actions.column_max)
north_offset = initial(north_offset) + actions_above
palette.screen_loc = ui_action_palette_offset(actions_above)
var/action_count = length(owner?.mymob?.actions)
var/our_row_count = round((length(actions) - 1) / column_max)
if(!action_count)
palette.screen_loc = null
if(palette.expanded && action_count && our_row_count >= max_rows)
scroll_down.screen_loc = ui_palette_scroll_offset(actions_above)
scroll_up.screen_loc = ui_palette_scroll_offset(actions_above)
else
scroll_down.screen_loc = null
scroll_up.screen_loc = null
return ..()
/datum/action_group/palette/ButtonNumberToScreenCoords(number, landing)
var/atom/movable/screen/button_palette/palette = owner.toggle_palette
if(palette.expanded)
return ..()
if(!landing)
return null
// We only render the landing in this case, so we force it to be the second item displayed (Second rather then first since it looks nicer)
// Remember the number var indexes at 0
return ..(1 + (row_offset * column_max), landing)
/datum/action_group/listed
pixel_north_offset = 6
column_max = 10
location = SCRN_OBJ_IN_LIST
/datum/action_group/listed/refresh_actions()
. = ..()
owner?.palette_actions.refresh_actions() // We effect them, so we gotta refresh em
+1 -1
View File
@@ -29,7 +29,7 @@
/atom/movable/screen/human/equip/Click()
if(ismecha(usr.loc)) // stops inventory actions in a mech
return 1
return TRUE
var/mob/living/carbon/human/H = usr
H.quick_equip()
+17 -24
View File
@@ -9,9 +9,8 @@
//Not tied to the grid, places it's center where the cursor is
/atom/movable/screen/movable
mouse_drag_pointer = 'icons/effects/mouse_pointers/screen_drag.dmi'
var/snap2grid = FALSE
var/moved = FALSE
var/locked = FALSE
var/x_off = -16
var/y_off = -16
@@ -21,35 +20,29 @@
/atom/movable/screen/movable/snap
snap2grid = TRUE
/atom/movable/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params)
if(locked) //no! I am locked! begone!
var/position = mouse_params_to_position(params)
if(!position)
return
var/list/PM = params2list(params)
screen_loc = position
/// Takes mouse parmas as input, returns a string representing the appropriate mouse position
/atom/movable/screen/movable/proc/mouse_params_to_position(params)
var/list/modifiers = params2list(params)
//No screen-loc information? abort.
if(!PM || !PM["screen-loc"])
if(!LAZYACCESS(modifiers, 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],":")
var/client/our_client = usr.client
var/list/offset = screen_loc_to_offset(LAZYACCESS(modifiers, SCREEN_LOC))
if(snap2grid) //Discard Pixel Values
screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]"
offset[1] = FLOOR(offset[1], world.icon_size) // drops any pixel offset
offset[2] = FLOOR(offset[2], world.icon_size) // drops any pixel offset
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]) + x_off
var/pix_Y = text2num(screen_loc_Y[2]) + y_off
screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]"
moved = screen_loc
offset[1] += x_off
offset[2] += y_off
return offset_to_screen_loc(offset[1], offset[2], our_client?.view)
//Debug procs
/client/proc/test_movable_UI()
+6
View File
@@ -5,6 +5,12 @@
///Whether the menu is currently on the client's screen or not
var/menu_hud_status = TRUE
/datum/hud/new_player/New(mob/dead/new_player/owner)
. = ..()
if(!owner.age_verify())
return
populate_buttons(owner)
/datum/hud/new_player/proc/populate_buttons(mob/dead/new_player/owner)
var/list/buttons = subtypesof(/atom/movable/screen/lobby)
for(var/button_type in buttons)
+2 -2
View File
@@ -7,7 +7,7 @@
/atom/movable/screen/robot/Click()
if(isobserver(usr))
return 1
return TRUE
/atom/movable/screen/robot/module/Click()
if(..())
@@ -15,7 +15,7 @@
var/mob/living/silicon/robot/R = usr
if(R.module.type != /obj/item/robot_module)
R.hud_used.toggle_show_robot_modules()
return 1
return TRUE
R.pick_module()
/atom/movable/screen/robot/module1
+3 -3
View File
@@ -62,12 +62,12 @@
// 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(usr.incapacitated())
return 1
return TRUE
if(ismob(usr))
var/mob/M = usr
M.swap_hand()
return 1
return TRUE
// /atom/movable/screen/skills
// name = "skills"
@@ -452,7 +452,7 @@
var/icon_y = text2num(LAZYACCESS(modifiers, "icon-y"))
var/choice = get_zone_at(icon_x, icon_y)
if (!choice)
return 1
return TRUE
return set_selected_zone(choice, usr)
+1 -1
View File
@@ -17,4 +17,4 @@
SIGNAL_HANDLER
if(!hud || !hud.mymob.client.view_size) //Might not have been initialized by now
return
maptext_width = getviewsize(hud.mymob.client.view_size.getView())[1] * world.icon_size
maptext_width = view_to_pixels(hud.mymob.client.view_size.getView())[1]
+1 -1
View File
@@ -236,7 +236,7 @@
attack_message_local = "You [message_verb] yourself[message_hit_area] with [I]"
visible_message("<span class='danger'>[attack_message]</span>",\
"<span class='userdanger'>[attack_message_local]</span>", null, COMBAT_MESSAGE_RANGE)
return 1
return TRUE
/// How much stamina this takes to swing this is not for realism purposes hecc off.
/obj/item/proc/getweight(mob/living/user, multiplier = 1, trait = SKILL_STAMINA_COST)
+2 -2
View File
@@ -18,7 +18,7 @@
. = attackchain_flags
// Special glove functions:
// If the gloves do anything, have them return 1 to stop
// If the gloves do anything, have them return TRUE to stop
// normal attack_hand() here.
var/obj/item/clothing/gloves/G = gloves // not typecast specifically enough in defines
if(proximity && istype(G))
@@ -99,7 +99,7 @@
*/
/mob/living/carbon/RestrainedClickOn(atom/A)
return 0
return FALSE
/mob/living/carbon/human/RangedAttack(atom/A, mouseparams)
. = ..()
+4 -4
View File
@@ -24,13 +24,13 @@
/datum/atom_hud/data/human/medical/basic/proc/check_sensors(mob/living/carbon/human/H)
if(!istype(H))
return 0
return FALSE
var/obj/item/clothing/under/U = H.w_uniform
if(!istype(U))
return 0
return FALSE
if(U.sensor_mode <= SENSOR_VITALS)
return 0
return 1
return FALSE
return TRUE
/datum/atom_hud/data/human/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H)
if(check_sensors(H))
+2 -2
View File
@@ -11,9 +11,9 @@
* @code
/hook/foo/proc/bar()
if(1)
return 1 //Sucessful
return TRUE //Sucessful
else
return 0 //Error, or runtime.
return FALSE //Error, or runtime.
* @endcode
* All hooks must return nonzero on success, as runtimes will force return null.
*/
+2 -2
View File
@@ -129,7 +129,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
/proc/Recreate_MC()
. = -1 //so if we runtime, things know we failed
if (world.time < Master.restart_timeout)
return 0
return FALSE
if (world.time < Master.restart_clear)
Master.restart_count *= 0.5
@@ -142,7 +142,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
new/datum/controller/master()
catch
return -1
return 1
return TRUE
/datum/controller/master/Recover()
+1 -1
View File
@@ -48,7 +48,7 @@ SUBSYSTEM_DEF(activity)
/datum/controller/subsystem/activity/proc/get_average_threat()
if(!length(threat_history))
return 0
return FALSE
var/total_weight = 0
var/total_amt = 0
for(var/i in 1 to threat_history.len-1)
+3 -3
View File
@@ -69,15 +69,15 @@ SUBSYSTEM_DEF(augury)
SSaugury.watchers += owner
to_chat(owner, "<span class='notice'>You are now auto-following debris.</span>")
active = TRUE
UpdateButtonIcon()
UpdateButtons()
/datum/action/innate/augury/Deactivate()
SSaugury.watchers -= owner
to_chat(owner, "<span class='notice'>You are no longer auto-following debris.</span>")
active = FALSE
UpdateButtonIcon()
UpdateButtons()
/datum/action/innate/augury/UpdateButtonIcon(status_only = FALSE, force)
/datum/action/innate/augury/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force)
..()
if(active)
button.icon_state = "template_active"
+9 -9
View File
@@ -47,7 +47,7 @@ SUBSYSTEM_DEF(job)
var/list/all_jobs = subtypesof(/datum/job)
if(!all_jobs.len)
to_chat(world, "<span class='boldannounce'>Error setting up jobs, no job datums found</span>")
return 0
return FALSE
for(var/J in all_jobs)
var/datum/job/job = new J()
@@ -65,7 +65,7 @@ SUBSYSTEM_DEF(job)
name_occupations[job.title] = job
type_occupations[J] = job
return 1
return TRUE
/datum/controller/subsystem/job/proc/GetJob(rank)
@@ -199,8 +199,8 @@ SUBSYSTEM_DEF(job)
continue
var/mob/dead/new_player/candidate = pick(candidates)
if(AssignRole(candidate, command_position))
return 1
return 0
return TRUE
return FALSE
//This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level
@@ -222,7 +222,7 @@ SUBSYSTEM_DEF(job)
var/ai_selected = 0
var/datum/job/job = GetJob("AI")
if(!job)
return 0
return FALSE
for(var/i = job.total_positions, i > 0, i--)
for(var/level in level_order)
var/list/candidates = list()
@@ -233,8 +233,8 @@ SUBSYSTEM_DEF(job)
ai_selected++
break
if(ai_selected)
return 1
return 0
return TRUE
return FALSE
/** Proc DivideOccupations
@@ -599,8 +599,8 @@ SUBSYSTEM_DEF(job)
if(hpc || epc)
var/relevent_cap = max(hpc, epc)
if((initial_players_to_assign - unassigned.len) >= relevent_cap)
return 1
return 0
return TRUE
return FALSE
/datum/controller/subsystem/job/proc/RejectPlayer(mob/dead/new_player/player)
if(player.mind && player.mind.special_role)
+1 -1
View File
@@ -36,7 +36,7 @@ SUBSYSTEM_DEF(pathfinder)
flow[t] = M
return free
else
return 0
return FALSE
/datum/flowcache/proc/toolong(l)
log_game("Pathfinder route took longer than 150 ticks, src bot [flow[flow[l]]]")
+1 -1
View File
@@ -25,7 +25,7 @@ SUBSYSTEM_DEF(radio)
if(frequency)
frequency.remove_listener(device)
// let's don't delete frequencies in case a non-listener keeps a reference
return 1
return TRUE
/datum/controller/subsystem/radio/proc/return_frequency(new_frequency as num)
var/f_text = num2text(new_frequency)
+1 -1
View File
@@ -358,7 +358,7 @@ SUBSYSTEM_DEF(research)
/datum/controller/subsystem/research/proc/calculate_server_coefficient() //Diminishing returns.
var/amt = servers.len
if(!amt)
return 0
return FALSE
var/coeff = 100
coeff = sqrt(coeff / amt)
return coeff
+5 -5
View File
@@ -294,7 +294,7 @@ SUBSYSTEM_DEF(shuttle)
log_shuttle("[key_name(user)] has recalled the shuttle.")
message_admins("[ADMIN_LOOKUPFLW(user)] has recalled the shuttle.")
deadchat_broadcast(" has recalled the shuttle from [span_name("[get_area_name(user, TRUE)]")].", span_name("[user.real_name]"), user, message_type=DEADCHAT_ANNOUNCEMENT)
return 1
return TRUE
/datum/controller/subsystem/shuttle/proc/canRecall()
if(!emergency || emergency.mode != SHUTTLE_CALL || emergencyNoRecall || SSticker.mode.name == "meteor")
@@ -400,7 +400,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/toggleShuttle(shuttleId, dockHome, dockAway, timed)
var/obj/docking_port/mobile/M = getShuttle(shuttleId)
if(!M)
return 1
return TRUE
var/obj/docking_port/stationary/dockedAt = M.get_docked()
var/destination = dockHome
if(dockedAt && dockedAt.id == dockHome)
@@ -411,7 +411,7 @@ SUBSYSTEM_DEF(shuttle)
else
if(M.initiate_docking(getDock(destination)) != DOCKING_SUCCESS)
return 2
return 0 //dock successful
return FALSE //dock successful
/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed)
@@ -419,14 +419,14 @@ SUBSYSTEM_DEF(shuttle)
var/obj/docking_port/stationary/D = getDock(dockId)
if(!M)
return 1
return TRUE
if(timed)
if(M.request(D))
return 2
else
if(M.initiate_docking(D) != DOCKING_SUCCESS)
return 2
return 0 //dock successful
return FALSE //dock successful
/datum/controller/subsystem/shuttle/proc/request_transit_dock(obj/docking_port/mobile/M)
if(!istype(M))
+2 -2
View File
@@ -245,7 +245,7 @@ SUBSYSTEM_DEF(ticker)
mode = null
SSjob.ResetOccupations()
emergency_swap++
return 0
return FALSE
CHECK_TICK
//Configure mode and assign player to special mode stuff
@@ -264,7 +264,7 @@ SUBSYSTEM_DEF(ticker)
to_chat(world, "<B>Error setting up [GLOB.master_mode].</B> Reverting to pre-game lobby.")
SSjob.ResetOccupations()
emergency_swap++
return 0
return FALSE
else
message_admins("<span class='notice'>DEBUG: Bypassing prestart checks...</span>")
+9 -9
View File
@@ -373,7 +373,7 @@ SUBSYSTEM_DEF(vote)
/datum/controller/subsystem/vote/proc/submit_vote(vote, score = 0)
if(mode)
if(CONFIG_GET(flag/no_dead_vote) && usr.stat == DEAD && !usr.client.holder)
return 0
return FALSE
if(vote && ISINRANGE(vote, 1, choices.len))
switch(vote_system)
if(PLURALITY_VOTING)
@@ -415,7 +415,7 @@ SUBSYSTEM_DEF(vote)
voted[usr.ckey] = list()
voted[usr.ckey][choices[vote]] = score
saved -= usr.ckey
return 0
return FALSE
/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, display = display_votes, votesystem = PLURALITY_VOTING, forced = FALSE,vote_time = -1)//CIT CHANGE - adds display argument to votes to allow for obfuscated votes
vote_system = votesystem
@@ -424,7 +424,7 @@ SUBSYSTEM_DEF(vote)
var/next_allowed_time = (started_time + CONFIG_GET(number/vote_delay))
if(mode)
to_chat(usr, "<span class='warning'>There is already a vote in progress! please wait for it to finish.</span>")
return 0
return FALSE
var/admin = FALSE
var/ckey = ckey(initiator_key)
@@ -433,7 +433,7 @@ SUBSYSTEM_DEF(vote)
if(next_allowed_time > world.time && !admin)
to_chat(usr, "<span class='warning'>A vote was initiated recently, you must wait [DisplayTimeText(next_allowed_time-world.time)] before a new vote can be started!</span>")
return 0
return FALSE
SEND_SOUND(world, sound('sound/misc/notice2.ogg'))
reset()
@@ -464,7 +464,7 @@ SUBSYSTEM_DEF(vote)
if("custom")
question = stripped_input(usr,"What is the vote for?")
if(!question)
return 0
return FALSE
var/system_string = input(usr,"Which voting type?",GLOB.vote_type_names[1]) in GLOB.vote_type_names
vote_system = GLOB.vote_type_names[system_string]
for(var/i=1,i<=10,i++)
@@ -488,7 +488,7 @@ SUBSYSTEM_DEF(vote)
toggles ^= choices[chosen]
display_votes = toggles
else
return 0
return FALSE
mode = vote_type
initiator = initiator_key ? initiator_key : "the Server" // austation -- Crew autotransfer vote
started_time = world.time
@@ -521,8 +521,8 @@ SUBSYSTEM_DEF(vote)
popup.set_window_options("can_close=0")
popup.set_content(SSvote.interface(C))
popup.open(0)
return 1
return 0
return TRUE
return FALSE
/datum/controller/subsystem/vote/proc/interface(client/C)
if(!C)
@@ -736,7 +736,7 @@ SUBSYSTEM_DEF(vote)
Remove(owner)
/datum/action/vote/IsAvailable(silent = FALSE)
return 1
return TRUE
/datum/action/vote/proc/remove_from_client()
if(!owner)
+1 -1
View File
@@ -50,7 +50,7 @@
)
if(!Q.Execute(async = TRUE))
qdel(Q)
return 0
return FALSE
var/result = 0
if(Q.NextRow())
result = text2num(Q.item[1])
+241 -123
View File
@@ -11,11 +11,10 @@
var/check_flags = 0
var/required_mobility_flags = MOBILITY_USE
var/processing = FALSE
var/atom/movable/screen/movable/action_button/button = null
var/buttontooltipstyle = ""
var/transparent_when_unavailable = TRUE
var/use_target_appearance = FALSE
var/list/target_appearance_matrix //if set, will be used to transform the target button appearance as an arglist.
/// Where any buttons we create should be by default. Accepts screen_loc and location defines
var/default_button_position = SCRN_OBJ_IN_LIST
var/button_icon = 'icons/mob/actions/backgrounds.dmi' //This is the file for the BACKGROUND icon
var/background_icon_state = ACTION_BUTTON_DEFAULT_BACKGROUND //And this is the state for the background icon
@@ -28,12 +27,6 @@
/datum/action/New(Target)
link_to(Target)
button = new
button.linked_action = src
button.name = name
button.actiontooltipstyle = buttontooltipstyle
if(desc)
button.desc = desc
/datum/action/proc/link_to(Target)
target = Target
@@ -43,51 +36,42 @@
if(owner)
Remove(owner)
target = null
QDEL_NULL(button)
QDEL_LIST_ASSOC_VAL(viewers) // Qdel the buttons in the viewers list **NOT THE HUDS**
return ..()
/datum/action/proc/Grant(mob/M)
if(M)
if(owner)
if(owner == M)
return
Remove(owner)
owner = M
//button id generation
var/counter = 0
var/bitfield = 0
for(var/datum/action/A in M.actions)
if(A.name == name && A.button.id)
counter += 1
bitfield |= A.button.id
bitfield = ~bitfield
var/bitflag = 1
for(var/i in 1 to (counter + 1))
if(bitfield & bitflag)
button.id = bitflag
break
bitflag *= 2
M.actions += src
if(M.client)
M.client.screen += button
button.locked = M.client.prefs.buttons_locked || button.id ? M.client.prefs.action_buttons_screen_locs["[name]_[button.id]"] : FALSE //even if it's not defaultly locked we should remember we locked it before
button.moved = button.id ? M.client.prefs.action_buttons_screen_locs["[name]_[button.id]"] : FALSE
M.update_action_buttons()
else
if(!M)
Remove(owner)
return
if(owner)
if(owner == M)
return
Remove(owner)
owner = M
RegisterSignal(owner, COMSIG_PARENT_QDELETING, .proc/clear_ref, override = TRUE)
GiveAction(M)
/datum/action/proc/clear_ref(datum/ref)
SIGNAL_HANDLER
if(ref == owner)
Remove(owner)
if(ref == target)
qdel(src)
/datum/action/proc/Remove(mob/M)
if(M)
if(M.client)
M.client.screen -= button
M.actions -= src
M.update_action_buttons()
owner = null
button.moved = FALSE //so the button appears in its normal position when given to another owner.
button.locked = FALSE
button.id = null
for(var/datum/hud/hud in viewers)
if(!hud.mymob)
continue
HideFrom(hud.mymob)
LAZYREMOVE(M.actions, src) // We aren't always properly inserted into the viewers list, gotta make sure that action's cleared
viewers = list()
if(owner)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
if(target == owner)
RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/clear_ref)
owner = null
/datum/action/proc/Trigger()
if(!IsAvailable())
@@ -125,15 +109,15 @@
/datum/action/proc/UpdateButtons(status_only, force)
for(var/datum/hud/hud in viewers)
var/atom/movable/screen/movable/button = viewers[hud]
UpdateButtonIcon(button, status_only, force)
UpdateButton(button, status_only, force)
/datum/action/proc/UpdateButtonIcon(status_only = FALSE, force = FALSE)
/datum/action/proc/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force = FALSE)
if(!button)
return
if(!status_only)
button.name = name
button.desc = desc
if(owner && owner.hud_used && background_icon_state == ACTION_BUTTON_DEFAULT_BACKGROUND)
if(owner?.hud_used && background_icon_state == ACTION_BUTTON_DEFAULT_BACKGROUND)
var/list/settings = owner.hud_used.get_action_buttons_icons()
if(button.icon != settings["bg_icon"])
button.icon = settings["bg_icon"]
@@ -145,25 +129,13 @@
if(button.icon_state != background_icon_state)
button.icon_state = background_icon_state
if(!use_target_appearance)
ApplyIcon(button, force)
else if(target && button.appearance_cache != target.appearance) //replace with /ref comparison if this is not valid.
var/mutable_appearance/M = new(target)
M.layer = FLOAT_LAYER
M.plane = FLOAT_PLANE
if(target_appearance_matrix)
var/list/L = target_appearance_matrix
M.transform = matrix(L[1], L[2], L[3], L[4], L[5], L[6])
button.cut_overlays()
button.add_overlay(M)
button.appearance_cache = target.appearance
ApplyIcon(button, force)
if(!IsAvailable(TRUE))
button.color = transparent_when_unavailable ? rgb(128,0,0,128) : rgb(128,0,0)
else
button.color = rgb(255,255,255,255)
return 1
return TRUE
/datum/action/proc/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force = FALSE)
if(icon_icon && button_icon_state && ((current_button.button_icon_state != button_icon_state) || force))
@@ -179,25 +151,82 @@
/datum/action/ghost/Trigger()
if(!..())
return 0
return FALSE
var/mob/M = target
M.ghostize(can_reenter_corpse = TRUE, voluntary = TRUE)
/datum/action/proc/OnUpdatedIcon()
addtimer(CALLBACK(src, .proc/UpdateButtonIcon), 1) //Hopefully runs after new icon overlays have been compiled.
SIGNAL_HANDLER
UpdateButtons(force = TRUE)
//Give our action button to the player
/datum/action/proc/GiveAction(mob/viewer)
var/datum/hud/our_hud = viewer.hud_used
if(viewers[our_hud]) // Already have a copy of us? go away
return
LAZYOR(viewer.actions, src) // Move this in
ShowTo(viewer)
//Adds our action button to the screen of a player
/datum/action/proc/ShowTo(mob/viewer)
var/datum/hud/our_hud = viewer.hud_used
if(!our_hud || viewers[our_hud]) // There's no point in this if you have no hud in the first place
return
var/atom/movable/screen/movable/action_button/button = CreateButton()
SetId(button, viewer)
button.our_hud = our_hud
viewers[our_hud] = button
if(viewer.client)
viewer.client.screen += button
button.load_position(viewer)
viewer.update_action_buttons()
//Removes our action button from the screen of a player
/datum/action/proc/HideFrom(mob/viewer)
var/datum/hud/our_hud = viewer.hud_used
var/atom/movable/screen/movable/action_button/button = viewers[our_hud]
LAZYREMOVE(viewer.actions, src)
if(button)
qdel(button)
/datum/action/proc/CreateButton()
var/atom/movable/screen/movable/action_button/button = new()
button.linked_action = src
button.actiontooltipstyle = buttontooltipstyle
if(desc)
button.desc = desc
return button
/datum/action/proc/SetId(atom/movable/screen/movable/action_button/our_button, mob/owner)
//button id generation
var/bitfield = 0
for(var/datum/action/action in owner.actions)
if(action == src) // This could be us, which is dumb
continue
var/atom/movable/screen/movable/action_button/button = action.viewers[owner.hud_used]
if(action.name == name && button.id)
bitfield |= button.id
bitfield = ~bitfield // Flip our possible ids, so we can check if we've found a unique one
for(var/i in 0 to 23) // We get 24 possible bitflags in dm
var/bitflag = 1 << i // Shift us over one
if(bitfield & bitflag)
our_button.id = bitflag
return
//Presets for item actions
/datum/action/item_action
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUN|AB_CHECK_LYING|AB_CHECK_CONSCIOUS
button_icon_state = null
use_target_appearance = TRUE
// If you want to override the normal icon being the item
// then change this to an icon state
/datum/action/item_action/New(Target)
..()
if(button_icon_state)
use_target_appearance = FALSE
var/obj/item/I = target
LAZYINITLIST(I.actions)
I.actions += src
@@ -208,17 +237,41 @@
UNSETEMPTY(I.actions)
return ..()
/datum/action/item_action/Trigger()
if(!..())
return 0
/datum/action/item_action/Trigger(trigger_flags)
. = ..()
if(!.)
return FALSE
if(target)
var/obj/item/I = target
I.ui_action_click(owner, src)
return 1
return TRUE
/datum/action/item_action/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force)
var/obj/item/item_target = target
if(button_icon && button_icon_state)
// If set, use the custom icon that we set instead
// of the item appearence
..()
else if((target && current_button.appearance_cache != item_target.appearance) || force) //replace with /ref comparison if this is not valid.
var/old_layer = item_target.layer
var/old_plane = item_target.plane
item_target.layer = FLOAT_LAYER //AAAH
item_target.plane = FLOAT_PLANE //^ what that guy said
current_button.filters = null
current_button.cut_overlays()
current_button.add_overlay(item_target)
item_target.layer = old_layer
item_target.plane = old_plane
current_button.appearance_cache = item_target.appearance
/datum/action/item_action/toggle_light
name = "Toggle Light"
/datum/action/item_action/toggle_light/pda/Trigger(trigger_flags)
if(istype(target, /obj/item/pda))
var/obj/item/pda/P = target
return P.toggle_light(owner)
/datum/action/item_action/toggle_hood
name = "Toggle Hood"
@@ -258,12 +311,14 @@
/datum/action/item_action/set_internals
name = "Set Internals"
/datum/action/item_action/set_internals/UpdateButtonIcon(status_only = FALSE, force)
if(..()) //button available
if(iscarbon(owner))
var/mob/living/carbon/C = owner
if(target == C.internal)
button.icon_state = "template_active"
/datum/action/item_action/set_internals/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force)
if(!..()) // no button available
return
if(!iscarbon(owner))
return
var/mob/living/carbon/C = owner
if(target == C.internal)
button.icon_state = "template_active"
/datum/action/item_action/pick_color
name = "Choose A Color"
@@ -309,9 +364,9 @@
/datum/action/item_action/toggle_unfriendly_fire/Trigger()
if(..())
UpdateButtonIcon()
UpdateButtons()
/datum/action/item_action/toggle_unfriendly_fire/UpdateButtonIcon(status_only = FALSE, force)
/datum/action/item_action/toggle_unfriendly_fire/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force)
if(istype(target, /obj/item/hierophant_club))
var/obj/item/hierophant_club/H = target
if(H.friendly_fire_check)
@@ -332,7 +387,7 @@
if(istype(target, /obj/item/hierophant_club))
var/obj/item/hierophant_club/H = target
if(H.teleporting)
return 0
return FALSE
return ..()
/datum/action/item_action/clock
@@ -342,7 +397,7 @@
/datum/action/item_action/clock/IsAvailable(silent = FALSE)
if(!is_servant_of_ratvar(owner))
return 0
return FALSE
return ..()
/datum/action/item_action/clock/toggle_visor
@@ -351,11 +406,11 @@
/datum/action/item_action/clock/toggle_visor/IsAvailable(silent = FALSE)
if(!is_servant_of_ratvar(owner))
return 0
return FALSE
if(istype(target, /obj/item/clothing/glasses/judicial_visor))
var/obj/item/clothing/glasses/judicial_visor/V = target
if(V.recharging)
return 0
return FALSE
return ..()
/datum/action/item_action/clock/hierophant
@@ -366,7 +421,6 @@
/datum/action/item_action/clock/quickbind
name = "Quickbind"
desc = "If you're seeing this, file a bug report."
use_target_appearance = FALSE
var/scripture_index = 0 //the index of the scripture we're associated with
/datum/action/item_action/toggle_helmet_flashlight
@@ -380,7 +434,6 @@
/datum/action/item_action/toggle/New(Target)
..()
name = "Toggle [target.name]"
button.name = name
/datum/action/item_action/halt
name = "HALT!"
@@ -409,7 +462,6 @@
/datum/action/item_action/adjust/New(Target)
..()
name = "Adjust [target.name]"
button.name = name
/datum/action/item_action/switch_hud
name = "Switch HUD"
@@ -432,7 +484,7 @@
/datum/action/item_action/jetpack_stabilization/IsAvailable(silent = FALSE)
var/obj/item/tank/jetpack/J = target
if(!istype(J) || !J.on)
return 0
return FALSE
return ..()
/datum/action/item_action/hands_free
@@ -464,7 +516,7 @@
else
owner.research_scanner--
to_chat(owner, "<span class='notice'>[target] research scanner has been [active ? "activated" : "deactivated"].</span>")
return 1
return TRUE
/datum/action/item_action/toggle_research_scanner/Remove(mob/M)
if(owner && active)
@@ -489,18 +541,16 @@
/datum/action/item_action/organ_action/IsAvailable(silent = FALSE)
var/obj/item/organ/I = target
if(!I.owner)
return 0
return FALSE
return ..()
/datum/action/item_action/organ_action/toggle/New(Target)
..()
name = "Toggle [target.name]"
button.name = name
/datum/action/item_action/organ_action/use/New(Target)
..()
name = "Use [target.name]"
button.name = name
/datum/action/item_action/cult_dagger
name = "Draw Blood Rune"
@@ -509,14 +559,13 @@
button_icon_state = "draw"
buttontooltipstyle = "cult"
background_icon_state = "bg_demon"
default_button_position = "6:157,4:-2"
/datum/action/item_action/cult_dagger/Grant(mob/M)
if(iscultist(M))
..()
button.screen_loc = "6:157,4:-2"
button.moved = "6:157,4:-2"
else
if(!iscultist(M))
Remove(owner)
return
return ..()
/datum/action/item_action/cult_dagger/Trigger()
for(var/obj/item/H in owner.held_items) //In case we were already holding another dagger
@@ -643,7 +692,6 @@
icon_icon = S.action_icon
button_icon_state = S.action_icon_state
background_icon_state = S.action_background_icon_state
button.name = name
/datum/action/spell_action/Destroy()
var/obj/effect/proc_holder/S = target
@@ -693,12 +741,12 @@
/datum/action/innate/Trigger()
if(!..())
return 0
return FALSE
if(!active)
Activate()
else
Deactivate()
return 1
return TRUE
/datum/action/innate/proc/Activate()
return
@@ -711,44 +759,114 @@
/datum/action/cooldown
check_flags = 0
transparent_when_unavailable = FALSE
// The default cooldown applied when StartCooldown() is called
var/cooldown_time = 0
// The actual next time this ability can be used
var/next_use_time = 0
// Whether or not you want the cooldown for the ability to display in text form
var/text_cooldown = TRUE
// Setting for intercepting clicks before activating the ability
var/click_to_activate = FALSE
// Shares cooldowns with other cooldown abilities of the same value, not active if null
var/shared_cooldown
/datum/action/cooldown/New()
..()
/datum/action/cooldown/CreateButton()
var/atom/movable/screen/movable/action_button/button = ..()
button.maptext = ""
button.maptext_x = 8
button.maptext_y = 0
button.maptext_width = 24
button.maptext_height = 12
return button
/datum/action/cooldown/IsAvailable(silent = FALSE)
return next_use_time <= world.time
/datum/action/cooldown/IsAvailable()
return ..() && (next_use_time <= world.time)
/datum/action/cooldown/proc/StartCooldown()
next_use_time = world.time + cooldown_time
button.maptext = MAPTEXT_TINY_UNICODE("[round(cooldown_time/10, 0.1)]")
UpdateButtonIcon()
/// Starts a cooldown time to be shared with similar abilities, will use default cooldown time if an override is not specified
/datum/action/cooldown/proc/StartCooldown(override_cooldown_time)
if(shared_cooldown)
for(var/datum/action/cooldown/shared_ability in owner.actions - src)
if(shared_cooldown == shared_ability.shared_cooldown)
if(isnum(override_cooldown_time))
shared_ability.StartCooldownSelf(override_cooldown_time)
else
shared_ability.StartCooldownSelf(cooldown_time)
StartCooldownSelf(override_cooldown_time)
/// Starts a cooldown time for this ability only, will use default cooldown time if an override is not specified
/datum/action/cooldown/proc/StartCooldownSelf(override_cooldown_time)
if(isnum(override_cooldown_time))
next_use_time = world.time + override_cooldown_time
else
next_use_time = world.time + cooldown_time
UpdateButtons()
START_PROCESSING(SSfastprocess, src)
/datum/action/cooldown/process()
/datum/action/cooldown/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return
if(!owner)
return FALSE
if(click_to_activate)
if(target)
// For automatic / mob handling
return InterceptClickOn(owner, null, target)
if(owner.click_intercept == src)
owner.click_intercept = null
else
owner.click_intercept = src
for(var/datum/action/cooldown/ability in owner.actions)
ability.UpdateButtons()
return TRUE
return PreActivate(owner)
/// Intercepts client owner clicks to activate the ability
/datum/action/cooldown/proc/InterceptClickOn(mob/living/caller, params, atom/target)
if(!IsAvailable())
return FALSE
if(!target)
return FALSE
PreActivate(target)
caller.click_intercept = null
return TRUE
/// For signal calling
/datum/action/cooldown/proc/PreActivate(atom/target)
if(SEND_SIGNAL(owner, COMSIG_MOB_ABILITY_STARTED, src) & COMPONENT_BLOCK_ABILITY_START)
return
. = Activate(target)
SEND_SIGNAL(owner, COMSIG_MOB_ABILITY_FINISHED, src)
/// To be implemented by subtypes
/datum/action/cooldown/proc/Activate(atom/target)
return
/datum/action/cooldown/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force = FALSE)
. = ..()
if(!button)
return
var/time_left = max(next_use_time - world.time, 0)
if(text_cooldown)
button.maptext = MAPTEXT("<b>[round(time_left/10, 0.1)]</b>")
if(!owner || time_left == 0)
button.maptext = ""
if(IsAvailable() && owner.click_intercept == src)
button.color = COLOR_GREEN
/datum/action/cooldown/process()
var/time_left = max(next_use_time - world.time, 0)
if(!owner || time_left == 0)
STOP_PROCESSING(SSfastprocess, src)
var/timeleft = max(next_use_time - world.time, 0)
if(timeleft == 0)
button.maptext = ""
UpdateButtonIcon()
STOP_PROCESSING(SSfastprocess, src)
else
button.maptext = MAPTEXT_TINY_UNICODE("[round(cooldown_time/10, 0.1)]")
UpdateButtons()
/datum/action/cooldown/Grant(mob/M)
..()
if(owner)
UpdateButtonIcon()
if(next_use_time > world.time)
START_PROCESSING(SSfastprocess, src)
if(!owner)
return
UpdateButtons()
if(next_use_time > world.time)
START_PROCESSING(SSfastprocess, src)
//surf_ss13
/datum/action/item_action/bhop
@@ -841,7 +959,7 @@
target.plane = old_plane
current_button.appearance_cache = target.appearance
/proc/get_action_of_type(mob/M, var/action_type)
/proc/get_action_of_type(mob/M, action_type)
if(!M.actions || !ispath(action_type, /datum/action))
return
for(var/datum/action/A in M.actions)
+1 -1
View File
@@ -225,7 +225,7 @@
name = "Hide"
desc = "Hide yourself from your owner's sight."
button_icon_state = "hide"
UpdateButtonIcon()
UpdateButtons()
/datum/action/innate/imaginary_hide/Activate()
var/mob/camera/imaginary_friend/I = owner
+2 -2
View File
@@ -328,9 +328,9 @@
/// For spawning mineral sheets at a specific location. Used by machines to output sheets.
/datum/component/material_container/proc/retrieve_sheets(sheet_amt, var/datum/material/M, target = null)
if(!M.sheet_type)
return 0 //Add greyscale sheet handling here later
return FALSE //Add greyscale sheet handling here later
if(sheet_amt <= 0)
return 0
return FALSE
if(!target)
target = get_turf(parent)
+2 -2
View File
@@ -268,7 +268,7 @@
else
if(the_event.timeout)
addtimer(CALLBACK(src, .proc/clear_event, null, category), the_event.timeout, TIMER_UNIQUE|TIMER_OVERRIDE)
return 0 //Don't have to update the event.
return FALSE //Don't have to update the event.
the_event = new type(src, param)//This causes a runtime for some reason, was this me? No - there's an event floating around missing a definition.
mood_events[category] = the_event
@@ -280,7 +280,7 @@
/datum/component/mood/proc/clear_event(datum/source, category)
var/datum/mood_event/event = mood_events[category]
if(!event)
return 0
return FALSE
mood_events -= category
qdel(event)
+2 -2
View File
@@ -43,9 +43,9 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
if(spawned_mobs.len >= max_mobs)
return 0
return FALSE
if(spawn_delay > world.time)
return 0
return FALSE
spawn_delay = world.time + spawn_time
var/chosen_mob_type = pick(mob_types)
var/mob/living/simple_animal/L = new chosen_mob_type(P.loc)
+1 -1
View File
@@ -486,7 +486,7 @@
var/atom/A = parent
A.do_squish()
//This proc return 1 if the item can be picked up and 0 if it can't.
//This proc return TRUE if the item can be picked up and 0 if it can't.
//Set the stop_messages to stop it from printing messages
/datum/component/storage/proc/can_be_inserted(obj/item/I, stop_messages = FALSE, mob/M)
if(!istype(I) || (I.item_flags & ABSTRACT))
+3 -3
View File
@@ -49,11 +49,11 @@
/datum/component/summoning/proc/do_spawn_mob(atom/spawn_location, summoner)
if(spawned_mobs.len >= max_mobs)
return 0
return FALSE
if(last_spawned_time > world.time)
return 0
return FALSE
if(!prob(spawn_chance))
return 0
return FALSE
last_spawned_time = world.time + spawn_delay
var/chosen_mob_type = pick(mob_types)
var/mob/living/simple_animal/L = new chosen_mob_type(spawn_location)
+5 -5
View File
@@ -135,11 +135,11 @@
/datum/disease/advance/IsSame(datum/disease/advance/D)
if(!(istype(D, /datum/disease/advance)))
return 0
return FALSE
if(GetDiseaseID() != D.GetDiseaseID())
return 0
return 1
return FALSE
return TRUE
// Returns the advance disease with a different reference memory.
/datum/disease/advance/Copy()
@@ -178,8 +178,8 @@
/datum/disease/advance/proc/HasSymptom(datum/symptom/S)
for(var/datum/symptom/symp in symptoms)
if(symp.type == S.type)
return 1
return 0
return TRUE
return FALSE
// Will generate new unique symptoms, use this if there are none. Returns a list of symptoms that were generated.
/datum/disease/advance/proc/GenerateSymptoms(level_min, level_max, amount_get = 0)
@@ -64,11 +64,11 @@ Bonus
/datum/symptom/choking/proc/Choke_stage_3_4(mob/living/M, datum/disease/advance/A)
M.adjustOxyLoss(rand(6,13))
return 1
return TRUE
/datum/symptom/choking/proc/Choke(mob/living/M, datum/disease/advance/A)
M.adjustOxyLoss(rand(10,18))
return 1
return TRUE
/*
//////////////////////////////////////
@@ -136,17 +136,17 @@ Bonus
/datum/symptom/asphyxiation/proc/Asphyxiate_stage_3_4(mob/living/M, datum/disease/advance/A)
var/get_damage = rand(10,15) * power
M.adjustOxyLoss(get_damage)
return 1
return TRUE
/datum/symptom/asphyxiation/proc/Asphyxiate(mob/living/M, datum/disease/advance/A)
var/get_damage = rand(15,21) * power
M.adjustOxyLoss(get_damage)
if(paralysis)
M.reagents.add_reagent_list(list(/datum/reagent/toxin/pancuronium = 3, /datum/reagent/toxin/sodium_thiopental = 3))
return 1
return TRUE
/datum/symptom/asphyxiation/proc/Asphyxiate_death(mob/living/M, datum/disease/advance/A)
var/get_damage = rand(25,35) * power
M.adjustOxyLoss(get_damage)
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, get_damage/2)
return 1
return TRUE
@@ -58,4 +58,4 @@ Bonus
M.adjust_bodytemperature(get_heat * A.stage, 0, BODYTEMP_HEAT_DAMAGE_LIMIT - 1)
else
M.adjust_bodytemperature(get_heat * A.stage)
return 1
return TRUE
@@ -71,14 +71,14 @@ Bonus
M.adjustFireLoss(3 * power)
if(infective)
A.spread(2)
return 1
return TRUE
/datum/symptom/fire/proc/Firestacks_stage_5(mob/living/M, datum/disease/advance/A)
M.adjust_fire_stacks(3 * power)
M.adjustFireLoss(5 * power)
if(infective)
A.spread(4)
return 1
return TRUE
/*
//////////////////////////////////////
@@ -157,7 +157,7 @@ Bonus
M.adjustFireLoss(get_stacks/2)
if(chems)
M.reagents.add_reagent(/datum/reagent/clf3, 2 * power)
return 1
return TRUE
/datum/symptom/alkali/proc/Alkali_fire_stage_5(mob/living/M, datum/disease/advance/A)
var/get_stacks = 8 * power
@@ -165,4 +165,4 @@ Bonus
M.adjustFireLoss(get_stacks)
if(chems)
M.reagents.add_reagent_list(list(/datum/reagent/napalm = 4 * power, /datum/reagent/clf3 = 4 * power))
return 1
return TRUE
@@ -65,7 +65,7 @@ Bonus
var/mob/living/carbon/human/H = M
var/obj/item/bodypart/random_part = pick(H.bodyparts)
random_part.generic_bleedstacks += 5 * power
return 1
return TRUE
/*
//////////////////////////////////////
@@ -133,4 +133,4 @@ Bonus
M.reagents.add_reagent_list(list(/datum/reagent/toxin/heparin = 2, /datum/reagent/toxin/lipolicide = 2))
if(zombie)
M.reagents.add_reagent(/datum/reagent/romerol, 1)
return 1
return TRUE
@@ -92,7 +92,7 @@
for(var/obj/item/bodypart/L in parts)
if(L.heal_damage(heal_amt/parts.len, heal_amt/parts.len))
M.update_damage_overlays()
return 1
return TRUE
/datum/symptom/heal/starlight/passive_message_condition(mob/living/M)
if(M.getBruteLoss() || M.getFireLoss() || M.getToxLoss())
@@ -129,7 +129,7 @@
M.adjust_nutrition(0.3)
if(prob(2))
to_chat(M, "<span class='notice'>You feel a mild warmth as your blood purifies itself.</span>")
return 1
return TRUE
@@ -167,7 +167,7 @@
C.adjust_nutrition(-lost_nutrition * HUNGER_FACTOR) //Hunger depletes at 10x the normal speed
if(prob(2))
to_chat(C, "<span class='notice'>You feel an odd gurgle in your stomach, as if it was working much faster than normal.</span>")
return 1
return TRUE
/datum/symptom/heal/darkness
name = "Nocturnal Regeneration"
@@ -210,7 +210,7 @@
for(var/obj/item/bodypart/L in parts)
if(L.heal_damage(heal_amt/parts.len, heal_amt/parts.len * 0.5)) //more effective on brute
M.update_damage_overlays()
return 1
return TRUE
/datum/symptom/heal/darkness/passive_message_condition(mob/living/M)
if(M.getBruteLoss() || M.getFireLoss())
@@ -307,7 +307,7 @@
if(active_coma && M.getBruteLoss() + M.getFireLoss() == 0)
uncoma(M)
return 1
return TRUE
/datum/symptom/heal/coma/passive_message_condition(mob/living/M)
if((M.getBruteLoss() + M.getFireLoss()) > 30)
@@ -365,7 +365,7 @@
if(L.heal_damage(heal_amt/parts.len * 0.5, heal_amt/parts.len))
M.update_damage_overlays()
return 1
return TRUE
/datum/symptom/heal/water/passive_message_condition(mob/living/M)
if(M.getBruteLoss() || M.getFireLoss())
@@ -435,7 +435,7 @@
for(var/obj/item/bodypart/L in parts)
if(L.heal_damage(heal_amt/parts.len, heal_amt/parts.len))
M.update_damage_overlays()
return 1
return TRUE
/datum/symptom/heal/radiation
@@ -475,7 +475,7 @@
if(RAD_BURN_THRESHOLD to RAD_MOB_MUTATE)
return 0.75
if(RAD_MOB_MUTATE to RAD_MOB_KNOCKDOWN)
return 1
return TRUE
else
return 1.5
@@ -498,4 +498,4 @@
for(var/obj/item/bodypart/L in parts)
if(L.heal_damage(heal_amt/parts.len, heal_amt/parts.len))
M.update_damage_overlays()
return 1
return TRUE
@@ -58,4 +58,4 @@ Bonus
if(unsafe)
limit = 0
M.adjust_bodytemperature(-get_cold * A.stage, limit)
return 1
return TRUE
+4 -4
View File
@@ -538,7 +538,7 @@
/datum/dna/proc/check_block_string(mutation)
if((LAZYLEN(mutation_index) > DNA_MUTATION_BLOCKS) || !(mutation in mutation_index))
return 0
return FALSE
return is_gene_active(mutation)
/datum/dna/proc/is_gene_active(mutation)
@@ -585,7 +585,7 @@
/proc/setblock(istring, blocknumber, replacement, blocksize=DNA_BLOCK_SIZE)
if(!istring || !blocknumber || !replacement || !blocksize)
return 0
return FALSE
return getleftblocks(istring, blocknumber, blocksize) + replacement + getrightblocks(istring, blocknumber, blocksize)
/datum/dna/proc/mutation_in_sequence(mutation)
@@ -649,7 +649,7 @@
/proc/scramble_dna(mob/living/carbon/M, ui=FALSE, se=FALSE, probability)
if(!M.has_dna())
return 0
return FALSE
if(se)
for(var/i=1, i<=DNA_MUTATION_BLOCKS, i++)
if(prob(probability))
@@ -660,7 +660,7 @@
if(prob(probability))
M.dna.uni_identity = setblock(M.dna.uni_identity, i, random_string(DNA_BLOCK_SIZE, GLOB.hex_characters))
M.updateappearance(mutations_overlay_update=1)
return 1
return TRUE
//value in range 1 to values. values must be greater than 0
//all arguments assumed to be positive integers
+12 -7
View File
@@ -63,7 +63,7 @@
if(suits_with_helmet_typecache[A.type])
RegisterSignal(A, COMSIG_SUIT_MADE_HELMET, .proc/register_helmet) //you better work now you slut
else if(_flags & POLYCHROMIC_ACTION && ismob(A)) //in the event mob update icon procs are ever standarized.
var/datum/action/polychromic/P = new(A)
var/datum/action/item_action/polychromic/P = new(A)
RegisterSignal(P, COMSIG_ACTION_TRIGGER, .proc/activate_action)
actions_by_atom[A] = P
P.Grant(A)
@@ -73,7 +73,7 @@
/datum/element/polychromic/Detach(atom/A)
. = ..()
colors_by_atom -= A
var/datum/action/polychromic/P = actions_by_atom[A]
var/datum/action/item_action/polychromic/P = actions_by_atom[A]
if(P)
actions_by_atom -= A
qdel(P)
@@ -146,7 +146,7 @@
/datum/element/polychromic/proc/grant_user_action(atom/source, mob/user, slot)
if(slot == ITEM_SLOT_BACKPACK || slot == ITEM_SLOT_LEGCUFFED || slot == ITEM_SLOT_HANDCUFFED || slot == ITEM_SLOT_DEX_STORAGE)
return
var/datum/action/polychromic/P = actions_by_atom[source]
var/datum/action/item_action/polychromic/P = actions_by_atom[source]
if(!P)
P = new (source)
P.name = "Modify [source]'\s Colors"
@@ -156,7 +156,7 @@
P.Grant(user)
/datum/element/polychromic/proc/remove_user_action(atom/source, mob/user)
var/datum/action/polychromic/P = actions_by_atom[source]
var/datum/action/item_action/polychromic/P = actions_by_atom[source]
P?.Remove(user)
/datum/element/polychromic/proc/activate_action(datum/action/source, atom/target)
@@ -197,9 +197,14 @@
helmet_by_suit -= S
colors_by_atom -= source
/datum/action/polychromic
/datum/action/item_action/polychromic
name = "Modify Polychromic Colors"
background_icon_state = "bg_polychromic"
use_target_appearance = TRUE
button_icon_state = null
target_appearance_matrix = list(0.8,0,0,0,0.8,0)
check_flags = NONE
/datum/action/item_action/polychromic/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force)
var/matrix/save_matrix = target.transform
target.transform = matrix(0.8, 0, 0, 0, 0.8, 0)
. = ..()
target.transform = save_matrix
+1 -1
View File
@@ -397,7 +397,7 @@ GLOBAL_LIST_EMPTY(explosions)
var/choice = input("Bomb Size?") in choices
switch(choice)
if(null)
return 0
return FALSE
if("Small Bomb")
dev = 1
heavy = 2
+3 -3
View File
@@ -6,11 +6,11 @@
/datum/martial_art/boxing/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
to_chat(A, "<span class='warning'>Can't disarm while boxing!</span>")
return 1
return TRUE
/datum/martial_art/boxing/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
to_chat(A, "<span class='warning'>Can't grab while boxing!</span>")
return 1
return TRUE
/datum/martial_art/boxing/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
@@ -46,7 +46,7 @@
log_combat(A, D, "knocked out (boxing) ")
else if(D.lying)
D.forcesay(GLOB.hit_appends)
return 1
return TRUE
/datum/martial_art/boxing/teach(mob/living/carbon/human/H, make_temporary = TRUE)
. = ..()
+1 -1
View File
@@ -1661,7 +1661,7 @@ GLOBAL_LIST(objective_choices)
if(istype(S, type))
continue
S.charge_counter = delay
S.updateButtonIcon()
S.UpdateButton()
INVOKE_ASYNC(S, /obj/effect/proc_holder/spell.proc/start_recharge)
/datum/mind/proc/get_ghost(even_if_they_cant_reenter)
+2 -2
View File
@@ -119,8 +119,8 @@
owner.RemoveSpell(power)
qdel(power)
SEND_SIGNAL(owner, COMSIG_HUMAN_MUTATION_LOSS, src)
return 0
return 1
return FALSE
return TRUE
/datum/mutation/human/proc/say_mod(message)
if(message)
+3 -3
View File
@@ -48,7 +48,7 @@
if (aval_r_amnt>reagents_list[r_r])
. = -1
else
return 0
return FALSE
if ((reagents_list?(reagents_list.len):(0)) < avail_reagents.reagent_list.len)
return -1
return .
@@ -58,7 +58,7 @@
if (locate(/obj/) in container)
return -1
else
return 1
return TRUE
. = 1
var/list/checklist = items.Copy()
for (var/obj/O in container)
@@ -71,7 +71,7 @@
if (!found)
. = -1
if (checklist.len)
return 0
return FALSE
return .
//general version
+1 -1
View File
@@ -95,7 +95,7 @@
* Multiplied to clickdelays
*/
/datum/status_effect/proc/action_cooldown_mod()
return 1
return TRUE
////////////////
// ALERT HOOK //
+28 -26
View File
@@ -1,108 +1,110 @@
//This is intended to be a full wrapper. DO NOT directly modify its values
///Container for client viewsize
/datum/viewData
/datum/view_data
var/width = 0
var/height = 0
var/default = ""
var/is_suppressed = FALSE
var/client/chief = null
/datum/viewData/New(client/owner, view_string)
/datum/view_data/New(client/owner, view_string)
default = view_string
chief = owner
apply()
/datum/viewData/proc/setDefault(string)
/datum/view_data/proc/setDefault(string)
default = string
apply()
/datum/viewData/proc/safeApplyFormat()
/datum/view_data/proc/afterViewChange()
if(isZooming())
assertFormat()
return
resetFormat()
else
resetFormat()
var/datum/hud/our_hud = chief?.mob?.hud_used
our_hud.view_audit_buttons() // Make sure our hud's buttons are in our new size
/datum/viewData/proc/assertFormat()//T-Pose
/datum/view_data/proc/assertFormat()//T-Pose
// winset(chief, "mapwindow.map", "zoom=0")
// Citadel Edit - We're using icon dropdown instead
/datum/viewData/proc/resetFormat()//Cuck
/datum/view_data/proc/resetFormat()//Cuck
// winset(chief, "mapwindow.map", "zoom=[chief.prefs.pixel_size]")
// Citadel Edit - We're using icon dropdown instead
/datum/viewData/proc/setZoomMode()
/datum/view_data/proc/setZoomMode()
// winset(chief, "mapwindow.map", "zoom-mode=[chief.prefs.scaling_method]")
// Citadel Edit - We're using icon dropdown instead
/datum/viewData/proc/isZooming()
/datum/view_data/proc/isZooming()
return (width || height)
/datum/viewData/proc/resetToDefault()
/datum/view_data/proc/resetToDefault()
width = 0
height = 0
apply()
/datum/viewData/proc/add(toAdd)
/datum/view_data/proc/add(toAdd)
width += toAdd
height += toAdd
apply()
/datum/viewData/proc/addTo(toAdd)
/datum/view_data/proc/addTo(toAdd)
var/list/shitcode = getviewsize(toAdd)
width += shitcode[1]
height += shitcode[2]
apply()
/datum/viewData/proc/setTo(toAdd)
/datum/view_data/proc/setTo(toAdd)
var/list/shitcode = getviewsize(toAdd) //Backward compatability to account
width = shitcode[1] //for a change in how sizes get calculated. we used to include world.view in
height = shitcode[2] //this, but it was jank, so I had to move it
apply()
/datum/viewData/proc/setBoth(wid, hei)
/datum/view_data/proc/setBoth(wid, hei)
width = wid
height = hei
apply()
/datum/viewData/proc/setWidth(wid)
/datum/view_data/proc/setWidth(wid)
width = wid
apply()
/datum/viewData/proc/setHeight(hei)
/datum/view_data/proc/setHeight(hei)
width = hei
apply()
/datum/viewData/proc/addToWidth(toAdd)
/datum/view_data/proc/addToWidth(toAdd)
width += toAdd
apply()
/datum/viewData/proc/addToHeight(screen, toAdd)
/datum/view_data/proc/addToHeight(screen, toAdd)
height += toAdd
apply()
/datum/viewData/proc/apply()
/datum/view_data/proc/apply()
chief.change_view(getView())
safeApplyFormat()
afterViewChange()
/datum/viewData/proc/supress()
/datum/view_data/proc/supress()
is_suppressed = TRUE
apply()
/datum/viewData/proc/unsupress()
/datum/view_data/proc/unsupress()
is_suppressed = FALSE
apply()
/datum/viewData/proc/getView()
/datum/view_data/proc/getView()
var/list/temp = getviewsize(default)
if(is_suppressed)
return "[temp[1]]x[temp[2]]"
return "[width + temp[1]]x[height + temp[2]]"
/datum/viewData/proc/zoomIn()
/datum/view_data/proc/zoomIn()
resetToDefault()
animate(chief, pixel_x = 0, pixel_y = 0, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
/datum/viewData/proc/zoomOut(radius = 0, offset = 0, direction = FALSE)
/datum/view_data/proc/zoomOut(radius = 0, offset = 0, direction = FALSE)
if(direction)
var/_x = 0
var/_y = 0
+1 -1
View File
@@ -178,7 +178,7 @@
*/
/datum/weather/proc/end()
if(stage == END_STAGE)
return 1
return TRUE
stage = END_STAGE
STOP_PROCESSING(SSweather, src)
update_areas()
+4 -4
View File
@@ -560,9 +560,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/proc/powered(chan) // return true if the area has power to given channel
if(!requires_power)
return 1
return TRUE
if(always_unpowered)
return 0
return FALSE
switch(chan)
if(EQUIP)
return power_equip
@@ -571,10 +571,10 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(ENVIRON)
return power_environ
return 0
return FALSE
/area/space/powered(chan) //Nope.avi
return 0
return FALSE
// called when power status changes
+5 -5
View File
@@ -26,18 +26,18 @@
/area/holodeck/powered(var/chan)
if(!requires_power)
return 1
return TRUE
if(always_unpowered)
return 0
return FALSE
if(!linked)
return 0
return FALSE
var/area/A = get_area(linked)
ASSERT(!istype(A, /area/holodeck))
return A.powered(chan)
/area/holodeck/usage(var/chan)
if(!linked)
return 0
return FALSE
var/area/A = get_area(linked)
ASSERT(!istype(A, /area/holodeck))
return A.usage(chan)
@@ -51,7 +51,7 @@
/area/holodeck/use_power(var/amount, var/chan)
if(!linked)
return 0
return FALSE
var/area/A = get_area(linked)
ASSERT(!istype(A, /area/holodeck))
return A.use_power(amount,chan)
+7 -4
View File
@@ -613,7 +613,10 @@
cut_overlay(managed_overlays)
managed_overlays = null
if(length(new_overlays))
managed_overlays = new_overlays
if (length(new_overlays) == 1)
managed_overlays = new_overlays[1]
else
managed_overlays = new_overlays
add_overlay(new_overlays)
. |= UPDATE_OVERLAYS
@@ -667,7 +670,7 @@
if((explosion_flags & EXPLOSION_FLAG_DENSITY_DEPENDENT) && !density)
return power // no block
else if((explosion_flags & EXPLOSION_FLAG_HARD_OBSTACLE) && !QDELETED(src))
return 0 // fully blocked
return FALSE // fully blocked
/**
* Called when a wave explosion hits this atom.
@@ -1416,7 +1419,7 @@
T = get_turf(src)
if(!T)
return 0
return FALSE
var/list/forced_gravity = list()
SEND_SIGNAL(src, COMSIG_ATOM_HAS_GRAVITY, T, forced_gravity)
@@ -1429,7 +1432,7 @@
return max_grav
if(isspaceturf(T)) // Turf never has gravity
return 0
return FALSE
var/area/A = get_area(T)
if(A.has_gravity) // Areas which always has gravity
+2 -2
View File
@@ -291,9 +291,9 @@
* Called whenever an object moves and by mobs when they attempt to move themselves through space
* And when an object or action applies a force on src, see [newtonian_move][/atom/movable/proc/newtonian_move]
*
* Return 0 to have src start/keep drifting in a no-grav area and 1 to stop/not start drifting
* return FALSE to have src start/keep drifting in a no-grav area and 1 to stop/not start drifting
*
* Mobs should return 1 if they should be able to move of their own volition, see [/client/proc/Move]
* Mobs should return TRUE if they should be able to move of their own volition, see [/client/proc/Move]
*
* Arguments:
* * movement_dir - 0 when stopping or any dir when trying to move
+1 -1
View File
@@ -150,7 +150,7 @@ GLOBAL_LIST_INIT(reverseradiochannels, list(
if(range)
start_point = get_turf(source)
if(!start_point)
return 0
return FALSE
//Send the data
for(var/current_filter in filter_list)
@@ -199,7 +199,7 @@
// Check Overdose: Am I even addicted to blood? Do I even have any in me?
//if (!target.reagents.addiction_list || !target.reagents.reagent_list)
//message_admins("DEBUG2: can_make_vassal() Abort: No reagents")
// return 0
// return FALSE
// Check Overdose: Did my current volume go over the Overdose threshold?
//var/am_addicted = 0
//for (var/datum/reagent/blood/vampblood/blood in target.reagents.addiction_list) // overdosed is tracked in reagent_list, not addiction_list.
@@ -210,7 +210,7 @@
//if (!am_addicted)
//message_admins("DEBUG4: can_make_vassal() Abort: No Blood")
// return 0
// return FALSE
// No Mind!
if(!target.mind || !target.mind.key)
if(display_warning)
+2 -2
View File
@@ -51,10 +51,10 @@ GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our th
changelings += changeling
changeling.special_role = ROLE_CHANGELING
changeling.restricted_roles = restricted_jobs
return 1
return TRUE
else
setup_error = "Not enough changeling candidates"
return 0
return FALSE
/datum/game_mode/changeling/post_setup()
for(var/datum/mind/changeling in changelings)
@@ -20,11 +20,11 @@
/datum/game_mode/traitor/changeling/can_start()
if(!..())
return 0
return FALSE
possible_changelings = get_players_for_role(ROLE_CHANGELING)
if(possible_changelings.len < required_enemies)
return 0
return 1
return FALSE
return TRUE
/datum/game_mode/traitor/changeling/pre_setup()
if(CONFIG_GET(flag/protect_roles_from_antagonist))
@@ -55,7 +55,7 @@
changeling.restricted_roles = restricted_jobs
return ..()
else
return 0
return FALSE
/datum/game_mode/traitor/changeling/post_setup()
for(var/datum/mind/changeling in changelings)
+3 -3
View File
@@ -188,16 +188,16 @@ Credit where due:
equip_servant(L)
add_servant_of_ratvar(L, TRUE)
..()
return 1
return TRUE
/datum/game_mode/proc/greet_servant(mob/M) //Description of their role
if(!M)
return 0
return FALSE
to_chat(M, "<span class='bold large_brass'>You are a servant of Ratvar, the Clockwork Justiciar!</span>")
to_chat(M, "<span class='brass'>Unlock <b>Script</b> scripture by converting a new servant or when 35kw of power is reached.</span>")
to_chat(M, "<span class='brass'><b>Application</b> scripture will be unlocked when 50kw of power is reached.</span>")
M.playsound_local(get_turf(M), 'sound/ambience/antag/clockcultalr.ogg', 100, FALSE, pressure_affected = FALSE)
return 1
return TRUE
/datum/game_mode/proc/equip_servant(mob/living/M) //Grants a clockwork slab to the mob
if(!M || !ishuman(M))
+2 -2
View File
@@ -154,9 +154,9 @@
if(cult_mind.current.onCentCom() || cult_mind.current.onSyndieBase())
acolytes_survived++
if(acolytes_survived>=acolytes_needed)
return 0
return FALSE
else
return 1
return TRUE
/datum/game_mode/cult/generate_report()
@@ -41,8 +41,8 @@
outsellobjective.target = target_mind
outsellobjective.update_explanation_text()
D.objectives += outsellobjective
return 1
return 0
return TRUE
return FALSE
/datum/game_mode/devil/devil_agents/generate_report()
return "Multiple soul merchants have been spotted in the quadrant, and appear to be competing over who can purchase the most souls. Be advised that they are likely to manufacture \
+3 -3
View File
@@ -47,15 +47,15 @@
if(devils.len < required_enemies)
setup_error = "Not enough devil candidates"
return 0
return 1
return FALSE
return TRUE
/datum/game_mode/devil/post_setup()
for(var/datum/mind/devil in devils)
post_setup_finalize(devil)
..()
return 1
return TRUE
/datum/game_mode/devil/generate_report()
return "Infernal creatures have been seen nearby offering great boons in exchange for souls. This is considered theft against Nanotrasen, as all employment contracts contain a lien on the \
+1 -1
View File
@@ -546,7 +546,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
return ruleset.cost + added_threat
else
stack_trace("The starting rule \"[ruleset.name]\" failed to pre_execute.")
return 0
return FALSE
/// Mainly here to facilitate delayed rulesets. All roundstart rulesets are executed with a timered callback to this proc.
/datum/game_mode/dynamic/proc/execute_roundstart_rule(sent_rule)
@@ -115,7 +115,7 @@
/// Returns how much threat to actually spend in the end.
/datum/dynamic_ruleset/proc/scale_up(population, max_scale)
if (!scaling_cost)
return 0
return FALSE
var/antag_fraction = 0
for(var/_ruleset in (mode.executed_rules + list(src))) // we care about the antags we *will* assign, too
+1 -1
View File
@@ -9,7 +9,7 @@
announce_text = "Just have fun and enjoy the game!"
/datum/game_mode/extended/pre_setup()
return 1
return TRUE
/datum/game_mode/extended/generate_report()
return "The transmission mostly failed to mention your sector. It is possible that there is nothing in the Syndicate that could threaten your station during this shift."
+25 -25
View File
@@ -68,22 +68,22 @@
playerC++
if(!GLOB.Debug2)
if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players))
return 0
return FALSE
antag_candidates = get_players_for_role(antag_flag)
if(!GLOB.Debug2)
if(antag_candidates.len < required_enemies)
return 0
return 1
return FALSE
return TRUE
else
message_admins("<span class='notice'>DEBUG: GAME STARTING WITHOUT PLAYER NUMBER CHECKS, THIS WILL PROBABLY BREAK SHIT.</span>")
return 1
return TRUE
///Attempts to select players for special roles the mode might have.
/datum/game_mode/proc/pre_setup()
return 1
return TRUE
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
/datum/game_mode/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report.
@@ -162,10 +162,10 @@
switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out
if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE)
return 1
return TRUE
if(SHUTTLE_CALL)
if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5)
return 1
return TRUE
var/matc = CONFIG_GET(number/midround_antag_time_check)
if(world.time >= (matc * 600))
@@ -202,7 +202,7 @@
//somewhere between 1 and 3 minutes from now
if(!CONFIG_GET(keyed_list/midround_antag)[SSticker.mode.config_tag])
round_converted = 0
return 1
return TRUE
for(var/mob/living/carbon/human/H in antag_candidates)
if(H.client)
replacementmode.make_antag_chance(H)
@@ -213,7 +213,7 @@
///Called by the gameSSticker
/datum/game_mode/process()
return 0
return FALSE
//For things that do not die easily
/datum/game_mode/proc/are_special_antags_dead()
@@ -237,44 +237,44 @@
if(Player.mind)
if(Player.mind.special_role || LAZYLEN(Player.mind.antag_datums))
continuous_sanity_checked = 1
return 0
return FALSE
if(!continuous_sanity_checked)
message_admins("The roundtype ([config_tag]) has no antagonists, continuous round has been defaulted to on and midround_antag has been defaulted to off.")
continuous[config_tag] = TRUE
midround_antag[config_tag] = FALSE
SSshuttle.clearHostileEnvironment(src)
return 0
return FALSE
if(living_antag_player && living_antag_player.mind && isliving(living_antag_player) && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player) && (living_antag_player.mind.special_role || LAZYLEN(living_antag_player.mind.antag_datums)))
return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark.
return FALSE //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark.
for(var/mob/Player in GLOB.alive_mob_list)
if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client)
if(Player.mind.special_role || LAZYLEN(Player.mind.antag_datums)) //Someone's still antaging!
living_antag_player = Player
return 0
return FALSE
if(!are_special_antags_dead())
return FALSE
if(!continuous[config_tag] || force_ending)
return 1
return TRUE
else
round_converted = convert_roundtype()
if(!round_converted)
if(round_ends_with_antag_death)
return 1
return TRUE
else
midround_antag[config_tag] = 0
return 0
return FALSE
return 0
return FALSE
/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere.
return 0
return FALSE
/datum/game_mode/proc/send_intercept()
if(flipseclevel && !(config_tag == "extended"))//CIT CHANGE - lets the security level be flipped roundstart
@@ -533,21 +533,21 @@
//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1
/datum/game_mode/proc/age_check(client/C)
if(get_remaining_days(C) == 0)
return 1 //Available in 0 days = available right now = player is old enough to play.
return 0
return TRUE //Available in 0 days = available right now = player is old enough to play.
return FALSE
/datum/game_mode/proc/get_remaining_days(client/C)
if(!C)
return 0
return FALSE
if(C.prefs?.db_flags & DB_FLAG_EXEMPT)
return 0
return FALSE
if(!CONFIG_GET(flag/use_age_restriction_for_jobs))
return 0
return FALSE
if(!isnum(C.player_age))
return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced
return FALSE //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced
if(!isnum(enemy_minimum_age))
return 0
return FALSE
return max(0, enemy_minimum_age - C.player_age)
+2 -2
View File
@@ -639,11 +639,11 @@ GLOBAL_LIST_EMPTY(possible_items)
if(istype(I, steal_target))
if(!targetinfo) //If there's no targetinfo, then that means it was a custom objective. At this point, we know you have the item, so return 1.
return TRUE
else if(targetinfo.check_special_completion(I))//Returns 1 by default. Items with special checks will return 1 if the conditions are fulfilled.
else if(targetinfo.check_special_completion(I))//Returns 1 by default. Items with special checks will return TRUE if the conditions are fulfilled.
return TRUE
if(targetinfo && (I.type in targetinfo.altitems)) //Ok, so you don't have the item. Do you have an alternative, at least?
if(targetinfo.check_special_completion(I))//Yeah, we do! Don't return 0 if we don't though - then you could fail if you had 1 item that didn't pass and got checked first!
if(targetinfo.check_special_completion(I))//Yeah, we do! Don't return FALSE if we don't though - then you could fail if you had 1 item that didn't pass and got checked first!
return TRUE
return FALSE
+5 -5
View File
@@ -9,7 +9,7 @@
var/list/special_equipment = list()
/datum/objective_item/proc/check_special_completion() //for objectives with special checks (is that slime extract unused? does that intellicard have an ai in it? etcetc)
return 1
return TRUE
/datum/objective_item/proc/TargetExists()
return TRUE
@@ -142,8 +142,8 @@
/datum/objective_item/steal/functionalai/check_special_completion(obj/item/aicard/C)
for(var/mob/living/silicon/ai/A in C)
if(isAI(A) && A.stat != DEAD) //See if any AI's are alive inside that card.
return 1
return 0
return TRUE
return FALSE
/datum/objective_item/steal/blueprints
name = "the station blueprints."
@@ -169,8 +169,8 @@
/datum/objective_item/steal/slime/check_special_completion(obj/item/slime_extract/E)
if(E.Uses > 0)
return 1
return 0
return TRUE
return FALSE
//Unique Objectives
/datum/objective_item/unique/docs_red
+1 -1
View File
@@ -23,7 +23,7 @@
START_PROCESSING(SSprocessing, src)
/datum/sabotage_objective/processing/proc/check_condition_processing()
return 1
return TRUE
/datum/sabotage_objective/processing/process()
check_condition_processing()
+1 -1
View File
@@ -34,7 +34,7 @@
return get_points() ? TRUE : FALSE
/datum/objective/overthrow/proc/get_points()
return 0 // int, not bool
return FALSE // int, not bool
/datum/objective/overthrow/proc/result_points(datum/mind/the_dude, base_points) // App
var/initial_points = base_points
+1 -1
View File
@@ -11,7 +11,7 @@
/datum/game_mode/sandbox/pre_setup()
for(var/mob/M in GLOB.player_list)
M.CanBuild()
return 1
return TRUE
/datum/game_mode/sandbox/post_setup()
..()
+2 -2
View File
@@ -509,8 +509,8 @@ Class Procs:
I.play_tool_sound(src, 50)
setDir(turn(dir,-90))
to_chat(user, "<span class='notice'>You rotate [src].</span>")
return 1
return 0
return TRUE
return FALSE
/obj/proc/can_be_unfasten_wrench(mob/user, silent) //if we can unwrench this object; returns SUCCESSFUL_UNFASTEN and FAILED_UNFASTEN, which are both TRUE, or CANT_UNFASTEN, which isn't.
if(!(isfloorturf(loc) || istype(loc, /turf/open/indestructible)) && !anchored)
+2 -2
View File
@@ -274,7 +274,7 @@
/obj/machinery/camera/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
if(damage_flag == MELEE && damage_amount < 12 && !(stat & BROKEN))
return 0
return FALSE
. = ..()
/obj/machinery/camera/obj_break(damage_flag)
@@ -417,4 +417,4 @@
else
user.sight = 0
user.see_in_dark = 2
return 1
return TRUE
@@ -179,7 +179,7 @@
user.see_invisible = SEE_INVISIBLE_LIVING //can't see ghosts through cameras
user.sight = SEE_TURFS | SEE_BLACKNESS
user.see_in_dark = 2
return 1
return TRUE
/mob/camera/aiEye/remote/Destroy()
if(origin && eye_user)
+5 -5
View File
@@ -505,10 +505,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
updateUsrDialog()
return 0
return FALSE
if(can_open_job(j) != 1)
updateUsrDialog()
return 0
return FALSE
if(opened_positions[edit_job_target] >= 0)
GLOB.time_last_changed_position = world.time / 10
j.total_positions++
@@ -522,10 +522,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
updateUsrDialog()
return 0
return FALSE
if(can_close_job(j) != 1)
updateUsrDialog()
return 0
return FALSE
//Allow instant closing without cooldown if a position has been opened before
if(opened_positions[edit_job_target] <= 0)
GLOB.time_last_changed_position = world.time / 10
@@ -540,7 +540,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
var/datum/job/j = SSjob.GetJob(priority_target)
if(!j)
updateUsrDialog()
return 0
return FALSE
var/priority = TRUE
if(j in SSjob.prioritized_jobs)
SSjob.prioritized_jobs -= j
+6 -6
View File
@@ -27,8 +27,8 @@
/obj/machinery/computer/upload/proc/can_upload_to(mob/living/silicon/S)
if(S.stat == DEAD)
return 0
return 1
return FALSE
return TRUE
/obj/machinery/computer/upload/ai
name = "\improper AI upload console"
@@ -45,9 +45,9 @@
/obj/machinery/computer/upload/ai/can_upload_to(mob/living/silicon/ai/A)
if(!A || !isAI(A))
return 0
return FALSE
if(A.control_disabled)
return 0
return FALSE
return ..()
@@ -66,7 +66,7 @@
/obj/machinery/computer/upload/borg/can_upload_to(mob/living/silicon/robot/B)
if(!B || !iscyborg(B))
return 0
return FALSE
if(B.scrambledcodes || B.emagged)
return 0
return FALSE
return ..()
+2 -2
View File
@@ -571,8 +571,8 @@
if(user.canUseTopic(src, !hasSiliconAccessInArea(user)))
if(!record1 || record1 == active1)
if(!record2 || record2 == active2)
return 1
return 0
return TRUE
return FALSE
/obj/machinery/computer/med_data/laptop
name = "medical laptop"
+3 -3
View File
@@ -805,9 +805,9 @@ What a mess.*/
if(authenticated)
if(user.canUseTopic(src, !hasSiliconAccessInArea(user)))
if(!trim(message1))
return 0
return FALSE
if(!record1 || record1 == active1)
if(!record2 || record2 == active2)
return 1
return 0
return TRUE
return FALSE

Some files were not shown because too many files have changed in this diff Show More