diff --git a/baystation12.dme b/baystation12.dme index fca5b332b0..ceff964733 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -46,10 +46,12 @@ #include "code\_onclick\rig.dm" #include "code\_onclick\telekinesis.dm" #include "code\_onclick\hud\_defines.dm" +#include "code\_onclick\hud\action.dm" #include "code\_onclick\hud\alien_larva.dm" #include "code\_onclick\hud\hud.dm" #include "code\_onclick\hud\human.dm" #include "code\_onclick\hud\monkey.dm" +#include "code\_onclick\hud\movable_screen_objects.dm" #include "code\_onclick\hud\other_mobs.dm" #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 900e89e7e7..1486e54648 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -13,13 +13,6 @@ Therefore, the top right corner (except during admin shenanigans) is at "15,15" */ -//Upper left action buttons, displayed when you pick up an item that has this enabled. -#define ui_action_slot1 "1:6,14:26" -#define ui_action_slot2 "2:8,14:26" -#define ui_action_slot3 "3:10,14:26" -#define ui_action_slot4 "4:12,14:26" -#define ui_action_slot5 "5:14,14:26" - //Lower left, persistant menu #define ui_inventory "1:6,1:5" diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm new file mode 100644 index 0000000000..9781e9c236 --- /dev/null +++ b/code/_onclick/hud/action.dm @@ -0,0 +1,222 @@ +#define AB_ITEM 1 +#define AB_SPELL 2 +#define AB_INNATE 3 +#define AB_GENERIC 4 + +#define AB_CHECK_RESTRAINED 1 +#define AB_CHECK_STUNNED 2 +#define AB_CHECK_LYING 4 +#define AB_CHECK_ALIVE 8 +#define AB_CHECK_INSIDE 16 + + +/datum/action + var/name = "Generic Action" + var/action_type = AB_ITEM + var/procname = null + var/atom/movable/target = null + var/check_flags = 0 + var/processing = 0 + var/active = 0 + var/obj/screen/movable/action_button/button = null + var/button_icon = 'icons/mob/actions.dmi' + var/button_icon_state = "default" + var/background_icon_state = "bg_default" + var/mob/living/owner + +/datum/action/New(var/Target) + target = Target + +/datum/action/Destroy() + if(owner) + Remove(owner) + +/datum/action/proc/Grant(mob/living/T) + if(owner) + if(owner == T) + return + Remove(owner) + owner = T + owner.actions.Add(src) + owner.update_action_buttons() + return + +/datum/action/proc/Remove(mob/living/T) + if(button) + if(T.client) + T.client.screen -= button + del(button) + T.actions.Remove(src) + T.update_action_buttons() + owner = null + return + +/datum/action/proc/Trigger() + if(!Checks()) + return + switch(action_type) + if(AB_ITEM) + if(target) + var/obj/item/item = target + item.ui_action_click() + //if(AB_SPELL) + // if(target) + // var/obj/effect/proc_holder/spell = target + // spell.Click() + if(AB_INNATE) + if(!active) + Activate() + else + Deactivate() + if(AB_GENERIC) + if(target && procname) + call(target,procname)(usr) + return + +/datum/action/proc/Activate() + return + +/datum/action/proc/Deactivate() + return + +/datum/action/proc/Process() + return + +/datum/action/proc/CheckRemoval(mob/living/user) // 1 if action is no longer valid for this mob and should be removed + return 0 + +/datum/action/proc/IsAvailable() + return Checks() + +/datum/action/proc/Checks()// returns 1 if all checks pass + if(!owner) + return 0 + if(check_flags & AB_CHECK_RESTRAINED) + if(owner.restrained()) + return 0 + if(check_flags & AB_CHECK_STUNNED) + if(owner.stunned) + return 0 + if(check_flags & AB_CHECK_LYING) + if(owner.lying) + return 0 + if(check_flags & AB_CHECK_ALIVE) + if(owner.stat) + return 0 + if(check_flags & AB_CHECK_INSIDE) + if(!(target in owner)) + return 0 + return 1 + +/datum/action/proc/UpdateName() + return name + +/obj/screen/movable/action_button + var/datum/action/owner + screen_loc = "WEST,NORTH" + +/obj/screen/movable/action_button/Click(location,control,params) + var/list/modifiers = params2list(params) + if(modifiers["shift"]) + moved = 0 + return 1 + if(usr.next_move >= world.time) // Is this needed ? + return + owner.Trigger() + return 1 + +/obj/screen/movable/action_button/proc/UpdateIcon() + if(!owner) + return + icon = owner.button_icon + icon_state = owner.background_icon_state + + overlays.Cut() + var/image/img + if(owner.action_type == AB_ITEM && owner.target) + var/obj/item/I = owner.target + img = image(I.icon, src , I.icon_state) + else if(owner.button_icon && owner.button_icon_state) + img = image(owner.button_icon,src,owner.button_icon_state) + img.pixel_x = 0 + img.pixel_y = 0 + overlays += img + + if(!owner.IsAvailable()) + color = rgb(128,0,0,128) + else + color = rgb(255,255,255,255) + +//Hide/Show Action Buttons ... Button +/obj/screen/movable/action_button/hide_toggle + name = "Hide Buttons" + icon = 'icons/mob/actions.dmi' + icon_state = "bg_default" + var/hidden = 0 + +/obj/screen/movable/action_button/hide_toggle/Click() + usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden + + hidden = usr.hud_used.action_buttons_hidden + if(hidden) + name = "Show Buttons" + else + name = "Hide Buttons" + UpdateIcon() + usr.update_action_buttons() + + +/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(var/mob/living/user) + if(isalien(user)) + icon_state = "bg_alien" + else + icon_state = "bg_default" + UpdateIcon() + return + +/obj/screen/movable/action_button/hide_toggle/UpdateIcon() + overlays.Cut() + var/image/img = image(icon,src,hidden?"show":"hide") + overlays += img + return + +//This is the proc used to update all the action buttons. Properly defined in /mob/living/ +/mob/proc/update_action_buttons() + return + +#define AB_WEST_OFFSET 4 +#define AB_NORTH_OFFSET 26 +#define AB_MAX_COLUMNS 10 + +/datum/hud/proc/ButtonNumberToScreenCoords(var/number) // TODO : Make this zero-indexed for readabilty + var/row = round((number-1)/AB_MAX_COLUMNS) + var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1 + var/coord_col = "+[col-1]" + var/coord_col_offset = AB_WEST_OFFSET+2*col + var/coord_row = "[-1 - row]" + var/coord_row_offset = AB_NORTH_OFFSET + return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:[coord_row_offset]" + +/datum/hud/proc/SetButtonCoords(var/obj/screen/button,var/number) + var/row = round((number-1)/AB_MAX_COLUMNS) + var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1 + var/x_offset = 32*(col-1) + AB_WEST_OFFSET + 2*col + var/y_offset = -32*(row+1) + AB_NORTH_OFFSET + + var/matrix/M = matrix() + M.Translate(x_offset,y_offset) + button.transform = M + +//Presets for item actions +/datum/action/item_action + check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_ALIVE|AB_CHECK_INSIDE + +/datum/action/item_action/CheckRemoval(mob/living/user) + return !(target in user) + +/datum/action/item_action/hands_free + check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE + +#undef AB_WEST_OFFSET +#undef AB_NORTH_OFFSET +#undef AB_MAX_COLUMNS \ No newline at end of file diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index f39499f3dc..665e3e64f3 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -133,7 +133,8 @@ var/list/global_huds = list( var/list/other var/list/obj/screen/hotkeybuttons - var/list/obj/screen/item_action/item_action_list = list() //Used for the item action ui buttons. + var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle + var/action_buttons_hidden = 0 datum/hud/New(mob/owner) mymob = owner @@ -279,8 +280,6 @@ datum/hud/New(mob/owner) src.client.screen -= src.hud_used.other if(src.hud_used.hotkeybuttons) src.client.screen -= src.hud_used.hotkeybuttons - if(src.hud_used.item_action_list) - src.client.screen -= src.hud_used.item_action_list //Due to some poor coding some things need special treatment: //These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay @@ -338,8 +337,6 @@ datum/hud/New(mob/owner) src.client.screen -= src.hud_used.other if(src.hud_used.hotkeybuttons) src.client.screen -= src.hud_used.hotkeybuttons - if(src.hud_used.item_action_list) - src.client.screen -= src.hud_used.item_action_list src.client.screen -= src.internals src.client.screen += src.hud_used.action_intent //we want the intent swticher visible else diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 97b07e6154..2e894acdd6 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -385,52 +385,6 @@ client.screen -= hud_used.hotkeybuttons hud_used.hotkey_ui_hidden = 1 - -/mob/living/carbon/human/update_action_buttons() - var/num = 1 - if(!hud_used) return - if(!client) return - - if(!hud_used.hud_shown) //Hud toggled to minimal - return - - client.screen -= hud_used.item_action_list - - hud_used.item_action_list = list() - for(var/obj/item/I in src) - if(I.icon_action_button) - var/obj/screen/item_action/A = new(hud_used) - - //A.icon = 'icons/mob/screen1_action.dmi' - //A.icon_state = I.icon_action_button - A.icon = ui_style2icon(client.prefs.UI_style) - A.icon_state = "template" - var/image/img = image(I.icon, A, I.icon_state) - img.pixel_x = 0 - img.pixel_y = 0 - A.overlays += img - - if(I.action_button_name) - A.name = I.action_button_name - else - A.name = "Use [I.name]" - A.owner = I - hud_used.item_action_list += A - switch(num) - if(1) - A.screen_loc = ui_action_slot1 - if(2) - A.screen_loc = ui_action_slot2 - if(3) - A.screen_loc = ui_action_slot3 - if(4) - A.screen_loc = ui_action_slot4 - if(5) - A.screen_loc = ui_action_slot5 - break //5 slots available, so no more can be added. - num++ - src.client.screen += src.hud_used.item_action_list - //Used for new human mobs created by cloning/goleming/etc. /mob/living/carbon/human/proc/set_cloned_appearance() f_style = "Shaved" diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm new file mode 100644 index 0000000000..5034606256 --- /dev/null +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -0,0 +1,84 @@ +////////////////////////// +//Movable Screen Objects// +// By RemieRichards // +////////////////////////// + + +//Movable Screen Object +//Not tied to the grid, places it's center where the cursor is + +/obj/screen/movable + var/snap2grid = FALSE + var/moved = FALSE + +//Snap Screen Object +//Tied to the grid, snaps to the nearest turf + +/obj/screen/movable/snap + snap2grid = TRUE + + +/obj/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params) + var/list/PM = params2list(params) + + //No screen-loc information? abort. + if(!PM || !PM["screen-loc"]) + return + + //Split screen-loc up into X+Pixel_X and Y+Pixel_Y + var/list/screen_loc_params = text2list(PM["screen-loc"], ",") + + //Split X+Pixel_X up into list(X, Pixel_X) + var/list/screen_loc_X = text2list(screen_loc_params[1],":") + + //Split Y+Pixel_Y up into list(Y, Pixel_Y) + var/list/screen_loc_Y = text2list(screen_loc_params[2],":") + + if(snap2grid) //Discard Pixel Values + screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]" + + else //Normalise Pixel Values (So the object drops at the center of the mouse, not 16 pixels off) + var/pix_X = text2num(screen_loc_X[2]) - 16 + var/pix_Y = text2num(screen_loc_Y[2]) - 16 + screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]" + + moved = TRUE + + +//Debug procs +/client/proc/test_movable_UI() + set category = "Debug" + set name = "Spawn Movable UI Object" + + var/obj/screen/movable/M = new() + M.name = "Movable UI Object" + M.icon_state = "block" + M.maptext = "Movable" + M.maptext_width = 64 + + var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text + if(!screen_l) + return + + M.screen_loc = screen_l + + screen += M + + +/client/proc/test_snap_UI() + set category = "Debug" + set name = "Spawn Snap UI Object" + + var/obj/screen/movable/snap/S = new() + S.name = "Snap UI Object" + S.icon_state = "block" + S.maptext = "Snap" + S.maptext_width = 64 + + var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text + if(!screen_l) + return + + S.screen_loc = screen_l + + screen += S \ No newline at end of file diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 4a7d6f2acb..f0cc69fcda 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -61,11 +61,6 @@ owner.ui_action_click() return 1 -//This is the proc used to update all the action buttons. It just returns for all mob types except humans. -/mob/proc/update_action_buttons() - return - - /obj/screen/grab name = "grab" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 90edc04c0c..45d6dd0624 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -21,8 +21,9 @@ var/max_heat_protection_temperature //Set this variable to determine up to which temperature (IN KELVIN) the item protects against heat damage. Keep at null to disable protection. Only protects areas set by heat_protection flags var/min_cold_protection_temperature //Set this variable to determine down to which temperature (IN KELVIN) the item protects against cold damage. 0 is NOT an acceptable number due to if(varname) tests!! Keep at null to disable protection. Only protects areas set by cold_protection flags - var/icon_action_button //If this is set, The item will make an action button on the player's HUD when picked up. The button will have the icon_action_button sprite from the screen1_action.dmi file. - var/action_button_name //This is the text which gets displayed on the action button. If not set it defaults to 'Use [name]'. Note that icon_action_button needs to be set in order for the action button to appear. + var/datum/action/item_action/action = null + var/action_button_name //It is also the text which gets displayed on the action button. If not set it defaults to 'Use [name]'. If it's not set, there'll be no button. + var/action_button_is_hands_free = 0 //If 1, bypass the restrained, lying, and stunned checks action buttons normally test for //Since any item can now be a piece of clothing, this has to be put here so all items share it. var/flags_inv //This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc. @@ -398,9 +399,7 @@ var/list/global/slot_flags_enumeration = list( //The default action is attack_self(). //Checks before we get to here are: mob is alive, mob is not restrained, paralyzed, asleep, resting, laying, item is on the mob. /obj/item/proc/ui_action_click() - if( src in usr ) - attack_self(usr) - + attack_self(usr) /obj/item/proc/IsShield() return 0 diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index b8884608d7..f68451f329 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -10,7 +10,7 @@ matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 20) - icon_action_button = "action_flashlight" + action_button_name = "Toggle Flashlight" var/on = 0 var/brightness_on = 4 //luminosity when on @@ -141,7 +141,7 @@ light_color = "#e58775" icon_state = "flare" item_state = "flare" - icon_action_button = null //just pull it manually, neckbeard. + action_button_name = null //just pull it manually, neckbeard. var/fuel = 0 var/on_damage = 7 var/produce_heat = 1500 diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm index b3b9e229a7..745f828d84 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -11,7 +11,7 @@ var/on = 0.0 var/stabilization_on = 0 var/volume_rate = 500 //Needed for borg jetpack transfer - icon_action_button = "action_jetpack" + action_button_name = "Toggle Jetpack" /obj/item/weapon/tank/jetpack/New() ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a11f0b8d7d..7fa6bd788b 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -250,11 +250,6 @@ BLIND // can't see anything var/brightness_on var/on = 0 -/obj/item/clothing/head/New() - ..() - if(!icon_action_button && brightness_on) - icon_action_button = "[icon_state]" - /obj/item/clothing/head/attack_self(mob/user) if(brightness_on) if(!isturf(user.loc)) @@ -382,19 +377,19 @@ BLIND // can't see anything var/displays_id = 1 var/rolled_down = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled sprite_sheets = list("Vox" = 'icons/mob/species/vox/uniform.dmi') - + //convenience var for defining the icon state for the overlay used when the clothing is worn. //Also used by rolling/unrolling. var/worn_state = null /obj/item/clothing/under/New() if(worn_state) - if(!item_state_slots) + if(!item_state_slots) item_state_slots = list() item_state_slots[slot_w_uniform_str] = worn_state else worn_state = icon_state - + //autodetect rollability if(rolled_down < 0) if((worn_state + "_d_s") in icon_states('icons/mob/uniform.dmi')) @@ -458,10 +453,10 @@ BLIND // can't see anything if (( usr.restrained() ) || ( usr.stat )) return - + if (!usr.unEquip(src)) return - + switch(over_object.name) if("r_hand") usr.put_in_r_hand(src) @@ -544,7 +539,7 @@ BLIND // can't see anything if(rolled_down < 0) usr << "You cannot roll down [src]!" return - + rolled_down = !rolled_down if(rolled_down) body_parts_covered &= LOWER_TORSO|LEGS|FEET diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 49f6e75f87..9d3d033359 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -37,7 +37,7 @@ desc = "Used for seeing walls, floors, and stuff through anything." icon_state = "meson" item_state = "glasses" - icon_action_button = "action_meson" //This doesn't actually matter, the action button is generated from the current icon_state. But, this is the only way to get it to show up. + action_button_name = "Toggle Goggles" origin_tech = list(TECH_MAGNET = 2, TECH_ENGINERING = 2) toggleable = 1 vision_flags = SEE_TURFS @@ -57,7 +57,6 @@ icon_state = "purple" item_state = "glasses" toggleable = 1 - icon_action_button = "action_science" /obj/item/clothing/glasses/science/New() ..() @@ -76,7 +75,6 @@ origin_tech = list(TECH_MAGNET = 2) darkness_view = 7 toggleable = 1 - icon_action_button = "action_nvg" off_state = "denight" /obj/item/clothing/glasses/night/New() @@ -102,7 +100,6 @@ desc = "Very confusing glasses." icon_state = "material" item_state = "glasses" - icon_action_button = "action_material" origin_tech = list(TECH_MAGNET = 3, TECH_ENGINERING = 3) toggleable = 1 vision_flags = SEE_OBJS @@ -147,7 +144,7 @@ desc = "Protects the eyes from welders, approved by the mad scientist association." icon_state = "welding-g" item_state = "welding-g" - icon_action_button = "action_welding_g" + action_button_name = "Flip Welding Goggles" var/up = 0 /obj/item/clothing/glasses/welding/attack_self() @@ -182,7 +179,6 @@ desc = "Welding goggles made from more expensive materials, strangely smells like potatoes." icon_state = "rwelding-g" item_state = "rwelding-g" - icon_action_button = "action_welding_g" /obj/item/clothing/glasses/sunglasses/blindfold name = "blindfold" @@ -223,7 +219,6 @@ item_state = "glasses" origin_tech = list(TECH_MAGNET = 3) toggleable = 1 - icon_action_button = "action_thermal" vision_flags = SEE_MOBS invisa_view = 2 @@ -249,12 +244,12 @@ name = "Optical Meson Scanner" desc = "Used for seeing walls, floors, and stuff through anything." icon_state = "meson" - origin_tech = list(TECH_MAGNET = 3, TECH_ILLEGAL = 4) + origin_tech = list(TECH_MAGNET = 3, TECH_ILLEGAL = 4) /obj/item/clothing/glasses/thermal/plain toggleable = 0 activation_sound = null - icon_action_button = "" + action_button_name = null /obj/item/clothing/glasses/thermal/plain/monocle name = "Thermoncle" diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 743351f5ca..1b58abddae 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -22,7 +22,7 @@ armor = list(melee = 10, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) flags_inv = (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE) body_parts_covered = HEAD|FACE|EYES - icon_action_button = "action_welding" + action_button_name = "Flip Welding Mask" siemens_coefficient = 0.9 w_class = 3 @@ -48,7 +48,7 @@ flags_inv &= ~(HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE) icon_state = "[initial(icon_state)]up" usr << "You push the [src] up out of your face." - update_clothing_icon() //so our mob-overlays + update_clothing_icon() //so our mob-overlays usr.update_action_buttons() diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 5c214ed070..d1c896f1f4 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -7,11 +7,10 @@ overshoes = 1 var/magpulse = 0 var/icon_base = "magboots" - icon_action_button = "action_blank" - action_button_name = "Toggle the magboots" + action_button_name = "Toggle Magboots" var/obj/item/clothing/shoes/shoes = null //Undershoes var/mob/living/carbon/human/wearer = null //For shoe procs - + /obj/item/clothing/shoes/magboots/proc/set_slowdown() slowdown = shoes? max(SHOES_SLOWDOWN, shoes.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster. if (magpulse) @@ -37,7 +36,7 @@ /obj/item/clothing/shoes/magboots/mob_can_equip(mob/user) var/mob/living/carbon/human/H = user - + if(H.shoes) shoes = H.shoes if(shoes.overshoes) diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index 61013e2276..78ecc731de 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -20,6 +20,7 @@ var/obj/machinery/camera/camera var/list/camera_networks + action_button_name = "Toggle Helmet Light" light_overlay = "helmet_light" brightness_on = 4 on = 0 @@ -28,9 +29,6 @@ if(!camera && camera_networks) - if(!icon_action_button) - icon_action_button = "[icon_state]" - camera = new /obj/machinery/camera(src) camera.replace_networks(camera_networks) camera.c_tag = user.name diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 574b5c1457..7f469f08d7 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -315,7 +315,7 @@ This saves us from having to call add_fingerprint() any time something is put in W.layer = 20 - if(W.icon_action_button) + if(W.action_button_name) update_action_buttons() return 1 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 7f9cca2293..e1abecc16b 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -242,7 +242,7 @@ src << "Your hand won't respond properly, you drop what you're holding!" drop_item() if(getBrainLoss() >= 45) - if(10 <= rn && rn <= 12) + if(10 <= rn && rn <= 12) if(prob(50)) src << "You suddenly black out!" Paralyse(10) @@ -1035,12 +1035,12 @@ blinded = 1 // Check everything else. - + //Vision var/obj/item/organ/vision if(species.vision_organ) vision = internal_organs_by_name[species.vision_organ] - + if(!vision) // Presumably if a species has no vision organs, they see via some other means. eye_blind = 0 blinded = 0 @@ -1049,7 +1049,7 @@ eye_blind = 1 blinded = 1 eye_blurry = 1 - else + else //blindness if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own blinded = 1 @@ -1059,7 +1059,7 @@ else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster eye_blurry = max(eye_blurry-3, 0) blinded = 1 - + //blurry sight if(vision.is_bruised()) // Vision organs impaired? Permablurry. eye_blurry = 1 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 3097d90659..b2ff53ba90 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,3 +1,8 @@ +/mob/living/Life() + ..() + if(stat != DEAD) + handle_actions() + //mob verbs are faster than object verbs. See mob/verb/examine. /mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1)) set name = "Pull" @@ -609,7 +614,7 @@ default behaviour is: /mob/living/proc/escape_inventory(obj/item/weapon/holder/H) if(H != src.loc) return - + var/mob/M = H.loc //Get our mob holder (if any). if(istype(M)) @@ -794,5 +799,5 @@ default behaviour is: inertia_dir = 2 src << " 0) + if(!hud_used.hide_actions_toggle) + hud_used.hide_actions_toggle = new(hud_used) + hud_used.hide_actions_toggle.InitialiseIcon(src) + if(!hud_used.hide_actions_toggle.moved) + hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1) + //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1) + client.screen += hud_used.hide_actions_toggle + + //If simple_animals are ever moved under carbon, then this can probably be moved to carbon as well /mob/living/proc/attack_throat(obj/item/W, obj/item/weapon/grab/G, mob/user) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 8a01f86774..284afa69a4 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -34,6 +34,7 @@ var/mob_always_swap = 0 var/mob/living/cameraFollow = null + var/list/datum/action/actions = list() var/tod = null // Time of death var/update_slimes = 1 diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 615f1d3a41..5ed6df43cf 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -10,6 +10,7 @@ //Status updates, death etc. clamp_values() handle_regular_status_updates() + handle_actions() if(client) handle_regular_hud_updates() diff --git a/icons/mob/actions.dmi b/icons/mob/actions.dmi new file mode 100644 index 0000000000..400db51deb Binary files /dev/null and b/icons/mob/actions.dmi differ