diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm
deleted file mode 100644
index 4744b789712..00000000000
--- a/code/_onclick/hud/action.dm
+++ /dev/null
@@ -1,315 +0,0 @@
-#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)
- if(target)
- target = null
- return ..()
-
-/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
- qdel(button)
- button = null
- if(T.actions)
- 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 = 4+2*col
- var/coord_row = "[-1 - row]"
- var/coord_row_offset = 26
- 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) + 4 + 2*col
- var/y_offset = -32*(row+1) + 26
-
- 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 get(target, /mob/living) != user
-
-/datum/action/item_action/hands_free
- check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE
-
-// for clothing accessories like holsters
-/datum/action/item_action/accessory
- check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_ALIVE
-
-/datum/action/item_action/accessory/Checks()
- . = ..()
- if(!.)
- return 0
- if(target.loc == owner)
- return 1
- if(istype(target.loc, /obj/item/clothing/under) && target.loc.loc == owner)
- return 1
- return 0
-
-///prset for organ actions
-/datum/action/item_action/organ_action
- check_flags = AB_CHECK_ALIVE
-
-/datum/action/item_action/organ_action/CheckRemoval(mob/living/carbon/user)
- if(!iscarbon(user))
- return 1
- if(target in user.internal_organs)
- return 0
- return 1
-
-/datum/action/item_action/organ_action/IsAvailable()
- var/obj/item/organ/internal/I = target
- if(!I.owner)
- return 0
- return ..()
-
-//Preset for spells
-/datum/action/spell_action
- action_type = AB_SPELL
- check_flags = 0
- background_icon_state = "bg_spell"
-
-/datum/action/spell_action/UpdateName()
- var/obj/effect/proc_holder/spell/spell = target
- if(!spell)
- return 0
- return spell.name
-
-/datum/action/spell_action/IsAvailable()
- if(!target)
- return 0
- var/obj/effect/proc_holder/spell/spell = target
-
- if(usr)
- return spell.can_cast(usr)
- else
- if(owner)
- return spell.can_cast(owner)
- return 1
-
-/datum/action/spell_action/CheckRemoval()
- if(owner.mind)
- if(target in owner.mind.spell_list)
- return 0
- return !(target in owner.spell_list)
-
- //Action button controlling a mob's research examine ability.
-/datum/action/scan_mode
- name = "Toggle Research Scanner"
- button_icon_state = "scan_mode"
- check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_ALIVE
- action_type = AB_INNATE
- var/devices = 0 //How may enabled scanners the mob has
-
-/datum/action/scan_mode/Activate()
- active = 1
- owner.research_scanner = 1
- to_chat(owner, " Research analyzer is now active.")
-
-/datum/action/scan_mode/Deactivate()
- active = 0
- owner.research_scanner = 0
- to_chat(owner, " Research analyzer deactivated.")
-
-/datum/action/scan_mode/Grant(mob/living/T)
- devices += 1
- ..(T)
-
-/datum/action/scan_mode/CheckRemoval(mob/living/user)
- if(devices)
- return 0
- return 1
-
-/datum/action/scan_mode/Remove(mob/living/T)
- owner.research_scanner = 0
- ..(T)
diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm
new file mode 100644
index 00000000000..16cb8baa044
--- /dev/null
+++ b/code/_onclick/hud/action_button.dm
@@ -0,0 +1,127 @@
+
+/obj/screen/movable/action_button
+ var/datum/action/linked_action
+ screen_loc = null
+
+/obj/screen/movable/action_button/Click(location,control,params)
+ var/list/modifiers = params2list(params)
+ if(modifiers["shift"])
+ moved = 0
+ usr.update_action_buttons() //redraw buttons that are no longer considered "moved"
+ return 1
+ if(usr.next_move >= world.time) // Is this needed ?
+ return
+ linked_action.Trigger()
+ return 1
+
+//Hide/Show Action Buttons ... Button
+/obj/screen/movable/action_button/hide_toggle
+ name = "Hide Buttons"
+ icon = 'icons/mob/actions.dmi'
+ icon_state = "bg_default"
+ var/hidden = 0
+
+/obj/screen/movable/action_button/hide_toggle/Click(location,control,params)
+ var/list/modifiers = params2list(params)
+ if(modifiers["shift"])
+ moved = 0
+ return 1
+ usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden
+
+ hidden = usr.hud_used.action_buttons_hidden
+ if(hidden)
+ name = "Show Buttons"
+ else
+ name = "Hide Buttons"
+ UpdateIcon()
+ usr.update_action_buttons()
+
+
+/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(mob/living/user)
+ if(isalien(user))
+ icon_state = "bg_alien"
+ else
+ icon_state = "bg_default"
+ UpdateIcon()
+
+/obj/screen/movable/action_button/hide_toggle/proc/UpdateIcon()
+ overlays.Cut()
+ var/image/img = image(icon, src, hidden ? "show" : "hide")
+ overlays += img
+
+
+/obj/screen/movable/action_button/MouseEntered(location,control,params)
+ openToolTip(usr,src,params,title = name,content = desc)
+
+
+/obj/screen/movable/action_button/MouseExited()
+ closeToolTip(usr)
+
+
+/mob/proc/update_action_buttons_icon()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
+//This is the proc used to update all the action buttons.
+/mob/proc/update_action_buttons(reload_screen)
+ if(!hud_used || !client)
+ return
+
+ if(hud_used.hud_shown != HUD_STYLE_STANDARD)
+ return
+
+ var/button_number = 0
+
+ if(hud_used.action_buttons_hidden)
+ for(var/datum/action/A in actions)
+ A.button.screen_loc = null
+ if(reload_screen)
+ client.screen += A.button
+ else
+ for(var/datum/action/A in actions)
+ button_number++
+ A.UpdateButtonIcon()
+ var/obj/screen/movable/action_button/B = A.button
+ if(!B.moved)
+ B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
+ else
+ B.screen_loc = B.moved
+ if(reload_screen)
+ client.screen += B
+
+ if(!button_number)
+ hud_used.hide_actions_toggle.screen_loc = null
+ return
+
+ if(!hud_used.hide_actions_toggle.moved)
+ hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
+ else
+ hud_used.hide_actions_toggle.screen_loc = hud_used.hide_actions_toggle.moved
+ if(reload_screen)
+ client.screen += hud_used.hide_actions_toggle
+
+
+
+#define AB_MAX_COLUMNS 10
+
+/datum/hud/proc/ButtonNumberToScreenCoords(number) // TODO : Make this zero-indexed for readabilty
+ var/row = round((number - 1)/AB_MAX_COLUMNS)
+ var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
+
+ var/coord_col = "+[col-1]"
+ var/coord_col_offset = 4 + 2 * col
+
+ var/coord_row = "[row ? -row : "+0"]"
+
+ return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-6"
+
+/datum/hud/proc/SetButtonCoords(obj/screen/button,number)
+ var/row = round((number-1)/AB_MAX_COLUMNS)
+ var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
+ var/x_offset = 32*(col-1) + 4 + 2*col
+ var/y_offset = -32*(row+1) + 26
+
+ var/matrix/M = matrix()
+ M.Translate(x_offset,y_offset)
+ button.transform = M
diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm
index e49e99ad6b7..29e7c676ac4 100644
--- a/code/_onclick/hud/hud.dm
+++ b/code/_onclick/hud/hud.dm
@@ -36,12 +36,16 @@
var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = 0
+ var/obj/screen/internals
+
/mob/proc/create_mob_hud()
if(client && !hud_used)
hud_used = new /datum/hud(src)
/datum/hud/New(mob/owner)
mymob = owner
+ hide_actions_toggle = new
+ hide_actions_toggle.InitialiseIcon(mymob)
/datum/hud/Destroy()
if(mymob.hud_used == src)
@@ -79,7 +83,6 @@
//clear mob refs to screen objects
mymob.throw_icon = null
- mymob.internals = null
mymob.healths = null
mymob.healthdoll = null
mymob.pullin = null
@@ -92,6 +95,7 @@
alien_plasma_display = null
vampire_blood_display = null
nightvisionicon = null
+ internals = null
mymob = null
return ..()
@@ -122,6 +126,8 @@
if(infodisplay.len)
mymob.client.screen += infodisplay
+ mymob.client.screen += hide_actions_toggle
+
if(action_intent)
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position
@@ -158,7 +164,7 @@
hud_version = display_hud_version
persistant_inventory_update()
- mymob.update_action_buttons()
+ mymob.update_action_buttons(1)
reorganize_alerts()
reload_fullscreen()
diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm
index a56c6b3bcf8..5227a25cde7 100644
--- a/code/_onclick/hud/human.dm
+++ b/code/_onclick/hud/human.dm
@@ -305,8 +305,8 @@
mymob.throw_icon.alpha = ui_alpha
hotkeybuttons += mymob.throw_icon
- mymob.internals = new /obj/screen/internals()
- infodisplay += mymob.internals
+ internals = new /obj/screen/internals()
+ infodisplay += internals
mymob.healths = new /obj/screen/healths()
infodisplay += mymob.healths
diff --git a/code/_onclick/hud/monkey.dm b/code/_onclick/hud/monkey.dm
index ef87435c79f..c6bbbd27ae2 100644
--- a/code/_onclick/hud/monkey.dm
+++ b/code/_onclick/hud/monkey.dm
@@ -96,8 +96,8 @@
mymob.throw_icon.alpha = ui_alpha
hotkeybuttons += mymob.throw_icon
- mymob.internals = new /obj/screen/internals()
- infodisplay += mymob.internals
+ internals = new /obj/screen/internals()
+ infodisplay += internals
mymob.healths = new /obj/screen/healths()
infodisplay += mymob.healths
diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm
index e8d4e4b3d73..315fce5bf65 100644
--- a/code/_onclick/hud/movable_screen_objects.dm
+++ b/code/_onclick/hud/movable_screen_objects.dm
@@ -43,7 +43,7 @@
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
+ moved = screen_loc
//Debug procs
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 24440f013c9..dc59cf16097 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -96,114 +96,99 @@
screen_loc = ui_internal
/obj/screen/internals/Click()
- if(iscarbon(usr))
- var/mob/living/carbon/C = usr
- if(!C.stat && !C.stunned && !C.paralysis && !C.restrained())
- if(C.internal)
- C.internal = null
- to_chat(C, "No longer running on internals.")
- if(C.internals)
- C.internals.icon_state = "internal0"
- else
+ if(!iscarbon(usr))
+ return
+ var/mob/living/carbon/C = usr
+ if(C.incapacitated())
+ return
- var/no_mask
- if(!(C.wear_mask && C.wear_mask.flags & AIRTIGHT))
- if(ishuman(C))
- var/mob/living/carbon/human/H = C
- if(!(H.head && H.head.flags & AIRTIGHT))
- no_mask = 1
+ if(C.internal)
+ C.internal = null
+ to_chat(C, "No longer running on internals.")
+ icon_state = "internal0"
+ else
+ var/no_mask = FALSE
+ if(!C.wear_mask || !(C.wear_mask.flags & AIRTIGHT))
+ if(ishuman(C))
+ var/mob/living/carbon/human/H = C
+ if(!H.head || !(H.head.flags & AIRTIGHT))
+ no_mask = TRUE
- if(no_mask)
- to_chat(C, "You are not wearing a suitable mask or helmet.")
- return 1
- else
- var/list/nicename = null
- var/list/tankcheck = null
- var/breathes = "oxygen" //default, we'll check later
- var/list/contents = list()
- var/from = "on"
+ if(no_mask)
+ to_chat(C, "You are not wearing a suitable mask or helmet.")
+ return
- if(ishuman(C))
- var/mob/living/carbon/human/H = C
- breathes = H.species.breath_type
- nicename = list ("suit", "back", "belt", "right hand", "left hand", "left pocket", "right pocket")
- tankcheck = list (H.s_store, C.back, H.belt, C.r_hand, C.l_hand, H.l_store, H.r_store)
- else
- nicename = list("right hand", "left hand", "back")
- tankcheck = list(C.r_hand, C.l_hand, C.back)
+ var/list/nicename = null
+ var/list/tankcheck = null
+ var/breathes = "oxygen"
+ var/list/contents = list()
+ var/from = "on"
- // Rigs are a fucking pain since they keep an air tank in nullspace.
- if(istype(C.back,/obj/item/weapon/rig))
- var/obj/item/weapon/rig/rig = C.back
- if(rig.air_supply)
- from = "in"
- nicename |= "hardsuit"
- tankcheck |= rig.air_supply
-
- for(var/i=1, i bestcontents)
+ best = i
+ bestcontents = contents[i]
+ //We've determined the best container now we set it as our internals
+ if(best)
+ to_chat(C, "You are now running on internals from [tankcheck[best]] [from] your [nicename[best]].")
+ C.internal = tankcheck[best]
- var/best = 0
- var/bestcontents = 0
- for(var/i=1, i < contents.len + 1 , ++i)
- if(!contents[i])
- continue
- if(contents[i] > bestcontents)
- best = i
- bestcontents = contents[i]
+ if(C.internal)
+ icon_state = "internal1"
+ else
+ to_chat(C, "You don't have a[breathes == "oxygen" ? "n oxygen" : addtext(" ",breathes)] tank.")
-
- //We've determined the best container now we set it as our internals
-
- if(best)
- to_chat(C, "You are now running on internals from [tankcheck[best]] [from] your [nicename[best]].")
- C.internal = tankcheck[best]
-
-
- if(C.internal)
- if(C.internals)
- C.internals.icon_state = "internal1"
- else
- to_chat(C, "You don't have a[breathes=="oxygen" ? "n oxygen" : addtext(" ",breathes)] tank.")
+ C.update_action_buttons_icon()
/obj/screen/mov_intent
name = "run/walk toggle"
diff --git a/code/datums/action.dm b/code/datums/action.dm
new file mode 100644
index 00000000000..745d03bc978
--- /dev/null
+++ b/code/datums/action.dm
@@ -0,0 +1,409 @@
+#define AB_CHECK_RESTRAINED 1
+#define AB_CHECK_STUNNED 2
+#define AB_CHECK_LYING 4
+#define AB_CHECK_CONSCIOUS 8
+
+
+/datum/action
+ var/name = "Generic Action"
+ var/desc = null
+ var/obj/target = null
+ var/check_flags = 0
+ var/processing = 0
+ var/obj/screen/movable/action_button/button = null
+ var/button_icon = 'icons/mob/actions.dmi'
+ var/background_icon_state = "bg_default"
+
+ var/icon_icon = 'icons/mob/actions.dmi'
+ var/button_icon_state = "default"
+ var/mob/owner
+
+/datum/action/New(var/Target)
+ target = Target
+ button = new
+ button.linked_action = src
+ button.name = name
+
+/datum/action/Destroy()
+ if(owner)
+ Remove(owner)
+ if(target)
+ target = null
+ qdel(button)
+ button = null
+ return ..()
+
+/datum/action/proc/Grant(mob/M)
+ if(owner)
+ if(owner == M)
+ return
+ Remove(owner)
+ owner = M
+ M.actions += src
+ if(M.client)
+ M.client.screen += button
+ M.update_action_buttons()
+
+/datum/action/proc/Remove(mob/M)
+ if(M.client)
+ M.client.screen -= button
+ button.moved = FALSE //so the button appears in its normal position when given to another owner.
+ M.actions -= src
+ M.update_action_buttons()
+ owner = null
+
+/datum/action/proc/Trigger()
+ if(!IsAvailable())
+ return 0
+ return 1
+
+/datum/action/proc/Process()
+ return
+
+/datum/action/proc/IsAvailable()// 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 || owner.weakened)
+ return 0
+ if(check_flags & AB_CHECK_LYING)
+ if(owner.lying)
+ return 0
+ if(check_flags & AB_CHECK_CONSCIOUS)
+ if(owner.stat)
+ return 0
+ return 1
+
+/datum/action/proc/UpdateButtonIcon()
+ if(button)
+ button.icon = button_icon
+ button.icon_state = background_icon_state
+
+ ApplyIcon(button)
+
+ if(!IsAvailable())
+ button.color = rgb(128,0,0,128)
+ else
+ button.color = rgb(255,255,255,255)
+ return 1
+
+/datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button)
+ current_button.overlays.Cut()
+ if(icon_icon && button_icon_state)
+ var/image/img
+ img = image(icon_icon, current_button, button_icon_state)
+ img.pixel_x = 0
+ img.pixel_y = 0
+ current_button.overlays += img
+
+//Presets for item actions
+/datum/action/item_action
+ check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_CONSCIOUS
+
+/datum/action/item_action/New(Target)
+ ..()
+ var/obj/item/I = target
+ I.actions += src
+
+/datum/action/item_action/Destroy()
+ var/obj/item/I = target
+ I.actions -= src
+ return ..()
+
+/datum/action/item_action/Trigger()
+ if(!..())
+ return 0
+ if(target)
+ var/obj/item/I = target
+ I.ui_action_click(owner, type)
+ return 1
+
+/datum/action/item_action/ApplyIcon(obj/screen/movable/action_button/current_button)
+ current_button.overlays.Cut()
+ if(target)
+ var/obj/item/I = target
+ var/old_layer = I.layer
+ var/old_plane = I.plane
+ I.layer = 21
+ I.plane = HUD_PLANE
+ current_button.overlays += I
+ I.layer = old_layer
+ I.plane = old_plane
+
+/datum/action/item_action/toggle_light
+ name = "Toggle Light"
+
+/datum/action/item_action/toggle_hood
+ name = "Toggle Hood"
+
+/datum/action/item_action/toggle_firemode
+ name = "Toggle Firemode"
+
+/datum/action/item_action/startchainsaw
+ name = "Pull The Starting Cord"
+
+/datum/action/item_action/toggle_gunlight
+ name = "Toggle Gunlight"
+
+/datum/action/item_action/toggle_mode
+ name = "Toggle Mode"
+
+/datum/action/item_action/toggle_barrier_spread
+ name = "Toggle Barrier Spread"
+
+/datum/action/item_action/equip_unequip_TED_Gun
+ name = "Equip/Unequip TED Gun"
+
+/datum/action/item_action/toggle_paddles
+ name = "Toggle Paddles"
+
+/datum/action/item_action/set_internals
+ name = "Set Internals"
+
+/datum/action/item_action/set_internals/UpdateButtonIcon()
+ if(..()) //button available
+ if(iscarbon(owner))
+ var/mob/living/carbon/C = owner
+ if(target == C.internal)
+ button.icon_state = "bg_default_on"
+
+/datum/action/item_action/toggle_mister
+ name = "Toggle Mister"
+
+/datum/action/item_action/toggle_helmet_light
+ name = "Toggle Helmet Light"
+
+/datum/action/item_action/toggle_helmet_mode
+ name = "Toggle Helmet Mode"
+
+/datum/action/item_action/toggle_hardsuit_mode
+ name = "Toggle Hardsuit Mode"
+
+/datum/action/item_action/toggle
+
+/datum/action/item_action/toggle/New(Target)
+ ..()
+ name = "Toggle [target.name]"
+ button.name = name
+
+/datum/action/item_action/openclose
+
+/datum/action/item_action/openclose/New(Target)
+ ..()
+ name = "Open/Close [target.name]"
+ button.name = name
+
+/datum/action/item_action/button
+
+/datum/action/item_action/button/New(Target)
+ ..()
+ name = "Button/Unbutton [target.name]"
+ button.name = name
+
+/datum/action/item_action/zipper
+
+/datum/action/item_action/zipper/New(Target)
+ ..()
+ name = "Zip/Unzip [target.name]"
+ button.name = name
+
+/datum/action/item_action/halt
+ name = "HALT!"
+
+/datum/action/item_action/hoot
+ name = "Hoot"
+
+/datum/action/item_action/caw
+ name = "Caw"
+
+/datum/action/item_action/toggle_voice_box
+ name = "Toggle Voice Box"
+
+/datum/action/item_action/change
+ name = "Change"
+
+/datum/action/item_action/noir
+ name = "Noir"
+
+/datum/action/item_action/YEEEAAAAAHHHHHHHHHHHHH
+ name = "YEAH!"
+
+/datum/action/item_action/adjust
+
+/datum/action/item_action/adjust/New(Target)
+ ..()
+ name = "Adjust [target.name]"
+ button.name = name
+
+/datum/action/item_action/switch_hud
+ name = "Switch HUD"
+
+/datum/action/item_action/toggle_wings
+ name = "Toggle Wings"
+
+/datum/action/item_action/toggle_helmet
+ name = "Toggle Helmet"
+
+/datum/action/item_action/toggle_jetpack
+ name = "Toggle Jetpack"
+
+/datum/action/item_action/jetpack_stabilization
+ name = "Toggle Jetpack Stabilization"
+
+/datum/action/item_action/jetpack_stabilization/IsAvailable()
+ var/obj/item/weapon/tank/jetpack/J = target
+ if(!istype(J) || !J.on)
+ return 0
+ return ..()
+
+/datum/action/item_action/hands_free
+ check_flags = AB_CHECK_CONSCIOUS
+
+/datum/action/item_action/hands_free/activate
+ name = "Activate"
+
+/datum/action/item_action/toggle_research_scanner
+ name = "Toggle Research Scanner"
+ button_icon_state = "scan_mode"
+
+/datum/action/item_action/toggle_research_scanner/Trigger()
+ if(IsAvailable())
+ owner.research_scanner = !owner.research_scanner
+ to_chat(owner, "Research analyzer is now [owner.research_scanner ? "active" : "deactivated"].")
+ return 1
+
+/datum/action/item_action/toggle_research_scanner/Remove(mob/living/L)
+ if(owner)
+ owner.research_scanner = 0
+ ..()
+
+/datum/action/item_action/toggle_research_scanner/ApplyIcon(obj/screen/movable/action_button/current_button)
+ if(button_icon && button_icon_state)
+ var/image/img = image(button_icon, current_button, "scan_mode")
+ current_button.overlays += img
+
+/datum/action/item_action/remove_badge
+ name = "Remove Holobadge"
+
+///prset for organ actions
+/datum/action/item_action/organ_action
+ check_flags = AB_CHECK_CONSCIOUS
+
+/datum/action/item_action/organ_action/IsAvailable()
+ var/obj/item/organ/internal/I = target
+ if(!I.owner)
+ return 0
+ return ..()
+
+/datum/action/item_action/organ_action/toggle
+
+/datum/action/item_action/organ_action/toggle/New(Target)
+ ..()
+ name = "Toggle [target.name]"
+ button.name = name
+
+// for clothing accessories like holsters
+/datum/action/item_action/accessory
+ check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_CONSCIOUS
+
+/datum/action/item_action/accessory/IsAvailable()
+ . = ..()
+ if(!.)
+ return 0
+ if(target.loc == owner)
+ return 1
+ if(istype(target.loc, /obj/item/clothing/under) && target.loc.loc == owner)
+ return 1
+ return 0
+
+/datum/action/item_action/accessory/holster
+ name = "Holster"
+
+/datum/action/item_action/accessory/storage
+ name = "View Storage"
+
+
+//Preset for spells
+/datum/action/spell_action
+ check_flags = 0
+ background_icon_state = "bg_spell"
+
+/datum/action/spell_action/New(Target)
+ ..()
+ var/obj/effect/proc_holder/spell/S = target
+ S.action = src
+ name = S.name
+ button_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/spell/S = target
+ S.action = null
+ return ..()
+
+/datum/action/spell_action/Trigger()
+ if(!..())
+ return 0
+ if(target)
+ var/obj/effect/proc_holder/spell = target
+ spell.Click()
+ return 1
+
+/datum/action/spell_action/IsAvailable()
+ if(!target)
+ return 0
+ var/obj/effect/proc_holder/spell/spell = target
+
+ if(owner)
+ return spell.can_cast(owner)
+ return 0
+
+/*
+/datum/action/spell_action/alien
+
+/datum/action/spell_action/alien/IsAvailable()
+ if(!target)
+ return 0
+ var/obj/effect/proc_holder/alien/ab = target
+
+ if(owner)
+ return ab.cost_check(ab.check_turf, owner, 1)
+ return 0
+*/
+
+//Preset for general and toggled actions
+/datum/action/innate
+ check_flags = 0
+ var/active = 0
+
+/datum/action/innate/Trigger()
+ if(!..())
+ return 0
+ if(!active)
+ Activate()
+ else
+ Deactivate()
+ return 1
+
+/datum/action/innate/proc/Activate()
+ return
+
+/datum/action/innate/proc/Deactivate()
+ return
+
+//Preset for action that call specific procs (consider innate)
+/datum/action/generic
+ check_flags = 0
+ var/procname
+
+/datum/action/generic/Trigger()
+ if(!..())
+ return 0
+ if(target && procname)
+ call(target,procname)(usr)
+ return 1
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index b37fd3c2b57..da332e3970f 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -1490,15 +1490,7 @@
/datum/mind/proc/AddSpell(var/obj/effect/proc_holder/spell/spell)
spell_list += spell
- if(!spell.action)
- spell.action = new/datum/action/spell_action
- spell.action.target = spell
- spell.action.name = spell.name
- spell.action.button_icon = spell.action_icon
- spell.action.button_icon_state = spell.action_icon_state
- spell.action.background_icon_state = spell.action_background_icon_state
spell.action.Grant(current)
- return
/datum/mind/proc/transfer_actions(var/mob/living/new_character)
if(current && current.actions)
@@ -1507,16 +1499,9 @@
transfer_mindbound_actions(new_character)
/datum/mind/proc/transfer_mindbound_actions(var/mob/living/new_character)
- for(var/obj/effect/proc_holder/spell/spell in spell_list)
- if(!spell.action) // Unlikely but whatever
- spell.action = new/datum/action/spell_action
- spell.action.target = spell
- spell.action.name = spell.name
- spell.action.button_icon = spell.action_icon
- spell.action.button_icon_state = spell.action_icon_state
- spell.action.background_icon_state = spell.action_background_icon_state
- spell.action.Grant(new_character)
- return
+ for(var/X in spell_list)
+ var/obj/effect/proc_holder/spell/S = X
+ S.action.Grant(new_character)
/datum/mind/proc/get_ghost(even_if_they_cant_reenter)
for(var/mob/dead/observer/G in dead_mob_list)
diff --git a/code/datums/spell.dm b/code/datums/spell.dm
index 978eb6e77a2..fa48fcd2ee7 100644
--- a/code/datums/spell.dm
+++ b/code/datums/spell.dm
@@ -134,6 +134,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
/obj/effect/proc_holder/spell/New()
..()
+ action = new(src)
still_recharging_msg = "[name] is still recharging."
charge_counter = charge_max
@@ -152,9 +153,13 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
return
/obj/effect/proc_holder/spell/proc/start_recharge()
+ if(action)
+ action.UpdateButtonIcon()
while(charge_counter < charge_max)
sleep(1)
charge_counter++
+ if(action)
+ action.UpdateButtonIcon()
/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells
before_cast(targets)
diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm
index 0dc3910da1e..91147183ba1 100644
--- a/code/game/gamemodes/cult/cult_items.dm
+++ b/code/game/gamemodes/cult/cult_items.dm
@@ -23,6 +23,7 @@
return
/obj/item/weapon/melee/cultblade/pickup(mob/living/user as mob)
+ ..()
if(!iscultist(user))
to_chat(user, "\red An overwhelming feeling of dread comes over you as you pick up the cultist's sword. It would be wise to be rid of this blade quickly.")
user.Dizzy(120)
@@ -58,7 +59,7 @@
allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade)
armor = list(melee = 50, bullet = 30, laser = 50, energy = 20, bomb = 25, bio = 10, rad = 0)
flags_inv = HIDEJUMPSUIT
-
+
/obj/item/clothing/head/magus
name = "magus helm"
icon_state = "magus"
diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
index 2982cc3543d..71d0264f1f5 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
@@ -13,8 +13,7 @@
blood_overlay_type = "armor"
origin_tech = "materials=5;biotech=4;powerstorage=5;abductor=3"
armor = list(melee = 15, bullet = 15, laser = 15, energy = 15, bomb = 15, bio = 15, rad = 15)
- action_button_name = "Activate"
- action_button_custom_type = /datum/action/item_action/hands_free
+ actions_types = list(/datum/action/item_action/hands_free/activate)
var/mode = VEST_STEALTH
var/stealth_active = 0
var/combat_cooldown = 10
@@ -31,18 +30,21 @@
DeactivateStealth()
armor = combat_armor
icon_state = "vest_combat"
- if(istype(loc, /mob/living/carbon/human))
- var/mob/living/carbon/human/H = loc
- H.update_inv_wear_suit()
- return
if(VEST_COMBAT)// TO STEALTH
mode = VEST_STEALTH
armor = stealth_armor
icon_state = "vest_stealth"
- if(istype(loc, /mob/living/carbon/human))
- var/mob/living/carbon/human/H = loc
- H.update_inv_wear_suit()
- return
+
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ H.update_inv_wear_suit()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
+/obj/item/clothing/suit/armor/abductor/vest/item_action_slot_check(slot, mob/user)
+ if(slot == slot_wear_suit) //we only give the mob the ability to activate the vest if he's actually wearing it.
+ return 1
/obj/item/clothing/suit/armor/abductor/vest/proc/SetDisguise(datum/icon_snapshot/entry)
disguise = entry
@@ -355,7 +357,7 @@ Congratulations! You are now trained for xenobiology research!"}
origin_tech = "materials=6;combat=5;biotech=7;abductor=4"
force = 7
w_class = 3
- action_button_name = "Toggle Mode"
+ actions_types = list(/datum/action/item_action/toggle_mode)
/obj/item/weapon/abductor_baton/proc/toggle(mob/living/user=usr)
mode = (mode+1)%BATON_MODES
diff --git a/code/game/gamemodes/miniantags/abduction/machinery/camera.dm b/code/game/gamemodes/miniantags/abduction/machinery/camera.dm
index 12ef6797746..8d6a3e08c2e 100644
--- a/code/game/gamemodes/miniantags/abduction/machinery/camera.dm
+++ b/code/game/gamemodes/miniantags/abduction/machinery/camera.dm
@@ -2,13 +2,13 @@
name = "Human Observation Console"
var/team = 0
networks = list("SS13","Abductor")
- off_action = new/datum/action/camera_off/abductor //specific datum
- var/datum/action/teleport_in/tele_in_action = new
- var/datum/action/teleport_out/tele_out_action = new
- var/datum/action/teleport_self/tele_self_action = new
- var/datum/action/vest_mode_swap/vest_mode_action = new
- var/datum/action/vest_disguise_swap/vest_disguise_action = new
- var/datum/action/set_droppoint/set_droppoint_action = new
+ off_action = new /datum/action/innate/camera_off/abductor //specific datum
+ var/datum/action/innate/teleport_in/tele_in_action = new
+ var/datum/action/innate/teleport_out/tele_out_action = new
+ var/datum/action/innate/teleport_self/tele_self_action = new
+ var/datum/action/innate/vest_mode_swap/vest_mode_action = new
+ var/datum/action/innate/vest_disguise_swap/vest_disguise_action = new
+ var/datum/action/innate/set_droppoint/set_droppoint_action = new
var/obj/machinery/abductor/console/console
icon = 'icons/obj/abductor.dmi'
@@ -61,7 +61,7 @@
return
return ..()
-/datum/action/camera_off/abductor/Activate()
+/datum/action/innate/camera_off/abductor/Activate()
if(!target || !iscarbon(target))
return
var/mob/living/carbon/C = target
@@ -88,12 +88,11 @@
src.Remove(C)
-/datum/action/teleport_in
+/datum/action/innate/teleport_in
name = "Send To"
button_icon_state = "beam_down"
- action_type = AB_INNATE
-/datum/action/teleport_in/Activate()
+/datum/action/innate/teleport_in/Activate()
if(!target || !iscarbon(owner))
return
var/mob/living/carbon/human/C = owner
@@ -103,24 +102,22 @@
if(cameranet.checkTurfVis(remote_eye.loc))
P.PadToLoc(remote_eye.loc)
-/datum/action/teleport_out
+/datum/action/innate/teleport_out
name = "Retrieve"
button_icon_state = "beam_up"
- action_type = AB_INNATE
-/datum/action/teleport_out/Activate()
+/datum/action/innate/teleport_out/Activate()
if(!target || !iscarbon(owner))
return
var/obj/machinery/abductor/console/console = target
console.TeleporterRetrieve()
-/datum/action/teleport_self
+/datum/action/innate/teleport_self
name = "Send Self"
button_icon_state = "beam_down"
- action_type = AB_INNATE
-/datum/action/teleport_self/Activate()
+/datum/action/innate/teleport_self/Activate()
if(!target || !iscarbon(owner))
return
var/mob/living/carbon/human/C = owner
@@ -130,35 +127,32 @@
if(cameranet.checkTurfVis(remote_eye.loc))
P.MobToLoc(remote_eye.loc,C)
-/datum/action/vest_mode_swap
+/datum/action/innate/vest_mode_swap
name = "Switch Vest Mode"
button_icon_state = "vest_mode"
- action_type = AB_INNATE
-/datum/action/vest_mode_swap/Activate()
+/datum/action/innate/vest_mode_swap/Activate()
if(!target || !iscarbon(owner))
return
var/obj/machinery/abductor/console/console = target
console.FlipVest()
-/datum/action/vest_disguise_swap
+/datum/action/innate/vest_disguise_swap
name = "Switch Vest Disguise"
button_icon_state = "vest_disguise"
- action_type = AB_INNATE
-/datum/action/vest_disguise_swap/Activate()
+/datum/action/innate/vest_disguise_swap/Activate()
if(!target || !iscarbon(owner))
return
var/obj/machinery/abductor/console/console = target
console.SelectDisguise(remote=1)
-/datum/action/set_droppoint
+/datum/action/innate/set_droppoint
name = "Set Experiment Release Point"
button_icon_state = "set_drop"
- action_type = AB_INNATE
-/datum/action/set_droppoint/Activate()
+/datum/action/innate/set_droppoint/Activate()
if(!target || !iscarbon(owner))
return
diff --git a/code/game/gamemodes/miniantags/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm
index 780abb8854f..ac3bfdf7c1e 100644
--- a/code/game/gamemodes/miniantags/morph/morph.dm
+++ b/code/game/gamemodes/miniantags/morph/morph.dm
@@ -172,5 +172,3 @@
return
target.attack_animal(src)
-/mob/living/simple_animal/hostile/morph/update_action_buttons() //So all eaten objects are not counted every life
- return
diff --git a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
index f0e0dc1a883..26fb00b42a8 100644
--- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
+++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
@@ -183,7 +183,8 @@
name = "[initial(name)] ([cast_amount]E)"
user.reveal(reveal)
user.stun(stun)
- user.update_action_buttons()
+ if(action)
+ action.UpdateButtonIcon()
return 1
//Overload Light: Breaks a light that's online and sends out lightning bolts to all nearby people.
diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm
index 2b82afb3639..a26f941188b 100644
--- a/code/game/gamemodes/nuclear/nuclear.dm
+++ b/code/game/gamemodes/nuclear/nuclear.dm
@@ -268,8 +268,7 @@ proc/issyndicate(mob/living/M as mob)
synd_mob.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/syndicate(synd_mob), slot_wear_mask)
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/tank/nitrogen(synd_mob), slot_l_hand)
synd_mob.internal = synd_mob.l_hand
- if(synd_mob.internals)
- synd_mob.internals.icon_state = "internal1"
+ synd_mob.update_internals_hud_icon(1)
var/obj/item/weapon/implant/explosive/E = new/obj/item/weapon/implant/explosive(synd_mob)
E.implant(synd_mob)
diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm
index 07443a9041c..0a84ee81821 100644
--- a/code/game/machinery/computer/camera_advanced.dm
+++ b/code/game/machinery/computer/camera_advanced.dm
@@ -6,8 +6,8 @@
var/mob/camera/aiEye/remote/eyeobj
var/mob/living/carbon/human/current_user = null
var/list/networks = list("SS13")
- var/datum/action/camera_off/off_action = new
- var/datum/action/camera_jump/jump_action = new
+ var/datum/action/innate/camera_off/off_action = new
+ var/datum/action/innate/camera_jump/jump_action = new
/obj/machinery/computer/camera_advanced/proc/CreateEye()
eyeobj = new()
@@ -115,12 +115,11 @@
else
sprint = initial
-/datum/action/camera_off
+/datum/action/innate/camera_off
name = "End Camera View"
- action_type = AB_INNATE
button_icon_state = "camera_off"
-/datum/action/camera_off/Activate()
+/datum/action/innate/camera_off/Activate()
if(!target || !iscarbon(target))
return
var/mob/living/carbon/C = target
@@ -139,12 +138,11 @@
C.unset_machine()
src.Remove(C)
-/datum/action/camera_jump
+/datum/action/innate/camera_jump
name = "Jump To Camera"
- action_type = AB_INNATE
button_icon_state = "camera_jump"
-/datum/action/camera_jump/Activate()
+/datum/action/innate/camera_jump/Activate()
if(!target || !iscarbon(target))
return
var/mob/living/carbon/C = target
diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm
index 0e27b27909c..1ab2b6c4ec2 100644
--- a/code/game/objects/effects/effect_system.dm
+++ b/code/game/objects/effects/effect_system.dm
@@ -515,7 +515,7 @@ steam.start() -- spawns the effect
chemholder.reagents.reaction(A)
if(iscarbon(A))
var/mob/living/carbon/C = A
- if(!(C.wear_mask && (C.internals != null || C.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)))
+ if(C.can_breathe_gas())
chemholder.reagents.copy_to(C, chemholder.reagents.total_volume)
if(istype(A, /obj/machinery/portable_atmospherics/hydroponics))
var/obj/machinery/portable_atmospherics/hydroponics/tray = A
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index d74d831deb5..017583b7336 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -29,10 +29,8 @@
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
- //If this is set, The item will make an action button on the player's HUD when picked up.
- 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_custom_type = null
- var/datum/action/item_action/action = null
+ var/list/actions = list() //list of /datum/action's that this item has.
+ var/list/actions_types = list() //list of paths of action datums to give to the item on New().
var/list/materials = list()
//Since any item can now be a piece of clothing, this has to be put here so all items share it.
@@ -72,10 +70,17 @@
var/sprite_sheets_obj = null //Used to override hardcoded clothing inventory object dmis in human clothing proc.
var/list/species_fit = null //This object has a different appearance when worn by these species
+/obj/item/New()
+ ..()
+ for(var/path in actions_types)
+ new path(src)
+
/obj/item/Destroy()
if(ismob(loc))
var/mob/m = loc
m.unEquip(src, 1)
+ for(var/X in actions)
+ qdel(X)
return ..()
/obj/item/proc/check_allowed_items(atom/target, not_inside, target_self)
@@ -293,14 +298,16 @@
return 1
return 0
-/obj/item/proc/talk_into(mob/M as mob, var/text, var/channel=null)
+/obj/item/proc/talk_into(mob/M, var/text, var/channel=null)
return
-/obj/item/proc/moved(mob/user as mob, old_loc as turf)
+/obj/item/proc/moved(mob/user, old_loc)
return
-/obj/item/proc/dropped(mob/user as mob)
- ..()
+/obj/item/proc/dropped(mob/user)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Remove(user)
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
@@ -324,7 +331,13 @@
// for items that can be placed in multiple slots
// note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(var/mob/user, var/slot)
- return
+ for(var/X in actions)
+ var/datum/action/A = X
+ if(item_action_slot_check(slot, user)) //some items only give their actions buttons when in a specific slot.
+ A.Grant(user)
+
+/obj/item/proc/item_action_slot_check(slot, mob/user)
+ return 1
//returns 1 if the item is equipped by a mob, 0 otherwise.
//This might need some error trapping, not sure if get_equipped_items() is safe for non-human mobs.
@@ -379,11 +392,11 @@
return
-//This proc is executed when someone clicks the on-screen UI button. To make the UI button show, set the 'icon_action_button' to the icon_state of the image of the button in screen1_action.dmi
+//This proc is executed when someone clicks the on-screen UI button.
//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()
- attack_self(usr)
+/obj/item/proc/ui_action_click(mob/user, actiontype)
+ attack_self(user)
/obj/item/proc/IsReflect(var/def_zone) //This proc determines if and at what% an object will reflect energy projectiles if it's in l_hand,r_hand or wear_suit
return 0
diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm
index db2519eca43..74da1ee9187 100644
--- a/code/game/objects/items/devices/flashlight.dm
+++ b/code/game/objects/items/devices/flashlight.dm
@@ -8,7 +8,7 @@
flags = CONDUCT
slot_flags = SLOT_BELT
materials = list(MAT_METAL=50, MAT_GLASS=20)
- action_button_name = "Flashlight"
+ actions_types = list(/datum/action/item_action/toggle_light)
var/on = 0
var/brightness_on = 4 //luminosity when on
@@ -36,6 +36,9 @@
return 0
on = !on
update_brightness(user)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
return 1
diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm
index 3836b8eca80..ffb1d31faa8 100644
--- a/code/game/objects/items/robot/robot_upgrades.dm
+++ b/code/game/objects/items/robot/robot_upgrades.dm
@@ -254,7 +254,8 @@
cyborg = R
icon_state = "selfrepair_off"
- action_button_name = "Toggle Self-Repair"
+ var/datum/action/A = new /datum/action/item_action/toggle(src)
+ A.Grant(R)
return 1
/obj/item/borg/upgrade/selfrepair/Destroy()
@@ -276,6 +277,9 @@
/obj/item/borg/upgrade/selfrepair/update_icon()
if(cyborg)
icon_state = "selfrepair_[on ? "on" : "off"]"
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
else
icon_state = "cyborg_upgrade5"
diff --git a/code/game/objects/items/weapons/chrono_eraser.dm b/code/game/objects/items/weapons/chrono_eraser.dm
index d99e1a6cf07..71e09a3cf0d 100644
--- a/code/game/objects/items/weapons/chrono_eraser.dm
+++ b/code/game/objects/items/weapons/chrono_eraser.dm
@@ -9,7 +9,7 @@
w_class = 4
slot_flags = SLOT_BACK
slowdown = 1
- action_button_name = "Equip/Unequip TED Gun"
+ actions_types = list(/datum/action/item_action/equip_unequip_TED_Gun)
var/obj/item/weapon/gun/energy/chrono_gun/PA = null
var/list/erased_minds = list() //a collection of minds from the dead
@@ -17,6 +17,7 @@
erased_minds += M
/obj/item/weapon/chrono_eraser/dropped()
+ ..()
if(PA)
qdel(PA)
@@ -24,15 +25,19 @@
dropped()
return ..()
-/obj/item/weapon/chrono_eraser/ui_action_click()
- var/mob/living/carbon/user = src.loc
- if(iscarbon(user) && (user.back == src))
- if(PA)
- qdel(PA)
- else
- PA = new(src)
- user.put_in_hands(PA)
+/obj/item/weapon/chrono_eraser/ui_action_click(mob/user)
+ if(iscarbon(user))
+ var/mob/living/carbon/C = user
+ if(C.back == src)
+ if(PA)
+ qdel(PA)
+ else
+ PA = new(src)
+ user.put_in_hands(PA)
+/obj/item/weapon/chrono_eraser/item_action_slot_check(slot, mob/user)
+ if(slot == slot_back)
+ return 1
/obj/item/weapon/gun/energy/chrono_gun
diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm
index 394bf244d59..9ccff568b87 100644
--- a/code/game/objects/items/weapons/defib.dm
+++ b/code/game/objects/items/weapons/defib.dm
@@ -11,7 +11,7 @@
throwforce = 6
w_class = 4
origin_tech = "biotech=4"
- action_button_name = "Toggle Paddles"
+ actions_types = list(/datum/action/item_action/toggle_paddles)
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/back.dmi'
@@ -75,11 +75,7 @@
update_icon()
/obj/item/weapon/defibrillator/ui_action_click()
- if(usr.get_item_by_slot(slot_back) == src)
- toggle_paddles()
- else
- to_chat(usr, "Put the defibrillator on your back first!")
- return
+ toggle_paddles()
/obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/stock_parts/cell))
@@ -148,16 +144,23 @@
remove_paddles(user)
update_icon()
- return
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
/obj/item/weapon/defibrillator/proc/make_paddles()
return new /obj/item/weapon/twohanded/shockpaddles(src)
/obj/item/weapon/defibrillator/equipped(mob/user, slot)
+ ..()
if(slot != slot_back)
remove_paddles(user)
update_icon()
+/obj/item/weapon/defibrillator/item_action_slot_check(slot, mob/user)
+ if(slot == slot_back)
+ return 1
+
/obj/item/weapon/defibrillator/proc/remove_paddles(mob/user)
var/mob/living/carbon/human/M = user
if(paddles in get_both_hands(M))
@@ -211,12 +214,9 @@
slot_flags = SLOT_BELT
origin_tech = "biotech=4"
-/obj/item/weapon/defibrillator/compact/ui_action_click()
- if(usr.get_item_by_slot(slot_belt) == src)
- toggle_paddles()
- else
- to_chat(usr, "Strap the defibrillator's belt on first!")
- return
+/obj/item/weapon/defibrillator/compact/item_action_slot_check(slot, mob/user)
+ if(slot == slot_belt)
+ return 1
/obj/item/weapon/defibrillator/compact/loaded/New()
..()
@@ -285,7 +285,7 @@
/obj/item/weapon/twohanded/shockpaddles/dropped(mob/user as mob)
if(user)
- var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
+ var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
to_chat(user, "The paddles snap back into the main unit.")
diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm
index 4bac1168518..42b74b0e45d 100644
--- a/code/game/objects/items/weapons/implants/implant.dm
+++ b/code/game/objects/items/weapons/implants/implant.dm
@@ -2,9 +2,9 @@
name = "implant"
icon = 'icons/obj/implants.dmi'
icon_state = "generic" //Shows up as the action button icon
- action_button_custom_type = /datum/action/item_action/hands_free
origin_tech = "materials=2;biotech=3;programming=2"
+ actions_types = list(/datum/action/item_action/hands_free/activate)
var/activated = 1 //1 for implant types that can be activated, 0 for ones that are "always on" like mindshield implants
var/implanted = null
var/mob/living/imp_in = null
@@ -41,11 +41,13 @@
return 0
- if(activated)
- action_button_name = "Activate [src.name]"
src.loc = source
imp_in = source
implanted = 1
+ if(activated)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -60,6 +62,10 @@
imp_in = null
implanted = 0
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Grant(source)
+
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -76,6 +82,6 @@
return "No information available"
/obj/item/weapon/implant/dropped(mob/user)
+ ..()
. = 1
qdel(src)
- return .
diff --git a/code/game/objects/items/weapons/implants/implant_freedom.dm b/code/game/objects/items/weapons/implants/implant_freedom.dm
index f94772787e2..3e269622e61 100644
--- a/code/game/objects/items/weapons/implants/implant_freedom.dm
+++ b/code/game/objects/items/weapons/implants/implant_freedom.dm
@@ -8,12 +8,13 @@
/obj/item/weapon/implant/freedom/activate()
- if(uses == 0) return 0
- if(uses != -1) uses--
+ uses--
to_chat(imp_in, "You feel a faint click.")
if(iscarbon(imp_in))
var/mob/living/carbon/C_imp_in = imp_in
C_imp_in.uncuff()
+ if(!uses)
+ qdel(src)
/obj/item/weapon/implant/freedom/get_data()
diff --git a/code/game/objects/items/weapons/implants/implant_misc.dm b/code/game/objects/items/weapons/implants/implant_misc.dm
index af83960356b..c949d7e561e 100644
--- a/code/game/objects/items/weapons/implants/implant_misc.dm
+++ b/code/game/objects/items/weapons/implants/implant_misc.dm
@@ -33,7 +33,6 @@
return dat
/obj/item/weapon/implant/adrenalin/activate()
- if(uses < 1) return 0
uses--
to_chat(imp_in, "You feel a sudden surge of energy!")
imp_in.SetStunned(0)
@@ -46,6 +45,8 @@
imp_in.reagents.add_reagent("synaptizine", 10)
imp_in.reagents.add_reagent("omnizine", 10)
imp_in.reagents.add_reagent("stimulative_agent", 10)
+ if(!uses)
+ qdel(src)
/obj/item/weapon/implant/emp
@@ -56,9 +57,10 @@
uses = 2
/obj/item/weapon/implant/emp/activate()
- if(src.uses < 1) return 0
- src.uses--
+ uses--
empulse(imp_in, 3, 5)
+ if(!uses)
+ qdel(src)
/obj/item/weapon/implant/cortical
name = "cortical stack"
diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm
index 5687a9b90da..5e262ce4afa 100644
--- a/code/game/objects/items/weapons/melee/energy.dm
+++ b/code/game/objects/items/weapons/melee/energy.dm
@@ -217,6 +217,7 @@
spark_system.attach(src)
/obj/item/weapon/melee/energy/blade/dropped()
+ ..()
qdel(src)
/obj/item/weapon/melee/energy/blade/attack_self(mob/user)
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index 2a3a602258e..e2324fcb434 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -373,9 +373,6 @@
handle_item_insertion(W)
return 1
-/obj/item/weapon/storage/dropped(mob/user as mob)
- return
-
/obj/item/weapon/storage/attack_hand(mob/user as mob)
playsound(src.loc, "rustle", 50, 1, -5)
diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm
index ccde1d215e2..af2c59c4759 100644
--- a/code/game/objects/items/weapons/tanks/jetpack.dm
+++ b/code/game/objects/items/weapons/tanks/jetpack.dm
@@ -8,72 +8,86 @@
item_state = "jetpack"
distribute_pressure = ONE_ATMOSPHERE*O2STANDARD
var/datum/effect/system/ion_trail_follow/ion_trail
- var/on = 0.0
- var/stabilization_on = 0
+ actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
+ var/on = 0
+ var/stabilizers = 0
var/volume_rate = 500 //Needed for borg jetpack transfer
- action_button_name = "Toggle Jetpack"
/obj/item/weapon/tank/jetpack/New()
..()
- src.ion_trail = new /datum/effect/system/ion_trail_follow()
- src.ion_trail.set_up(src)
- return
+ ion_trail = new /datum/effect/system/ion_trail_follow()
+ ion_trail.set_up(src)
/obj/item/weapon/tank/jetpack/Destroy()
qdel(ion_trail)
ion_trail = null
return ..()
+/obj/item/weapon/tank/jetpack/ui_action_click(mob/user, actiontype)
+ if(actiontype == /datum/action/item_action/toggle_jetpack)
+ cycle(user)
+ else if(actiontype == /datum/action/item_action/jetpack_stabilization)
+ toggle_stabilization(user)
+ else
+ toggle_internals(user)
+
+/obj/item/weapon/tank/jetpack/proc/toggle_stabilization(mob/user)
+ if(on)
+ stabilizers = !stabilizers
+ to_chat(user, "You turn [src]'s stabilization [stabilizers ? "on" : "off"].")
+
+
/obj/item/weapon/tank/jetpack/examine(mob/user)
if(!..(user, 0))
return
if(air_contents.oxygen < 10)
- to_chat(user, text("\red The meter on the [src.name] indicates you are almost out of air!"))
+ to_chat(user, "The meter on [src] indicates you are almost out of air!")
playsound(user, 'sound/effects/alert.ogg', 50, 1)
-/obj/item/weapon/tank/jetpack/verb/toggle_rockets()
- set name = "Toggle Jetpack Stabilization"
- set category = "Object"
- src.stabilization_on = !( src.stabilization_on )
- to_chat(usr, "You toggle the stabilization [stabilization_on? "on":"off"].")
- return
+/obj/item/weapon/tank/jetpack/proc/cycle(mob/user)
+ if(user.incapacitated())
+ return
-
-/obj/item/weapon/tank/jetpack/verb/toggle()
- set name = "Toggle Jetpack"
- set category = "Object"
- on = !on
- if(on)
- icon_state = "[icon_state]-on"
-// item_state = "[item_state]-on"
- ion_trail.start()
+ if(!on)
+ turn_on()
+ to_chat(user, "You turn the jetpack on.")
else
- icon_state = initial(icon_state)
-// item_state = initial(item_state)
- ion_trail.stop()
- return
+ turn_off()
+ to_chat(user, "You turn the jetpack off.")
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
+
+/obj/item/weapon/tank/jetpack/proc/turn_on()
+ on = TRUE
+ icon_state = "[initial(icon_state)]-on"
+ ion_trail.start()
+
+/obj/item/weapon/tank/jetpack/proc/turn_off()
+ on = FALSE
+ stabilizers = FALSE
+ icon_state = initial(icon_state)
+ ion_trail.stop()
/obj/item/weapon/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob)
- if(!(src.on))
+ if(!on)
return 0
- if((num < 0.005 || src.air_contents.total_moles() < num))
- src.ion_trail.stop()
+ if((num < 0.005 || air_contents.total_moles() < num))
+ turn_off()
return 0
- var/datum/gas_mixture/G = src.air_contents.remove(num)
-
- var/allgases = G.carbon_dioxide + G.nitrogen + G.oxygen + G.toxins //fuck trace gases -Pete
- if(allgases >= 0.005)
- . = 1
-
- qdel(G)
-
-/obj/item/weapon/tank/jetpack/ui_action_click()
- toggle()
+ var/datum/gas_mixture/removed = air_contents.remove(num)
+ if(removed.total_moles() < 0.005)
+ turn_off()
+ return 0
+ var/turf/T = get_turf(user)
+ T.assume_air(removed)
+ return 1
/obj/item/weapon/tank/jetpack/void
name = "Void Jetpack (Oxygen)"
@@ -124,8 +138,8 @@
/obj/item/weapon/tank/jetpack/carbondioxide/New()
..()
- src.ion_trail = new /datum/effect/system/ion_trail_follow()
- src.ion_trail.set_up(src)
+ ion_trail = new /datum/effect/system/ion_trail_follow()
+ ion_trail.set_up(src)
air_contents.carbon_dioxide = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
/obj/item/weapon/tank/jetpack/carbondioxide/examine(mob/user)
@@ -133,35 +147,32 @@
return
if(air_contents.carbon_dioxide < 10)
- to_chat(user, text("\red The meter on the [src.name] indicates you are almost out of air!"))
+ to_chat(user, "The meter on [src] indicates you are almost out of air!")
playsound(user, 'sound/effects/alert.ogg', 50, 1)
/obj/item/weapon/tank/jetpack/rig
name = "jetpack"
var/obj/item/weapon/rig/holder
+ actions_types = list(/datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
/obj/item/weapon/tank/jetpack/rig/examine()
to_chat(usr, "It's a jetpack. If you can see this, report it on the bug tracker.")
return 0
/obj/item/weapon/tank/jetpack/rig/allow_thrust(num, mob/living/user as mob)
-
- if(!(src.on))
+ if(!on)
return 0
if(!istype(holder) || !holder.air_supply)
return 0
- var/obj/item/weapon/tank/pressure_vessel = holder.air_supply
-
- if((num < 0.005 || pressure_vessel.air_contents.total_moles() < num))
- src.ion_trail.stop()
+ var/datum/gas_mixture/removed = holder.air_supply.air_contents.remove(num)
+ if(removed.total_moles() < 0.005)
+ turn_off()
return 0
- var/datum/gas_mixture/G = pressure_vessel.air_contents.remove(num)
+ var/turf/T = get_turf(user)
+ T.assume_air(removed)
- var/allgases = G.carbon_dioxide + G.nitrogen + G.oxygen + G.toxins
- if(allgases >= 0.005)
- . = 1
- qdel(G)
+ return 1
\ No newline at end of file
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 98c6340d927..9415e49d3cd 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -16,6 +16,7 @@
throw_speed = 1
throw_range = 4
+ actions_types = list(/datum/action/item_action/set_internals)
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ONE_ATMOSPHERE
var/integrity = 3
@@ -24,9 +25,9 @@
/obj/item/weapon/tank/New()
..()
- src.air_contents = new /datum/gas_mixture()
- src.air_contents.volume = volume //liters
- src.air_contents.temperature = T20C
+ air_contents = new /datum/gas_mixture()
+ air_contents.volume = volume //liters
+ air_contents.temperature = T20C
processing_objects.Add(src)
return
@@ -39,16 +40,52 @@
return ..()
+
+/obj/item/weapon/tank/ui_action_click(mob/user)
+ toggle_internals(user)
+
+/obj/item/weapon/tank/proc/toggle_internals(mob/user)
+ var/mob/living/carbon/C = user
+ if(!istype(C))
+ return 0
+
+ if(C.internal == src)
+ to_chat(C, "You close \the [src] valve.")
+ C.internal = null
+ C.update_internals_hud_icon(0)
+ else
+ var/can_open_valve = 0
+ if(C.wear_mask && C.wear_mask.flags & AIRTIGHT)
+ can_open_valve = 1
+ else if(ishuman(C))
+ var/mob/living/carbon/human/H = C
+ if(H.head && H.head.flags & AIRTIGHT)
+ can_open_valve = 1
+
+ if(can_open_valve)
+ if(C.internal)
+ to_chat(C, "You switch your internals to [src].")
+ else
+ to_chat(C, "You open \the [src] valve.")
+ C.internal = src
+ C.update_internals_hud_icon(1)
+ else
+ to_chat(C, "You are not wearing a suitable mask or helmet.")
+ return 0
+
+ C.update_action_buttons_icon()
+
+
/obj/item/weapon/tank/examine(mob/user)
var/obj/icon = src
- if(istype(src.loc, /obj/item/assembly))
- icon = src.loc
+ if(istype(loc, /obj/item/assembly))
+ icon = loc
if(!in_range(src, user))
if(icon == src)
to_chat(user, "\blue It's \a [bicon(icon)][src]! If you want any more information you'll need to get closer.")
return
- var/celsius_temperature = src.air_contents.temperature-T0C
+ var/celsius_temperature = air_contents.temperature-T0C
var/descriptive
if(celsius_temperature < 20)
@@ -70,11 +107,11 @@
/obj/item/weapon/tank/blob_act()
if(prob(50))
- var/turf/location = src.loc
+ var/turf/location = loc
if(!( istype(location, /turf) ))
qdel(src)
- if(src.air_contents)
+ if(air_contents)
location.assume_air(air_contents)
qdel(src)
@@ -82,9 +119,9 @@
/obj/item/weapon/tank/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
..()
- src.add_fingerprint(user)
- if(istype(src.loc, /obj/item/assembly))
- icon = src.loc
+ add_fingerprint(user)
+ if(istype(loc, /obj/item/assembly))
+ icon = loc
if((istype(W, /obj/item/device/analyzer)) && get_dist(user, src) <= 1)
atmosanalyzer_scan(air_contents, user)
@@ -93,7 +130,7 @@
bomb_assemble(W,user)
/obj/item/weapon/tank/attack_self(mob/user as mob)
- if(!(src.air_contents))
+ if(!(air_contents))
return
ui_interact(user)
@@ -142,49 +179,23 @@
ui.set_auto_update(1)
/obj/item/weapon/tank/Topic(href, href_list)
- ..()
- if(usr.stat|| usr.restrained())
- return 0
- if(src.loc != usr)
- return 0
+ if(..())
+ return 1
if(href_list["dist_p"])
if(href_list["dist_p"] == "reset")
- src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
+ distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if(href_list["dist_p"] == "max")
- src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
+ distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
- src.distribute_pressure += cp
- src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
+ distribute_pressure += cp
+ distribute_pressure = min(max(round(distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
+
if(href_list["stat"])
- if(istype(loc,/mob/living/carbon))
- var/mob/living/carbon/location = loc
- if(location.internal == src)
- location.internal = null
- location.internals.icon_state = "internal0"
- to_chat(usr, "\blue You close the tank release valve.")
- if(location.internals)
- location.internals.icon_state = "internal0"
- else
+ toggle_internals(usr)
- var/can_open_valve
- if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
- can_open_valve = 1
- else if(istype(location,/mob/living/carbon/human))
- var/mob/living/carbon/human/H = location
- if(H.head && (H.head.flags & AIRTIGHT))
- can_open_valve = 1
-
- if(can_open_valve)
- location.internal = src
- to_chat(usr, "\blue You open \the [src] valve.")
- if(location.internals)
- location.internals.icon_state = "internal1"
- else
- to_chat(usr, "\blue You need something to connect to \the [src].")
-
- src.add_fingerprint(usr)
+ add_fingerprint(usr)
return 1
@@ -226,9 +237,9 @@
var/pressure = air_contents.return_pressure()
if(pressure > TANK_FRAGMENT_PRESSURE)
- if(!istype(src.loc,/obj/item/device/transfer_valve))
- message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast] (JMP)")
- log_game("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast] at [x], [y], [z]")
+ if(!istype(loc,/obj/item/device/transfer_valve))
+ message_admins("Explosive tank rupture! last key to touch the tank was [fingerprintslast] (JMP)")
+ log_game("Explosive tank rupture! last key to touch the tank was [fingerprintslast] at [x], [y], [z]")
// to_chat(world, "\blue[x],[y] tank is exploding: [pressure] kPa")
//Give the gas a chance to build up more pressure through reacting
air_contents.react()
@@ -241,8 +252,8 @@
// to_chat(world, "\blue Exploding Pressure: [pressure] kPa, intensity: [range]")
explosion(epicenter, round(range*0.25), round(range*0.5), round(range), round(range*1.5))
- if(istype(src.loc,/obj/item/device/transfer_valve))
- qdel(src.loc)
+ if(istype(loc,/obj/item/device/transfer_valve))
+ qdel(loc)
else
qdel(src)
@@ -253,7 +264,7 @@
if(!T)
return
T.assume_air(air_contents)
- playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
+ playsound(loc, 'sound/effects/spray.ogg', 10, 1, -3)
qdel(src)
else
integrity--
diff --git a/code/game/objects/items/weapons/tanks/watertank.dm b/code/game/objects/items/weapons/tanks/watertank.dm
index 468ac6bf3bf..e6e88563d4b 100644
--- a/code/game/objects/items/weapons/tanks/watertank.dm
+++ b/code/game/objects/items/weapons/tanks/watertank.dm
@@ -8,7 +8,7 @@
w_class = 4
slot_flags = SLOT_BACK
slowdown = 1
- action_button_name = "Toggle Mister"
+ actions_types = list(/datum/action/item_action/toggle_mister)
var/obj/item/weapon/noz
var/on = 0
@@ -22,6 +22,10 @@
/obj/item/weapon/watertank/ui_action_click()
toggle_mister()
+/obj/item/weapon/watertank/item_action_slot_check(slot, mob/user)
+ if(slot == slot_back)
+ return 1
+
/obj/item/weapon/watertank/verb/toggle_mister()
set name = "Toggle Mister"
set category = "Object"
@@ -52,6 +56,7 @@
return new /obj/item/weapon/reagent_containers/spray/mister(src)
/obj/item/weapon/watertank/equipped(mob/user, slot)
+ ..()
if(slot != slot_back)
remove_noz()
@@ -75,8 +80,8 @@
..()
/obj/item/weapon/watertank/MouseDrop(obj/over_object)
- if(ishuman(src.loc))
- var/mob/living/carbon/human/H = src.loc
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
switch(over_object.name)
if("r_hand")
if(H.r_hand)
@@ -125,6 +130,7 @@
return
/obj/item/weapon/reagent_containers/spray/mister/dropped(mob/user as mob)
+ ..()
to_chat(user, "The mister snaps back onto the watertank.")
tank.on = 0
loc = tank
@@ -198,6 +204,7 @@
return new /obj/item/weapon/extinguisher/mini/nozzle(src)
/obj/item/weapon/watertank/atmos/dropped(mob/user as mob)
+ ..()
icon_state = "waterbackpackatmos"
if(istype(noz, /obj/item/weapon/extinguisher/mini/nozzle))
var/obj/item/weapon/extinguisher/mini/nozzle/N = noz
@@ -255,6 +262,7 @@
return
/obj/item/weapon/extinguisher/mini/nozzle/dropped(mob/user as mob)
+ ..()
to_chat(user, "The nozzle snaps back onto the tank!")
tank.on = 0
loc = tank
diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm
index 586eaab9672..7ecbef740cd 100644
--- a/code/game/objects/items/weapons/twohanded.dm
+++ b/code/game/objects/items/weapons/twohanded.dm
@@ -90,12 +90,13 @@
return ..()
/obj/item/weapon/twohanded/dropped(mob/user)
+ ..()
//handles unwielding a twohanded weapon when dropped as well as clearing up the offhand
if(user)
var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
if(istype(O))
O.unwield(user)
- return unwield(user)
+ return unwield(user)
/obj/item/weapon/twohanded/update_icon()
return
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index f439f93653c..c6e234158ec 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -655,7 +655,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_l_ear)
var /obj/item/weapon/tank/jetpack/J = new /obj/item/weapon/tank/jetpack/oxygen(M)
M.equip_to_slot_or_del(J, slot_back)
- J.toggle()
+ J.turn_on()
M.equip_to_slot_or_del(new /obj/item/clothing/mask/breath(M), slot_wear_mask)
J.Topic(null, list("stat" = 1))
equip_special_id(M,get_all_accesses(), "Space Explorer", /obj/item/weapon/card/id)
@@ -684,7 +684,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/space/rig/atmos(M), slot_head)
var /obj/item/weapon/tank/jetpack/J = new /obj/item/weapon/tank/jetpack/oxygen(M)
M.equip_to_slot_or_del(J, slot_back)
- J.toggle()
+ J.turn_on()
M.equip_to_slot_or_del(new /obj/item/clothing/mask/breath(M), slot_wear_mask)
equip_special_id(M,get_all_accesses(), "RIG Tester", /obj/item/weapon/card/id)
J.Topic(null, list("stat" = 1))
diff --git a/code/modules/admin/verbs/honksquad.dm b/code/modules/admin/verbs/honksquad.dm
index 53f8fe83583..0833ccdb669 100644
--- a/code/modules/admin/verbs/honksquad.dm
+++ b/code/modules/admin/verbs/honksquad.dm
@@ -59,7 +59,7 @@ var/global/sent_honksquad = 0
new_honksquad.key = pick(commandos)
commandos -= new_honksquad.key
new_honksquad.internal = new_honksquad.s_store
- new_honksquad.internals.icon_state = "internal1"
+ new_honksquad.update_internals_hud_icon(1)
//So they don't forget their code or mission.
new_honksquad.mind.store_memory("Mission: \red [input].")
diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm
index daedb7ae5e0..5506b3b9076 100644
--- a/code/modules/admin/verbs/one_click_antag.dm
+++ b/code/modules/admin/verbs/one_click_antag.dm
@@ -375,7 +375,7 @@ client/proc/one_click_antag()
new_syndicate_commando.key = theghost.key
new_syndicate_commando.internal = new_syndicate_commando.s_store
- new_syndicate_commando.internals.icon_state = "internal1"
+ new_syndicate_commando.update_internals_hud_icon(1)
//So they don't forget their code or mission.
diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm
index f41a900aed7..c44ff5c1af6 100644
--- a/code/modules/admin/verbs/randomverbs.dm
+++ b/code/modules/admin/verbs/randomverbs.dm
@@ -407,7 +407,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if("Death Commando")//Leaves them at late-join spawn.
new_character.equip_death_commando()
new_character.internal = new_character.s_store
- new_character.internals.icon_state = "internal1"
+ new_character.update_internals_hud_icon(1)
else//They may also be a cyborg or AI.
switch(new_character.mind.assigned_role)
if("Cyborg")//More rigging to make em' work and check if they're traitor.
diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm
index 1aeb425b8be..e76545f4748 100644
--- a/code/modules/admin/verbs/striketeam.dm
+++ b/code/modules/admin/verbs/striketeam.dm
@@ -64,7 +64,7 @@ var/global/sent_strike_team = 0
new_commando.key = pick(commandos)
commandos -= new_commando.key
new_commando.internal = new_commando.s_store
- new_commando.internals.icon_state = "internal1"
+ new_commando.update_internals_hud_icon(1)
//So they don't forget their code or mission.
if(nuke_code)
diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm
index 2fdd388d0ca..3669ba2ba13 100644
--- a/code/modules/admin/verbs/striketeam_syndicate.dm
+++ b/code/modules/admin/verbs/striketeam_syndicate.dm
@@ -71,7 +71,7 @@ var/global/sent_syndicate_strike_team = 0
new_syndicate_commando.key = pick(commandos)
commandos -= new_syndicate_commando.key
new_syndicate_commando.internal = new_syndicate_commando.s_store
- new_syndicate_commando.internals.icon_state = "internal1"
+ new_syndicate_commando.update_internals_hud_icon(1)
//So they don't forget their code or mission.
if(nuke_code)
diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm
index 954d19cab18..267d1600523 100644
--- a/code/modules/assembly/proximity.dm
+++ b/code/modules/assembly/proximity.dm
@@ -68,6 +68,7 @@
dropped()
+ ..()
spawn(0)
sense()
return
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index b7eb89bfe60..88555586661 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -289,7 +289,6 @@ BLIND // can't see anything
body_parts_covered = HEAD
slot_flags = SLOT_MASK
var/mask_adjusted = 0
- var/ignore_maskadjust = 1
var/adjusted_flags = null
strip_delay = 40
put_on_delay = 40
@@ -297,60 +296,61 @@ BLIND // can't see anything
//Proc that moves gas/breath masks out of the way
/obj/item/clothing/mask/proc/adjustmask(var/mob/user)
var/mob/living/carbon/human/H = usr //Used to check if the mask is on the head, to check if the hands are full, and to turn off internals if they were on when the mask was pushed out of the way.
- if(!ignore_maskadjust)
- if(user.incapacitated()) //This check allows you to adjust your masks while you're buckled into chairs or beds.
- return
- if(mask_adjusted)
- icon_state = copytext(icon_state, 1, findtext(icon_state, "_up")) /*Trims the '_up' off the end of the icon state, thus reverting to the most recent previous state.
- Had to use this instead of initial() because initial reverted to the wrong state.*/
- gas_transfer_coefficient = initial(gas_transfer_coefficient)
- permeability_coefficient = initial(permeability_coefficient)
- to_chat(user, "You push \the [src] back into place.")
- mask_adjusted = 0
- slot_flags = initial(slot_flags)
- if(flags_inv != initial(flags_inv))
- if(initial(flags_inv) & HIDEFACE) //If the mask is one that hides the face and can be adjusted yet lost that trait when it was adjusted, make it hide the face again.
- flags_inv |= HIDEFACE
- if(flags != initial(flags))
- if(initial(flags) & MASKCOVERSMOUTH) //If the mask covers the mouth when it's down and can be adjusted yet lost that trait when it was adjusted, make it cover the mouth again.
- flags |= MASKCOVERSMOUTH
- if(initial(flags) & AIRTIGHT) //If the mask is airtight and thus, one that you'd be able to run internals from yet can't because it was adjusted, make it airtight again.
- flags |= AIRTIGHT
- if(H.head == src && flags_inv == HIDEFACE) //Means that only things like bandanas and balaclavas will be affected since they obscure the identity of the wearer.
- if(H.l_hand && H.r_hand) //If both hands are occupied, drop the object on the ground.
- user.unEquip(src)
- else //Otherwise, put it in an available hand, the active one preferentially.
- src.loc = user
- H.head = null
- user.put_in_hands(src)
- else
- icon_state += "_up"
- to_chat(user, "You push \the [src] out of the way.")
- gas_transfer_coefficient = null
- permeability_coefficient = null
- mask_adjusted = 1
- if(adjusted_flags)
- slot_flags = adjusted_flags
- if(ishuman(user) && H.internal && user.wear_mask == src && H.internals) /*If the user was wearing the mask providing internals on their face at the time it was adjusted, turn off internals.
- Otherwise, they adjusted it while it was in their hands or some such so we won't be needing to turn off internals.*/
- H.internals.icon_state = "internal0"
- H.internal = null
- if(flags_inv & HIDEFACE) //Means that only things like bandanas and balaclavas will be affected since they obscure the identity of the wearer.
- flags_inv &= ~HIDEFACE /*Done after the above to avoid having to do a check for initial(src.flags_inv == HIDEFACE).
- This reveals the user's face since the bandana will now be going on their head.*/
- if(flags & MASKCOVERSMOUTH) //Mask won't cover the mouth any more since it's been pushed out of the way. Allows for CPRing with adjusted masks.
- flags &= ~MASKCOVERSMOUTH
- if(flags & AIRTIGHT) //If the mask was airtight, it won't be anymore since you just pushed it off your face.
- flags &= ~AIRTIGHT
- if(user.wear_mask == src && initial(flags_inv) == HIDEFACE) //Means that you won't have to take off and put back on simple things like breath masks which, realistically, can just be pulled down off your face.
- if(H.l_hand && H.r_hand) //If both hands are occupied, drop the object on the ground.
- user.unEquip(src)
- else //Otherwise, put it in an available hand, the active one preferentially.
- src.loc = user
- user.wear_mask = null
- user.put_in_hands(src)
- usr.update_inv_wear_mask()
- usr.update_inv_head()
+ if(user.incapacitated()) //This check allows you to adjust your masks while you're buckled into chairs or beds.
+ return
+ if(mask_adjusted)
+ icon_state = initial(icon_state)
+ gas_transfer_coefficient = initial(gas_transfer_coefficient)
+ permeability_coefficient = initial(permeability_coefficient)
+ to_chat(user, "You push \the [src] back into place.")
+ mask_adjusted = 0
+ slot_flags = initial(slot_flags)
+ if(flags_inv != initial(flags_inv))
+ if(initial(flags_inv) & HIDEFACE) //If the mask is one that hides the face and can be adjusted yet lost that trait when it was adjusted, make it hide the face again.
+ flags_inv |= HIDEFACE
+ if(flags != initial(flags))
+ if(initial(flags) & MASKCOVERSMOUTH) //If the mask covers the mouth when it's down and can be adjusted yet lost that trait when it was adjusted, make it cover the mouth again.
+ flags |= MASKCOVERSMOUTH
+ if(initial(flags) & AIRTIGHT) //If the mask is airtight and thus, one that you'd be able to run internals from yet can't because it was adjusted, make it airtight again.
+ flags |= AIRTIGHT
+ if(H.head == src && flags_inv == HIDEFACE) //Means that only things like bandanas and balaclavas will be affected since they obscure the identity of the wearer.
+ if(H.l_hand && H.r_hand) //If both hands are occupied, drop the object on the ground.
+ user.unEquip(src)
+ else //Otherwise, put it in an available hand, the active one preferentially.
+ src.loc = user
+ H.head = null
+ user.put_in_hands(src)
+ else
+ icon_state += "_up"
+ to_chat(user, "You push \the [src] out of the way.")
+ gas_transfer_coefficient = null
+ permeability_coefficient = null
+ mask_adjusted = 1
+ if(adjusted_flags)
+ slot_flags = adjusted_flags
+ if(ishuman(user) && H.internal && user.wear_mask == src) /*If the user was wearing the mask providing internals on their face at the time it was adjusted, turn off internals.
+ Otherwise, they adjusted it while it was in their hands or some such so we won't be needing to turn off internals.*/
+ H.update_internals_hud_icon(0)
+ H.internal = null
+ if(flags_inv & HIDEFACE) //Means that only things like bandanas and balaclavas will be affected since they obscure the identity of the wearer.
+ flags_inv &= ~HIDEFACE /*Done after the above to avoid having to do a check for initial(src.flags_inv == HIDEFACE).
+ This reveals the user's face since the bandana will now be going on their head.*/
+ if(flags & MASKCOVERSMOUTH) //Mask won't cover the mouth any more since it's been pushed out of the way. Allows for CPRing with adjusted masks.
+ flags &= ~MASKCOVERSMOUTH
+ if(flags & AIRTIGHT) //If the mask was airtight, it won't be anymore since you just pushed it off your face.
+ flags &= ~AIRTIGHT
+ if(user.wear_mask == src && initial(flags_inv) == HIDEFACE) //Means that you won't have to take off and put back on simple things like breath masks which, realistically, can just be pulled down off your face.
+ if(H.l_hand && H.r_hand) //If both hands are occupied, drop the object on the ground.
+ user.unEquip(src)
+ else //Otherwise, put it in an available hand, the active one preferentially.
+ src.loc = user
+ user.wear_mask = null
+ user.put_in_hands(src)
+ usr.update_inv_wear_mask()
+ usr.update_inv_head()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
//Shoes
/obj/item/clothing/shoes
@@ -493,6 +493,7 @@ BLIND // can't see anything
to_chat(user, "You attempt to button up the velcro on \the [src], before promptly realising how retarded you are.")
/obj/item/clothing/suit/equipped(var/mob/living/carbon/human/user, var/slot) //Handle tail-hiding on a by-species basis.
+ ..()
if(ishuman(user) && hide_tail_by_species && slot == slot_wear_suit)
if(user.species.name in hide_tail_by_species)
if(!(flags_inv & HIDETAIL)) //Hide the tail if the user's species is in the hide_tail_by_species list and the tail isn't already hidden.
@@ -511,10 +512,11 @@ BLIND // can't see anything
return
adjustsuit(user)
-/obj/item/clothing/suit/ui_action_click() //This is what happens when you click the HUD action button to adjust your suit.
+/obj/item/clothing/suit/ui_action_click(mob/user) //This is what happens when you click the HUD action button to adjust your suit.
if(!ignore_suitadjust)
- adjustsuit(usr)
- else ..() //This is required in order to ensure that the UI buttons for items that have alternate functions tied to UI buttons still work.
+ adjustsuit(user)
+ else
+ ..() //This is required in order to ensure that the UI buttons for items that have alternate functions tied to UI buttons still work.
//Spacesuit
//Note: Everything in modules/clothing/spacesuits should have the entire suit grouped together.
diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm
index 673685c4fc4..ea1d78dad7d 100644
--- a/code/modules/clothing/glasses/glasses.dm
+++ b/code/modules/clothing/glasses/glasses.dm
@@ -101,15 +101,11 @@
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
)
+ actions_types = list(/datum/action/item_action/toggle_research_scanner)
-/obj/item/clothing/glasses/science/equipped(mob/user, slot)
+/obj/item/clothing/glasses/science/item_action_slot_check(slot)
if(slot == slot_glasses)
- user.scanner.Grant(user)
- ..(user, slot)
-
-/obj/item/clothing/glasses/science/dropped(mob/user)
- user.scanner.devices -= 1
- ..(user)
+ return 1
/obj/item/clothing/glasses/science/night
name = "Night Vision Science Goggle"
@@ -242,13 +238,16 @@
/obj/item/clothing/glasses/sunglasses/noir
name = "noir sunglasses"
desc = "Somehow these seem even more out-of-date than normal sunglasses."
- action_button_name = "Noir Mode"
+ actions_types = list(/datum/action/item_action/noir)
var/noir_mode = 0
color_view = MATRIX_GREYSCALE
/obj/item/clothing/glasses/sunglasses/noir/attack_self()
- if(is_equipped())
- toggle_noir()
+ toggle_noir()
+
+/obj/item/clothing/glasses/sunglasses/noir/item_action_slot_check(slot)
+ if(slot == slot_glasses)
+ return 1
/obj/item/clothing/glasses/sunglasses/noir/proc/toggle_noir()
if(!noir_mode)
@@ -277,12 +276,11 @@
name = "agreeable glasses"
desc = "H.C Limited edition."
var/punused = null
- action_button_name = "YEAH!"
+ actions_types = list(/datum/action/item_action/YEEEAAAAAHHHHHHHHHHHHH)
/obj/item/clothing/glasses/sunglasses/yeah/attack_self()
pun()
-
/obj/item/clothing/glasses/sunglasses/yeah/verb/pun()
set category = "Object"
set name = "YEAH!"
@@ -330,7 +328,7 @@
desc = "Protects the eyes from welders, approved by the mad scientist association."
icon_state = "welding-g"
item_state = "welding-g"
- action_button_name = "Flip welding goggles"
+ actions_types = list(/datum/action/item_action/toggle)
flash_protect = 2
tint = 2
species_fit = list("Vox")
@@ -375,7 +373,6 @@
item_state = "rwelding-g"
flash_protect = 2
tint = 0
- action_button_name = "Flip welding goggles"
/obj/item/clothing/glasses/sunglasses/blindfold
name = "blindfold"
diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm
index 8e5d7c08397..269b2dd841e 100644
--- a/code/modules/clothing/glasses/hud.dm
+++ b/code/modules/clothing/glasses/hud.dm
@@ -14,6 +14,7 @@
H.add_hud_to(user)
/obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user)
+ ..()
if(HUDType && istype(user) && user.glasses == src)
var/datum/atom_hud/H = huds[HUDType]
H.remove_hud_from(user)
diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm
index 48e2ccb7f95..5cc5af80abb 100644
--- a/code/modules/clothing/head/hardhat.dm
+++ b/code/modules/clothing/head/hardhat.dm
@@ -9,19 +9,21 @@
item_color = "yellow" //Determines used sprites: hardhat[on]_[color] and hardhat[on]_[color]2 (lying down sprite)
armor = list(melee = 15, bullet = 5, laser = 20, energy = 10, bomb = 20, bio = 10, rad = 20)
flags_inv = 0
- action_button_name = "Toggle Helmet Light"
+ actions_types = list(/datum/action/item_action/toggle_helmet_light)
- attack_self(mob/user)
- if(!isturf(user.loc))
- to_chat(user, "You cannot turn the light on while in this [user.loc]")//To prevent some lighting anomalities.
+/obj/item/clothing/head/hardhat/attack_self(mob/user)
+ on = !on
+ icon_state = "hardhat[on]_[item_color]"
+ item_state = "hardhat[on]_[item_color]"
- return
- on = !on
- icon_state = "hardhat[on]_[item_color]"
- item_state = "hardhat[on]_[item_color]"
+ if(on)
+ set_light(brightness_on)
+ else
+ set_light(0)
- if(on) set_light(brightness_on)
- else set_light(0)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
/obj/item/clothing/head/hardhat/orange
diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm
index 17058cc23b5..b7b0cc71b81 100644
--- a/code/modules/clothing/head/helmet.dm
+++ b/code/modules/clothing/head/helmet.dm
@@ -100,7 +100,7 @@
icon_state = "justice"
toggle_message = "You turn off the lights on"
alt_toggle_message = "You turn on the lights on"
- action_button_name = "Toggle JUSTICE"
+ actions_types = list(/datum/action/item_action/toggle_helmet_light)
can_toggle = 1
toggle_cooldown = 20
active_sound = 'sound/items/WEEOO1.ogg'
diff --git a/code/modules/clothing/head/misc.dm b/code/modules/clothing/head/misc.dm
index 6d300c724bd..f34eb62f340 100644
--- a/code/modules/clothing/head/misc.dm
+++ b/code/modules/clothing/head/misc.dm
@@ -350,7 +350,7 @@
item_state = "griffinhat"
flags = BLOCKHAIR|NODROP
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
- action_button_name = "Caw"
+ actions_types = list(/datum/action/item_action/caw)
/obj/item/clothing/head/griffin/attack_self()
caw()
diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm
index 21c493bf66c..98466f94eeb 100644
--- a/code/modules/clothing/head/misc_special.dm
+++ b/code/modules/clothing/head/misc_special.dm
@@ -22,7 +22,7 @@
tint = 2
armor = list(melee = 10, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
flags_inv = (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
- action_button_name = "flip welding helmet"
+ actions_types = list(/datum/action/item_action/toggle)
species_fit = list("Vox", "Unathi", "Tajaran", "Vulpkanin")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/head.dmi',
@@ -148,7 +148,6 @@
flags = HEADCOVERSEYES | HEADCOVERSMOUTH | BLOCKHAIR
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
- action_button_name = "Toggle Pumpkin Light"
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
brightness_on = 2 //luminosity when on
@@ -160,7 +159,6 @@
item_state = "hardhat0_reindeer"
item_color = "reindeer"
flags_inv = 0
- action_button_name = "Toggle Nose Light"
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
brightness_on = 1 //luminosity when on
diff --git a/code/modules/clothing/masks/boxing.dm b/code/modules/clothing/masks/boxing.dm
index 66e97d714d8..25cdc259f92 100644
--- a/code/modules/clothing/masks/boxing.dm
+++ b/code/modules/clothing/masks/boxing.dm
@@ -6,8 +6,7 @@
flags = BLOCKHAIR
flags_inv = HIDEFACE
w_class = 2
- action_button_name = "Adjust Balaclava"
- ignore_maskadjust = 0
+ actions_types = list(/datum/action/item_action/adjust)
adjusted_flags = SLOT_HEAD
species_fit = list("Vox", "Unathi", "Tajaran", "Vulpkanin")
sprite_sheets = list(
diff --git a/code/modules/clothing/masks/breath.dm b/code/modules/clothing/masks/breath.dm
index 40811397187..5b3ab335cbe 100644
--- a/code/modules/clothing/masks/breath.dm
+++ b/code/modules/clothing/masks/breath.dm
@@ -7,8 +7,7 @@
w_class = 2
gas_transfer_coefficient = 0.10
permeability_coefficient = 0.50
- action_button_name = "Adjust Breath Mask"
- ignore_maskadjust = 0
+ actions_types = list(/datum/action/item_action/adjust)
species_fit = list("Vox", "Vox Armalis", "Unathi", "Tajaran", "Vulpkanin")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/mask.dmi',
@@ -38,5 +37,4 @@
item_state = "voxmask"
permeability_coefficient = 0.01
species_restricted = list("Vox")
- action_button_name = null
- ignore_maskadjust = 1
+ actions_types = list()
diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm
index c1124386acc..a21d78f99e0 100644
--- a/code/modules/clothing/masks/gasmask.dm
+++ b/code/modules/clothing/masks/gasmask.dm
@@ -29,7 +29,7 @@
tint = 2
armor = list(melee = 10, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
origin_tech = "materials=2;engineering=2"
- action_button_name = "Toggle Welding Helmet"
+ actions_types = list(/datum/action/item_action/toggle)
/obj/item/clothing/mask/gas/welding/attack_self()
toggle()
@@ -166,7 +166,7 @@
desc = "Twoooo!"
icon_state = "owl"
flags = MASKCOVERSMOUTH | MASKCOVERSEYES | BLOCK_GAS_SMOKE_EFFECT | AIRTIGHT | NODROP
- action_button_name = "Hoot"
+ actions_types = list(/datum/action/item_action/hoot)
/obj/item/clothing/mask/gas/owl_mask/attack_self()
hoot()
@@ -190,26 +190,24 @@
/obj/item/clothing/mask/gas/sechailer
name = "security gas mask"
desc = "A standard issue Security gas mask with integrated 'Compli-o-nator 3000' device, plays over a dozen pre-recorded compliance phrases designed to get scumbags to stand still whilst you taze them. Do not tamper with the device."
- action_button_name = "HALT!"
icon_state = "sechailer"
var/aggressiveness = 2
var/safety = 1
- ignore_maskadjust = 0
- action_button_name = "HALT!"
+ actions_types = list(/datum/action/item_action/halt, /datum/action/item_action/adjust)
/obj/item/clothing/mask/gas/sechailer/hos
name = "\improper HOS SWAT mask"
desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000. It has a tan stripe."
icon_state = "hosmask"
aggressiveness = 3
- ignore_maskadjust = 1
+ actions_types = list(/datum/action/item_action/halt)
/obj/item/clothing/mask/gas/sechailer/warden
name = "\improper Warden SWAT mask"
desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000. It has a blue stripe."
icon_state = "wardenmask"
aggressiveness = 3
- ignore_maskadjust = 1
+ actions_types = list(/datum/action/item_action/halt)
/obj/item/clothing/mask/gas/sechailer/swat
@@ -217,7 +215,7 @@
desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000."
icon_state = "officermask"
aggressiveness = 3
- ignore_maskadjust = 1
+ actions_types = list(/datum/action/item_action/halt)
/obj/item/clothing/mask/gas/sechailer/blue
name = "\improper blue SWAT mask"
@@ -225,7 +223,7 @@
icon_state = "blue_sechailer"
item_state = "blue_sechailer"
aggressiveness = 3
- ignore_maskadjust = 1
+ actions_types = list(/datum/action/item_action/halt)
/obj/item/clothing/mask/gas/sechailer/cyborg
name = "security hailer"
@@ -233,16 +231,13 @@
icon = 'icons/obj/device.dmi'
icon_state = "taperecorder_idle"
aggressiveness = 1 //Borgs are nicecurity!
- ignore_maskadjust = 1
+ actions_types = list(/datum/action/item_action/halt)
-/obj/item/clothing/mask/gas/sechailer/cyborg/New()
- ..()
- verbs -= /obj/item/clothing/mask/gas/sechailer/verb/adjust
-
-/obj/item/clothing/mask/gas/sechailer/verb/adjust()
- set category = "Object"
- set name = "Adjust Mask"
- adjustmask(usr)
+/obj/item/clothing/mask/gas/sechailer/ui_action_click(mob/user, actiontype)
+ if(actiontype == /datum/action/item_action/halt)
+ halt()
+ else
+ adjustmask(user)
/obj/item/clothing/mask/gas/sechailer/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/screwdriver))
diff --git a/code/modules/clothing/masks/miscellaneous.dm b/code/modules/clothing/masks/miscellaneous.dm
index ca5a267c6a4..184d4c14c40 100644
--- a/code/modules/clothing/masks/miscellaneous.dm
+++ b/code/modules/clothing/masks/miscellaneous.dm
@@ -64,8 +64,7 @@
gas_transfer_coefficient = 0.90
permeability_coefficient = 0.01
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 25, rad = 0)
- action_button_name = "Adjust Sterile Mask"
- ignore_maskadjust = 0
+ actions_types = list(/datum/action/item_action/adjust)
species_fit = list("Vox", "Unathi", "Tajaran", "Vulpkanin")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/mask.dmi',
@@ -209,7 +208,6 @@
flags_inv = HIDEFACE
w_class = 1
slot_flags = SLOT_MASK
- ignore_maskadjust = 0
adjusted_flags = SLOT_HEAD
icon_state = "bandbotany"
species_fit = list("Vox", "Unathi", "Tajaran", "Vulpkanin")
@@ -219,7 +217,7 @@
"Tajaran" = 'icons/mob/species/tajaran/mask.dmi',
"Vulpkanin" = 'icons/mob/species/vulpkanin/mask.dmi'
)
- action_button_name = "Adjust Bandana"
+ actions_types = list(/datum/action/item_action/adjust)
/obj/item/clothing/mask/bandana/attack_self(var/mob/user)
adjustmask(user)
diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm
index 48b9ffa7589..1c9a6260cc3 100644
--- a/code/modules/clothing/shoes/magboots.dm
+++ b/code/modules/clothing/shoes/magboots.dm
@@ -5,18 +5,18 @@
var/magboot_state = "magboots"
var/magpulse = 0
var/slowdown_active = 2
- action_button_name = "Toggle Magboots"
+ actions_types = list(/datum/action/item_action/toggle)
strip_delay = 70
put_on_delay = 70
species_restricted = null
/obj/item/clothing/shoes/magboots/attack_self(mob/user)
- if(src.magpulse)
- src.flags &= ~NOSLIP
- src.slowdown = SHOES_SLOWDOWN
+ if(magpulse)
+ flags &= ~NOSLIP
+ slowdown = SHOES_SLOWDOWN
else
- src.flags |= NOSLIP
- src.slowdown = slowdown_active
+ flags |= NOSLIP
+ slowdown = slowdown_active
magpulse = !magpulse
icon_state = "[magboot_state][magpulse]"
to_chat(user, "You [magpulse ? "enable" : "disable"] the mag-pulse traction system.")
diff --git a/code/modules/clothing/spacesuits/alien.dm b/code/modules/clothing/spacesuits/alien.dm
index e231922de92..f8a18749644 100644
--- a/code/modules/clothing/spacesuits/alien.dm
+++ b/code/modules/clothing/spacesuits/alien.dm
@@ -182,10 +182,8 @@
"Vox Armalis" = 'icons/mob/species/armalis/feet.dmi'
)
- action_button_name = "Toggle the magclaws"
-
/obj/item/clothing/shoes/magboots/vox/attack_self(mob/user)
- if(src.magpulse)
+ if(magpulse)
flags &= ~NOSLIP
magpulse = 0
flags |= NODROP
diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm
index 96ae6519d5d..6348f32aa11 100644
--- a/code/modules/clothing/spacesuits/chronosuit.dm
+++ b/code/modules/clothing/spacesuits/chronosuit.dm
@@ -22,7 +22,7 @@
desc = "An advanced spacesuit equipped with teleportation and anti-compression technology"
icon_state = "chronosuit"
item_state = "chronosuit"
- action_button_name = "Toggle Chronosuit"
+ actions_types = list(/datum/action/item_action/toggle)
armor = list(melee = 60, bullet = 60, laser = 60, energy = 60, bomb = 30, bio = 90, rad = 90)
var/obj/item/clothing/head/helmet/space/chronos/helmet = null
var/obj/effect/chronos_cam/camera = null
diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm
index b5498726203..de2cfc0eda5 100644
--- a/code/modules/clothing/spacesuits/plasmamen.dm
+++ b/code/modules/clothing/spacesuits/plasmamen.dm
@@ -46,13 +46,9 @@
var/base_state = "plasmaman_helmet"
var/brightness_on = 4 //luminosity when on
var/on = 0
- action_button_name = "Toggle Helmet Light"
+ actions_types = list(/datum/action/item_action/toggle_helmet_light)
/obj/item/clothing/head/helmet/space/eva/plasmaman/attack_self(mob/user)
- if(!isturf(user.loc))
- to_chat(user, "You cannot turn the light on while in this [user.loc].")//To prevent some lighting anomalities.
-
- return
toggle_light(user)
/obj/item/clothing/head/helmet/space/eva/plasmaman/proc/toggle_light(mob/user)
@@ -68,6 +64,10 @@
var/mob/living/carbon/human/H = user
H.update_inv_head()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
// ENGINEERING
/obj/item/clothing/suit/space/eva/plasmaman/assistant
name = "plasmaman assistant suit"
diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm
index 415a5dcd12a..355b511c391 100644
--- a/code/modules/clothing/spacesuits/rig.dm
+++ b/code/modules/clothing/spacesuits/rig.dm
@@ -10,7 +10,7 @@
var/brightness_on = 4 //luminosity when on
var/on = 0
item_color = "engineering" //Determines used sprites: rig[on]-[color] and rig[on]-[color]2 (lying down sprite)
- action_button_name = "Toggle Helmet Light"
+ actions_types = list(/datum/action/item_action/toggle_helmet_light)
//Species-specific stuff.
species_restricted = list("exclude","Diona","Wryn")
@@ -31,10 +31,6 @@
)
/obj/item/clothing/head/helmet/space/rig/attack_self(mob/user)
- if(!isturf(user.loc))
- to_chat(user, "You cannot turn the light on while in this [user.loc].")//To prevent some lighting anomalities.
-
- return
toggle_light(user)
/obj/item/clothing/head/helmet/space/rig/proc/toggle_light(mob/user)
@@ -50,6 +46,14 @@
var/mob/living/carbon/human/H = user
H.update_inv_head()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
+/obj/item/clothing/head/helmet/space/rig/item_action_slot_check(slot)
+ if(slot == slot_head)
+ return 1
+
/obj/item/clothing/suit/space/rig
name = "hardsuit"
desc = "A special space suit for environments that might pose hazards beyond just the vacuum of space. Provides more protection than a standard space suit."
@@ -298,17 +302,12 @@
armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50)
on = 1
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | STOPSPRESSUREDMAGE | THICKMATERIAL
- action_button_name = "Toggle Helmet Mode"
+ actions_types = list(/datum/action/item_action/toggle_helmet_mode)
/obj/item/clothing/head/helmet/space/rig/syndi/update_icon()
icon_state = "rig[on]-[item_color]"
/obj/item/clothing/head/helmet/space/rig/syndi/attack_self(mob/user)
- if(!isturf(user.loc))
- to_chat(user, "You cannot toggle your helmet while in this [user.loc].")//To prevent some lighting anomalities.
-
- return
-
on = !on
if(on)
to_chat(user, "You switch your helmet to travel mode. It will allow you to stand in zero pressure environments, at the cost of speed and armor.")
@@ -331,6 +330,10 @@
playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1)
user.update_inv_head()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
/obj/item/clothing/suit/space/rig/syndi
name = "blood-red hardsuit"
desc = "A dual-mode advanced hardsuit designed for work in special operations. It is in travel mode. Property of Gorlex Marauders."
@@ -339,7 +342,7 @@
item_color = "syndi"
w_class = 3
var/on = 1
- action_button_name = "Toggle Hardsuit Mode"
+ actions_types = list(/datum/action/item_action/toggle_hardsuit_mode)
armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50)
allowed = list(/obj/item/weapon/gun,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/melee/energy/sword/saber,/obj/item/weapon/restraints/handcuffs,/obj/item/weapon/tank)
@@ -370,6 +373,10 @@
user.update_inv_wear_suit()
user.update_inv_w_uniform()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
//Elite Syndie suit
/obj/item/clothing/head/helmet/space/rig/syndi/elite
name = "elite syndicate hardsuit helmet"
diff --git a/code/modules/clothing/spacesuits/rig/modules/utility.dm b/code/modules/clothing/spacesuits/rig/modules/utility.dm
index 087b34dd756..46471966aa7 100644
--- a/code/modules/clothing/spacesuits/rig/modules/utility.dm
+++ b/code/modules/clothing/spacesuits/rig/modules/utility.dm
@@ -337,7 +337,7 @@
/obj/item/rig_module/maneuvering_jets/engage()
if(!..())
return 0
- jets.toggle_rockets()
+ jets.toggle_stabilization(usr)
return 1
/obj/item/rig_module/maneuvering_jets/activate()
@@ -354,15 +354,13 @@
suit_overlay = null
holder.update_icon()
- if(!jets.on)
- jets.toggle()
+ jets.turn_on()
return 1
/obj/item/rig_module/maneuvering_jets/deactivate()
if(!..())
return 0
- if(jets.on)
- jets.toggle()
+ jets.turn_off()
return 1
/obj/item/rig_module/maneuvering_jets/New()
diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm
index e2b8e01fd54..6e7acf5c03d 100644
--- a/code/modules/clothing/suits/armor.dm
+++ b/code/modules/clothing/suits/armor.dm
@@ -50,7 +50,8 @@
W.forceMove(src)
attached_badge = W
- action_button_name = "Remove Holobadge"
+ var/datum/action/A = new /datum/action/item_action/remove_badge(src)
+ A.Grant(user)
icon_state = "armorsec"
user.update_inv_wear_suit()
desc = "An armored vest that protects against some damage. This one has [attached_badge] attached to it."
@@ -63,8 +64,10 @@
add_fingerprint(user)
user.put_in_hands(attached_badge)
- action_button_name = null
- action.Remove(user)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Remove(user)
+
icon_state = "armor"
user.update_inv_wear_suit()
desc = "An armored vest that protects against some damage. This one has a clip for a holobadge."
@@ -101,7 +104,7 @@
heat_protection = UPPER_TORSO|LOWER_TORSO|ARMS
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Open/Close Jacket"
+ actions_types = list(/datum/action/item_action/openclose)
adjust_flavour = "unzip"
/obj/item/clothing/suit/armor/hos
@@ -124,7 +127,7 @@
flags_inv = 0
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Open/Close Trenchcoat"
+ actions_types = list(/datum/action/item_action/openclose)
adjust_flavour = "unbutton"
/obj/item/clothing/suit/armor/hos/jensen
@@ -243,7 +246,7 @@
item_state = "reactiveoff"
blood_overlay_type = "armor"
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
- action_button_name = "Toggle Reactive Armor"
+ actions_types = list(/datum/action/item_action/toggle)
unacidable = 1
hit_reaction_chance = 50
diff --git a/code/modules/clothing/suits/hood.dm b/code/modules/clothing/suits/hood.dm
index e6d6c91508f..67ab432b9b4 100644
--- a/code/modules/clothing/suits/hood.dm
+++ b/code/modules/clothing/suits/hood.dm
@@ -1,7 +1,7 @@
//Hoods for winter coats and chaplain hoodie etc
/obj/item/clothing/suit/hooded
- action_button_name = "Adjust hood"
+ actions_types = list(/datum/action/item_action/toggle)
var/obj/item/clothing/head/hood
var/hoodtype = /obj/item/clothing/head/winterhood //so the chaplain hoodie or other hoodies can override this
@@ -22,6 +22,10 @@
/obj/item/clothing/suit/hooded/ui_action_click()
ToggleHood()
+/obj/item/clothing/suit/hooded/item_action_slot_check(slot, mob/user)
+ if(slot == slot_wear_suit)
+ return 1
+
/obj/item/clothing/suit/hooded/equipped(mob/user, slot)
if(slot != slot_wear_suit)
RemoveHood()
@@ -35,6 +39,9 @@
H.unEquip(hood, 1)
H.update_inv_wear_suit()
hood.loc = src
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
/obj/item/clothing/suit/hooded/dropped()
..()
@@ -64,5 +71,8 @@
suit_adjusted = 1
icon_state = "[initial(icon_state)]_hood"
H.update_inv_wear_suit()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
else
RemoveHood()
diff --git a/code/modules/clothing/suits/jobs.dm b/code/modules/clothing/suits/jobs.dm
index b94be6647bb..a8fd6ea4c49 100644
--- a/code/modules/clothing/suits/jobs.dm
+++ b/code/modules/clothing/suits/jobs.dm
@@ -210,7 +210,7 @@
body_parts_covered = UPPER_TORSO|ARMS
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
/obj/item/clothing/suit/storage/lawyer/bluejacket
@@ -222,7 +222,7 @@
body_parts_covered = UPPER_TORSO|ARMS
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
/obj/item/clothing/suit/storage/lawyer/purpjacket
@@ -243,7 +243,7 @@
body_parts_covered = UPPER_TORSO|ARMS
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
species_fit = list("Vox")
sprite_sheets = list(
@@ -258,7 +258,7 @@
blood_overlay_type = "coat"
body_parts_covered = UPPER_TORSO|ARMS
ignore_suitadjust = 0
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
species_fit = list("Vox")
sprite_sheets = list(
@@ -276,7 +276,7 @@
/obj/item/device/healthanalyzer, /obj/item/device/flashlight, /obj/item/device/radio, /obj/item/weapon/tank/emergency_oxygen,/obj/item/device/rad_laser)
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
species_fit = list("Vox")
sprite_sheets = list(
diff --git a/code/modules/clothing/suits/labcoat.dm b/code/modules/clothing/suits/labcoat.dm
index 71bdd524b8f..8097162ba28 100644
--- a/code/modules/clothing/suits/labcoat.dm
+++ b/code/modules/clothing/suits/labcoat.dm
@@ -13,7 +13,7 @@
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/suit.dmi'
)
- action_button_name = "Button/Unbutton Labcoat"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
/obj/item/clothing/suit/storage/labcoat/cmo
diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm
index b44227999cd..8d1fe3bcace 100644
--- a/code/modules/clothing/suits/miscellaneous.dm
+++ b/code/modules/clothing/suits/miscellaneous.dm
@@ -558,7 +558,7 @@
body_parts_covered = UPPER_TORSO|LOWER_TORSO|ARMS
ignore_suitadjust = 0
suit_adjusted = 1
- action_button_name = "Open/Close Jacket"
+ actions_types = list(/datum/action/item_action/openclose)
adjust_flavour = "unzip"
species_fit = list("Vox")
sprite_sheets = list(
@@ -623,7 +623,7 @@
icon_state = "militaryjacket"
item_state = "militaryjacket"
ignore_suitadjust = 1
- action_button_name = null
+ actions_types = list()
adjust_flavour = null
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/toy,/obj/item/weapon/storage/fancy/cigarettes,/obj/item/weapon/lighter,/obj/item/weapon/gun/projectile/automatic/pistol,/obj/item/weapon/gun/projectile/revolver,/obj/item/weapon/gun/projectile/revolver/detective)
@@ -717,7 +717,7 @@
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/toy,/obj/item/weapon/storage/fancy/cigarettes,/obj/item/weapon/lighter)
body_parts_covered = UPPER_TORSO|LOWER_TORSO|ARMS
cold_protection = UPPER_TORSO|LOWER_TORSO|ARMS
- action_button_name = "Zip/Unzip Jacket"
+ actions_types = list(/datum/action/item_action/zipper)
adjust_flavour = "unzip"
species_fit = list("Vox")
sprite_sheets = list(
@@ -746,7 +746,7 @@
desc = "Pompadour not included."
icon_state = "leatherjacket"
ignore_suitadjust = 1
- action_button_name = null
+ actions_types = list()
adjust_flavour = null
/obj/item/clothing/suit/officercoat
@@ -755,7 +755,7 @@
icon_state = "officersuit"
item_state = "officersuit"
ignore_suitadjust = 0
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
species_fit = list("Vox")
sprite_sheets = list(
@@ -768,7 +768,7 @@
icon_state = "soldiersuit"
item_state = "soldiersuit"
ignore_suitadjust = 0
- action_button_name = "Button/Unbutton Jacket"
+ actions_types = list(/datum/action/item_action/button)
adjust_flavour = "unbutton"
species_fit = list("Vox")
sprite_sheets = list(
@@ -783,7 +783,7 @@
body_parts_covered = ARMS
armor = list(melee = 5, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/reagent_containers/spray/pepper,/obj/item/weapon/gun/projectile,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/restraints/handcuffs,/obj/item/device/flashlight/seclite)
- action_button_name = "Toggle Owl Wings"
+ actions_types = list(/datum/action/item_action/toggle_wings)
flags = NODROP
/obj/item/clothing/suit/toggle/owlwings/griffinwings
@@ -823,7 +823,7 @@
desc = "An incredibly advanced and complex suit; it has so many buttons and dials as to be incomprehensible."
icon_state = "bomb"
item_state = "bomb"
- action_button_name = "Toggle Advanced Protective Suit"
+ actions_types = list(/datum/action/item_action/toggle)
gas_transfer_coefficient = 0.01
permeability_coefficient = 0.01
flags = STOPSPRESSUREDMAGE | THICKMATERIAL | NODROP
diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm
index b285624ffe0..e417c899f7f 100644
--- a/code/modules/clothing/under/accessories/accessory.dm
+++ b/code/modules/clothing/under/accessories/accessory.dm
@@ -10,7 +10,6 @@
var/slot = "decor"
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
var/image/inv_overlay = null //overlay used when attached to clothing.
- action_button_custom_type = /datum/action/item_action/accessory
/obj/item/clothing/accessory/New()
..()
@@ -23,6 +22,13 @@
has_suit = S
loc = has_suit
has_suit.overlays += inv_overlay
+ has_suit.actions += actions
+
+ for(var/X in actions)
+ var/datum/action/A = X
+ if(has_suit.is_equipped())
+ var/mob/M = has_suit.loc
+ A.Grant(M)
if(user)
to_chat(user, "You attach [src] to [has_suit].")
@@ -32,6 +38,14 @@
if(!has_suit)
return
has_suit.overlays -= inv_overlay
+ has_suit.actions -= actions
+
+ for(var/X in actions)
+ var/datum/action/A = X
+ if(ismob(has_suit.loc))
+ var/mob/M = has_suit.loc
+ A.Remove(M)
+
has_suit = null
usr.put_in_hands(src)
src.add_fingerprint(user)
diff --git a/code/modules/clothing/under/accessories/holster.dm b/code/modules/clothing/under/accessories/holster.dm
index d792c5df7ac..a30522768ed 100644
--- a/code/modules/clothing/under/accessories/holster.dm
+++ b/code/modules/clothing/under/accessories/holster.dm
@@ -6,7 +6,7 @@
slot = "utility"
var/holster_allow = /obj/item/weapon/gun
var/obj/item/weapon/gun/holstered = null
- action_button_name = "Holster"
+ actions_types = list(/datum/action/item_action/accessory/holster)
w_class = 3 // so it doesn't fit in pockets
//subtypes can override this to specify what can be holstered
diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm
index 1848d8fdfb7..aea6cf139f3 100644
--- a/code/modules/clothing/under/accessories/storage.dm
+++ b/code/modules/clothing/under/accessories/storage.dm
@@ -6,7 +6,7 @@
slot = "utility"
var/slots = 3
var/obj/item/weapon/storage/internal/hold
- action_button_name = "View Storage"
+ actions_types = list(/datum/action/item_action/accessory/storage)
w_class = 3 // so it doesn't fit in pockets
/obj/item/clothing/accessory/storage/New()
diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm
index fd0cd8b68b6..d09e325d9d3 100644
--- a/code/modules/customitems/item_defines.dm
+++ b/code/modules/customitems/item_defines.dm
@@ -322,7 +322,7 @@
icon_state = "kidosvest"
item_state = "kidosvest"
ignore_suitadjust = 1
- action_button_name = null
+ actions_types = list()
adjust_flavour = null
species_fit = null
sprite_sheets = null
@@ -437,7 +437,7 @@
icon_state = "fox_jacket"
item_state = "fox_jacket"
ignore_suitadjust = 1
- action_button_name = null
+ actions_types = list()
adjust_flavour = null
species_fit = null
sprite_sheets = null
@@ -489,7 +489,7 @@
icon_state = "chronx_hood"
item_state = "chronx_hood"
flags = HEADCOVERSEYES | BLOCKHAIR
- action_button_name = "Transform Hood"
+ actions_types = list(/datum/action/item_action/toggle)
var/adjusted = 0
/obj/item/clothing/head/fluff/chronx/ui_action_click()
@@ -519,7 +519,7 @@
icon_state = "chronx_robe"
item_state = "chronx_robe"
flags_size = ONESIZEFITSALL
- action_button_name = "Transform Robes"
+ actions_types = list(/datum/action/item_action/toggle)
adjust_flavour = "untransform"
ignore_suitadjust = 0
diff --git a/code/modules/mob/dead/observer/spells.dm b/code/modules/mob/dead/observer/spells.dm
index 993f2b6e344..39dae4c0746 100644
--- a/code/modules/mob/dead/observer/spells.dm
+++ b/code/modules/mob/dead/observer/spells.dm
@@ -20,6 +20,7 @@ var/global/list/boo_phrases=list(
school = "transmutation"
charge_max = 600
clothes_req = 0
+ stat_allowed = 1
invocation = ""
invocation_type = "none"
range = 1 // Or maybe 3?
diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm
index d558e50a1b4..597b755a620 100644
--- a/code/modules/mob/living/carbon/brain/brain.dm
+++ b/code/modules/mob/living/carbon/brain/brain.dm
@@ -54,8 +54,12 @@
if(in_contents_of(/obj/mecha))
canmove = 1
use_me = 1 //If it can move, let it emote
- else if(istype(loc, /obj/item/device/mmi)) canmove = 1 //mmi won't move anyways so whatever
- else canmove = 0
+ else if(istype(loc, /obj/item/device/mmi))
+ canmove = 1 //mmi won't move anyways so whatever
+ else
+ canmove = 0
+
+ update_action_buttons_icon()
return canmove
/mob/living/carbon/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up.
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 1fea808c660..f30ff8ed0f2 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -644,8 +644,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(do_mob(usr, src, POCKET_STRIP_DELAY))
if(internal)
internal = null
- if(internals)
- internals.icon_state = "internal0"
+ update_internals_hud_icon(0)
else
var/no_mask2
if(!(wear_mask && wear_mask.flags & AIRTIGHT))
@@ -655,8 +654,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
to_chat(usr, "[src] is not wearing a suitable mask or helmet!")
return
internal = ITEM
- if(internals)
- internals.icon_state = "internal1"
+ update_internals_hud_icon(1)
visible_message("[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].", \
"[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].")
@@ -858,7 +856,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
else
clear_alert("handcuffed")
- update_action_buttons() //some of our action buttons might be unusable when we're handcuffed.
+ update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed.
update_inv_handcuffed()
update_hud_handcuffed()
@@ -1031,3 +1029,16 @@ so that different stomachs can handle things in different ways VB*/
var/obj/item/LH = get_inactive_hand()
if(LH)
. |= LH.GetAccess()
+
+/mob/living/carbon/proc/can_breathe_gas()
+ if(!wear_mask)
+ return TRUE
+
+ if(!(wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT) && internal == null)
+ return TRUE
+
+ return FALSE
+
+/mob/living/carbon/proc/update_internals_hud_icon(internal_state = 0)
+ if(hud_used && hud_used.internals)
+ hud_used.internals.icon_state = "internal[internal_state]"
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm
index aa115ad8c4c..cf66c1d2c15 100644
--- a/code/modules/mob/living/carbon/human/human_movement.dm
+++ b/code/modules/mob/living/carbon/human/human_movement.dm
@@ -79,7 +79,7 @@
break
if(thrust)
- if((movement_dir || thrust.stabilization_on) && thrust.allow_thrust(0.01, src))
+ if((movement_dir || thrust.stabilizers) && thrust.allow_thrust(0.01, src))
return 1
return 0
diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm
index f5bdcd1fd62..5e0a4335b83 100644
--- a/code/modules/mob/living/carbon/human/inventory.dm
+++ b/code/modules/mob/living/carbon/human/inventory.dm
@@ -164,9 +164,8 @@
update_fhair()
update_head_accessory()
if(internal)
- if(internals)
- internals.icon_state = "internal0"
internal = null
+ update_internals_hud_icon(0)
sec_hud_set_ID()
update_inv_wear_mask()
else if(I == wear_id)
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index a13f7d31150..4ee83d8eb5f 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -328,7 +328,6 @@
/mob/living/carbon/human/get_breath_from_internal(volume_needed) //making this call the parent would be far too complicated
-
if(internal)
var/null_internals = 0 //internals are invalid, therefore turn them off
var/skip_contents_check = 0 //rigsuit snowflake, oxygen tanks aren't stored inside the mob, so the 'contents.Find' check has to be skipped.
@@ -353,12 +352,10 @@
if(internal) //check for hud updates every time this is called
- if(internals)
- internals.icon_state = "internal1"
+ update_internals_hud_icon(1)
return internal.remove_air_volume(volume_needed) //returns the valid air
else
- if(internals)
- internals.icon_state = "internal0"
+ update_internals_hud_icon(0)
return null
diff --git a/code/modules/mob/living/carbon/human/species/plasmaman.dm b/code/modules/mob/living/carbon/human/species/plasmaman.dm
index 40fcfb738b8..bae949dd9af 100644
--- a/code/modules/mob/living/carbon/human/species/plasmaman.dm
+++ b/code/modules/mob/living/carbon/human/species/plasmaman.dm
@@ -125,8 +125,7 @@
H.equip_or_collect(new/obj/item/weapon/tank/plasma/plasmaman(H), tank_slot) // Bigger plasma tank from Raggy.
to_chat(H, "You are now running on plasma internals from the [H.s_store] in your [tank_slot_name]. You must breathe plasma in order to survive, and are extremely flammable.")
H.internal = H.get_item_by_slot(tank_slot)
- if(H.internals)
- H.internals.icon_state = "internal1"
+ H.update_internals_hud_icon(1)
// Plasmamen are so fucking different that they need their own proc.
/datum/species/plasmaman/handle_breath(var/datum/gas_mixture/breath, var/mob/living/carbon/human/H)
diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm
index aaa0c08bcbc..e187c3d321a 100644
--- a/code/modules/mob/living/carbon/human/species/station.dm
+++ b/code/modules/mob/living/carbon/human/species/station.dm
@@ -364,8 +364,7 @@
H.equip_or_collect(new /obj/item/weapon/tank/emergency_oxygen/vox(H), slot_l_hand)
to_chat(H, "You are now running on nitrogen internals from the [H.l_hand] in your hand. Your species finds oxygen toxic, so you must breathe nitrogen only.")
H.internal = H.l_hand
- if(H.internals)
- H.internals.icon_state = "internal1"
+ H.update_internals_hud_icon(1)
/datum/species/vox/handle_post_spawn(var/mob/living/carbon/human/H)
updatespeciescolor(H)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 671e289ee21..985047a8284 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -181,19 +181,17 @@
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
if(internal)
- if(!contents.Find(internal))
+ if(internal.loc != src)
internal = null
if(!wear_mask || !(wear_mask.flags & AIRTIGHT)) //not wearing mask or non-breath mask
if(!head || !(head.flags & AIRTIGHT)) //not wearing helmet or non-breath helmet
internal = null //turn off internals
if(internal)
- if(internals)
- internals.icon_state = "internal1"
+ update_internals_hud_icon(1)
return internal.remove_air_volume(volume_needed)
else
- if(internals)
- internals.icon_state = "internal0"
+ update_internals_hud_icon(0)
return
@@ -437,12 +435,6 @@
see_invisible = see_override
-/mob/living/carbon/handle_actions()
- ..()
- for(var/obj/item/I in internal_organs)
- give_action_button(I, 1)
-
-
/mob/living/carbon/handle_hud_icons()
return
diff --git a/code/modules/mob/living/carbon/slime/life.dm b/code/modules/mob/living/carbon/slime/life.dm
index d8a89b4d49f..1582ccb2bd8 100644
--- a/code/modules/mob/living/carbon/slime/life.dm
+++ b/code/modules/mob/living/carbon/slime/life.dm
@@ -243,6 +243,7 @@
else if(nutrition >= get_grow_nutrition() && amount_grown < 10)
nutrition -= 20
amount_grown++
+ update_action_buttons_icon()
if(amount_grown >= 10 && !Victim && !Target && !ckey)
if(is_adult)
diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm
index 14585f6ae21..e17d9af6250 100644
--- a/code/modules/mob/living/death.dm
+++ b/code/modules/mob/living/death.dm
@@ -2,4 +2,5 @@
blinded = max(blinded, 1)
clear_fullscreens()
+ update_action_buttons_icon()
..(gibbed)
\ No newline at end of file
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 1bdc8e9eb57..93103fc2cae 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -49,8 +49,6 @@
handle_disabilities() // eye, ear, brain damages
handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc
- handle_actions()
-
update_canmove()
if(client)
@@ -197,7 +195,6 @@
handle_vision()
handle_hud_icons()
- update_action_buttons()
return 1
@@ -247,84 +244,6 @@
/mob/living/proc/handle_hud_icons_health()
return
-/mob/living/proc/handle_actions()
- //Pretty bad, i'd use picked/dropped instead but the parent calls in these are nonexistent
- for(var/datum/action/A in actions)
- if(A.CheckRemoval(src))
- A.Remove(src)
- for(var/obj/item/I in src)
- give_action_button(I, 1)
- return
-
-/mob/living/proc/give_action_button(var/obj/item/I, recursive = 0)
- if(I.action_button_name)
- if(!I.action)
- if(I.action_button_custom_type)
- I.action = new I.action_button_custom_type
- else
- I.action = new /datum/action/item_action
- I.action.name = I.action_button_name
- I.action.target = I
- I.action.Grant(src)
-
- if(recursive)
- for(var/obj/item/T in I)
- give_action_button(T, recursive - 1)
-
-/mob/living/update_action_buttons()
- if(!hud_used) return
- if(!client) return
-
- if(!hud_used.hud_shown)
- return
-
- client.screen -= hud_used.hide_actions_toggle
- for(var/datum/action/A in actions)
- if(A.button)
- client.screen -= A.button
-
- if(hud_used.action_buttons_hidden)
- if(!hud_used.hide_actions_toggle)
- hud_used.hide_actions_toggle = new(hud_used)
- hud_used.hide_actions_toggle.UpdateIcon()
-
- if(!hud_used.hide_actions_toggle.moved)
- hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1)
- //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1)
-
- client.screen += hud_used.hide_actions_toggle
- return
-
- var/button_number = 0
- for(var/datum/action/A in actions)
- button_number++
- if(A.button == null)
- var/obj/screen/movable/action_button/N = new(hud_used)
- N.owner = A
- A.button = N
-
- var/obj/screen/movable/action_button/B = A.button
-
- B.UpdateIcon()
-
- B.name = A.UpdateName()
-
- client.screen += B
-
- if(!B.moved)
- B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
- //hud_used.SetButtonCoords(B,button_number)
-
- if(button_number > 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
-
-
/mob/living/proc/process_nations()
if(client)
var/client/C = client
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 6bd7c162308..0cb7b6c3457 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -49,7 +49,6 @@
var/list/icon/pipes_shown = list()
var/last_played_vent
- var/list/datum/action/actions = list()
var/step_count = 0
var/list/butcher_results = null
diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm
index 90dc2a059ac..c6fc2919a16 100644
--- a/code/modules/mob/living/silicon/robot/life.dm
+++ b/code/modules/mob/living/silicon/robot/life.dm
@@ -234,6 +234,7 @@
else
canmove = 1
update_transform()
+ update_action_buttons_icon()
return canmove
//Robots on fire
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 8a66bc1fb89..b7f3eec50bc 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -88,6 +88,8 @@ var/list/robot_verbs_default = list(
var/obj/item/borg/sight/hud/sec/sechud = null
var/obj/item/borg/sight/hud/med/healthhud = null
+ var/datum/action/item_action/toggle_research_scanner/scanner = null
+
/mob/living/silicon/robot/New(loc,var/syndie = 0,var/unfinished = 0, var/alien = 0)
spark_system = new /datum/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
@@ -144,6 +146,7 @@ var/list/robot_verbs_default = list(
cell_component.installed = 1
diag_hud_set_borgcell()
+ scanner = new(src)
scanner.Grant(src)
/mob/living/silicon/robot/proc/init(var/alien=0)
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 186cafd63b8..0030e893e68 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -627,6 +627,7 @@
else
canmove = 1
update_transform()
+ update_action_buttons_icon()
return canmove
/mob/living/simple_animal/update_transform()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index aa4fafcdd43..f673fa5ab0d 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1052,6 +1052,7 @@ var/list/slot_equipment_priority = list( \
layer = initial(layer)
update_transform()
+ update_action_buttons_icon()
return canmove
/mob/proc/fall(var/forced)
@@ -1367,16 +1368,7 @@ mob/proc/yank_out_object()
/mob/proc/AddSpell(var/obj/effect/proc_holder/spell/spell)
spell_list += spell
- if(!spell.action)
- spell.action = new/datum/action/spell_action
- spell.action.target = spell
- spell.action.name = spell.name
- spell.action.button_icon = spell.action_icon
- spell.action.button_icon_state = spell.action_icon_state
- spell.action.background_icon_state = spell.action_background_icon_state
- if(isliving(src))
- spell.action.Grant(src)
- return
+ spell.action.Grant(src)
//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation)
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index 0786320e9cb..fca9a35212c 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -13,7 +13,6 @@
var/obj/screen/hands = null
var/obj/screen/pullin = null
- var/obj/screen/internals = null
var/obj/screen/i_select = null
var/obj/screen/m_select = null
var/obj/screen/healths = null
@@ -123,7 +122,6 @@
hud_possible = list(SPECIALROLE_HUD)
var/research_scanner = 0 //For research scanner equipped mobs. Enable to show research data when examining.
- var/datum/action/scan_mode/scanner = new
var/list/grabbed_by = list( )
var/list/requests = list( )
@@ -233,4 +231,6 @@
var/datum/vision_override/vision_type = null //Vision override datum.
- var/list/permanent_huds = list()
\ No newline at end of file
+ var/list/permanent_huds = list()
+
+ var/list/actions = list()
\ No newline at end of file
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index 29faec1ac97..5d0e190ee04 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -251,7 +251,9 @@ obj/item/weapon/gun/proc/newshot(params)
I.loc = src
update_icon()
update_gunlight(user)
- verbs += /obj/item/weapon/gun/proc/toggle_gunlight
+ var/datum/action/A = new /datum/action/item_action/toggle_gunlight(src)
+ if(loc == user)
+ A.Grant(user)
if(istype(I, /obj/item/weapon/screwdriver))
if(F && can_flashlight)
@@ -262,7 +264,8 @@ obj/item/weapon/gun/proc/newshot(params)
update_gunlight(user)
S.update_brightness(user)
update_icon()
- verbs -= /obj/item/weapon/gun/proc/toggle_gunlight
+ for(var/datum/action/item_action/toggle_gunlight/TGL in actions)
+ qdel(TGL)
if(unique_rename)
if(istype(I, /obj/item/weapon/pen))
@@ -296,6 +299,10 @@ obj/item/weapon/gun/proc/newshot(params)
else
set_light(0)
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
+
/obj/item/weapon/gun/pickup(mob/user)
..()
if(azoom)
@@ -376,7 +383,7 @@ obj/item/weapon/gun/proc/newshot(params)
/datum/action/toggle_scope_zoom
name = "Toggle Scope"
- check_flags = AB_CHECK_ALIVE|AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING
+ check_flags = AB_CHECK_CONSCIOUS|AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING
button_icon_state = "sniper_zoom"
var/obj/item/weapon/gun/gun = null
diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm
index 757315019ab..d0e7efcd26b 100644
--- a/code/modules/projectiles/guns/projectile/automatic.dm
+++ b/code/modules/projectiles/guns/projectile/automatic.dm
@@ -5,7 +5,7 @@
can_suppress = 1
burst_size = 3
fire_delay = 2
- action_button_name = "Toggle Firemode"
+ actions_types = list(/datum/action/item_action/toggle_firemode)
/obj/item/weapon/gun/projectile/automatic/isHandgun()
return 0
@@ -58,6 +58,9 @@
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
update_icon()
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.UpdateButtonIcon()
/obj/item/weapon/gun/projectile/automatic/can_shoot()
return get_ammo()
@@ -107,7 +110,7 @@
fire_delay = 2
can_suppress = 0
burst_size = 1
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/wt550/update_icon()
..()
@@ -129,7 +132,6 @@
origin_tech = "combat=5;materials=2;syndicate=8"
mag_type = /obj/item/ammo_box/magazine/m556
fire_sound = 'sound/weapons/Gunshot_smg.ogg'
- action_button_name = "Toggle Grenade Launcher"
can_suppress = 0
var/obj/item/weapon/gun/projectile/revolver/grenadelauncher/underbarrel
burst_size = 3
@@ -227,7 +229,7 @@
can_suppress = 0
burst_size = 1
fire_delay = 0
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/shotgun/bulldog/New()
..()
diff --git a/code/modules/projectiles/guns/projectile/launchers.dm b/code/modules/projectiles/guns/projectile/launchers.dm
index 61032f819fd..462341fdc36 100644
--- a/code/modules/projectiles/guns/projectile/launchers.dm
+++ b/code/modules/projectiles/guns/projectile/launchers.dm
@@ -39,7 +39,7 @@
mag_type = /obj/item/ammo_box/magazine/m75
burst_size = 1
fire_delay = 0
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/gyropistol/isHandgun()
return 1
@@ -65,7 +65,7 @@
burst_size = 1
fire_delay = 0
select = 0
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/speargun/update_icon()
return
diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm
index 661a14a44b4..d1d65dcbfc0 100644
--- a/code/modules/projectiles/guns/projectile/pistol.dm
+++ b/code/modules/projectiles/guns/projectile/pistol.dm
@@ -8,7 +8,7 @@
can_suppress = 1
burst_size = 1
fire_delay = 0
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/pistol/isHandgun()
return 1
@@ -64,4 +64,4 @@
can_suppress = 0
burst_size = 3
fire_delay = 2
- action_button_name = "Toggle Firemode"
+ actions_types = list(/datum/action/item_action/toggle_firemode)
diff --git a/code/modules/projectiles/guns/projectile/sniper.dm b/code/modules/projectiles/guns/projectile/sniper.dm
index 1d9949173ad..cf7c2a4bb35 100644
--- a/code/modules/projectiles/guns/projectile/sniper.dm
+++ b/code/modules/projectiles/guns/projectile/sniper.dm
@@ -15,7 +15,7 @@
zoomable = TRUE
zoom_amt = 7 //Long range, enough to see in front of you, but no tiles behind you.
slot_flags = SLOT_BACK
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/sniper_rifle/update_icon()
if(magazine)
diff --git a/code/modules/projectiles/guns/projectile/toy.dm b/code/modules/projectiles/guns/projectile/toy.dm
index c0465a83beb..4efeb570e0f 100644
--- a/code/modules/projectiles/guns/projectile/toy.dm
+++ b/code/modules/projectiles/guns/projectile/toy.dm
@@ -26,7 +26,7 @@
can_suppress = 0
burst_size = 1
fire_delay = 0
- action_button_name = null
+ actions_types = list()
/obj/item/weapon/gun/projectile/automatic/toy/pistol/update_icon()
..()
diff --git a/code/modules/reagents/newchem/drugs.dm b/code/modules/reagents/newchem/drugs.dm
index 37cdef2b103..10fec0f4c99 100644
--- a/code/modules/reagents/newchem/drugs.dm
+++ b/code/modules/reagents/newchem/drugs.dm
@@ -292,11 +292,11 @@
var/turf/T = get_turf(holder.my_atom)
T.visible_message("The solution generates a strong vapor!")
for(var/mob/living/carbon/C in range(T, 1))
- if(!(C.wear_mask && (C.internals != null || C.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)))
+ if(C.can_breathe_gas())
C.emote("gasp")
C.losebreath++
- C.reagents.add_reagent("toxin",10)
- C.reagents.add_reagent("neurotoxin2",20)
+ C.reagents.add_reagent("toxin", 10)
+ C.reagents.add_reagent("neurotoxin2", 20)
/datum/chemical_reaction/saltpetre
name = "saltpetre"
@@ -432,7 +432,7 @@
var/turf/T = get_turf(holder.my_atom)
T.visible_message("The solution generates a strong vapor!")
for(var/mob/living/carbon/C in range(T, 1))
- if(!(C.wear_mask && (C.internals != null || C.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)))
+ if(C.can_breathe_gas())
C.reagents.add_reagent("jenkem", 25)
/datum/reagent/jenkem
diff --git a/code/modules/reagents/newchem/toxins.dm b/code/modules/reagents/newchem/toxins.dm
index 1590ae2b9c2..5d5efc93dff 100644
--- a/code/modules/reagents/newchem/toxins.dm
+++ b/code/modules/reagents/newchem/toxins.dm
@@ -229,8 +229,8 @@
var/turf/T = get_turf(holder.my_atom)
T.visible_message("The solution generates a strong vapor!")
for(var/mob/living/carbon/C in range(T, 1))
- if(!(C.wear_mask && (C.internals != null || C.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)))
- C.reagents.add_reagent("cyanide",7)
+ if(C.can_breathe_gas())
+ C.reagents.add_reagent("cyanide", 7)
/datum/reagent/itching_powder
name = "Itching Powder"
@@ -633,8 +633,8 @@
var/turf/T = get_turf(holder.my_atom)
T.visible_message("The solution generates a strong vapor!")
for(var/mob/living/carbon/C in range(T, 2))
- if(!(C.wear_mask && (C.internals != null || C.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)))
- C.reagents.add_reagent("sarin",4)
+ if(C.can_breathe_gas())
+ C.reagents.add_reagent("sarin", 4)
/datum/reagent/sarin/on_mob_life(mob/living/M)
switch(current_cycle)
diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm
index 96746f780d8..4eb8d06ceb3 100644
--- a/code/modules/research/xenobiology/xenobio_camera.dm
+++ b/code/modules/research/xenobiology/xenobio_camera.dm
@@ -16,11 +16,11 @@
name = "Slime management console"
desc = "A computer used for remotely handling slimes."
networks = list("SS13")
- off_action = new/datum/action/camera_off/xenobio
- var/datum/action/slime_place/slime_place_action = new
- var/datum/action/slime_pick_up/slime_up_action = new
- var/datum/action/feed_slime/feed_slime_action = new
- var/datum/action/monkey_recycle/monkey_recycle_action = new
+ off_action = new /datum/action/innate/camera_off/xenobio
+ var/datum/action/innate/slime_place/slime_place_action = new
+ var/datum/action/innate/slime_pick_up/slime_up_action = new
+ var/datum/action/innate/feed_slime/feed_slime_action = new
+ var/datum/action/innate/monkey_recycle/monkey_recycle_action = new
var/list/stored_slimes = list()
var/max_slimes = 5
@@ -62,7 +62,7 @@
return
return ..()
-/datum/action/camera_off/xenobio/Activate()
+/datum/action/innate/camera_off/xenobio/Activate()
if(!target || !ishuman(target))
return
var/mob/living/carbon/C = target
@@ -88,12 +88,11 @@
src.Remove(C)
-/datum/action/slime_place
+/datum/action/innate/slime_place
name = "Place Slimes"
- action_type = AB_INNATE
button_icon_state = "slime_down"
-/datum/action/slime_place/Activate()
+/datum/action/innate/slime_place/Activate()
if(!target || !ishuman(owner))
return
var/mob/living/carbon/human/C = owner
@@ -106,12 +105,11 @@
S.visible_message("[S] warps in!")
X.stored_slimes -= S
-/datum/action/slime_pick_up
+/datum/action/innate/slime_pick_up
name = "Pick up Slime"
- action_type = AB_INNATE
button_icon_state = "slime_up"
-/datum/action/slime_pick_up/Activate()
+/datum/action/innate/slime_pick_up/Activate()
if(!target || !ishuman(owner))
return
var/mob/living/carbon/human/C = owner
@@ -131,12 +129,11 @@
X.stored_slimes += S
-/datum/action/feed_slime
+/datum/action/innate/feed_slime
name = "Feed Slimes"
- action_type = AB_INNATE
button_icon_state = "monkey_down"
-/datum/action/feed_slime/Activate()
+/datum/action/innate/feed_slime/Activate()
if(!target || !ishuman(owner))
return
var/mob/living/carbon/human/C = owner
@@ -151,12 +148,11 @@
to_chat(owner, "[X] now has [X.monkeys] monkeys left.")
-/datum/action/monkey_recycle
+/datum/action/innate/monkey_recycle
name = "Recycle Monkeys"
- action_type = AB_INNATE
button_icon_state = "monkey_up"
-/datum/action/monkey_recycle/Activate()
+/datum/action/innate/monkey_recycle/Activate()
if(!target || !ishuman(owner))
return
var/mob/living/carbon/human/C = owner
diff --git a/code/modules/surgery/dental_implant.dm b/code/modules/surgery/dental_implant.dm
index 2810617bd12..2595d9bf95d 100644
--- a/code/modules/surgery/dental_implant.dm
+++ b/code/modules/surgery/dental_implant.dm
@@ -47,7 +47,7 @@
name = "Activate Pill"
/datum/action/item_action/hands_free/activate_pill/Trigger()
- if(!Checks())
+ if(!..())
return
to_chat(owner, "You grit your teeth and burst the implanted [target]!")
add_logs(owner, null, "swallowed an implanted pill", target)
diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm
index b753bcf71a5..2fa12d1a0dc 100644
--- a/code/modules/surgery/organs/augments_internal.dm
+++ b/code/modules/surgery/organs/augments_internal.dm
@@ -49,7 +49,7 @@
implant_color = "#DE7E00"
slot = "brain_antidrop"
origin_tech = "materials=5;programming=4;biotech=4"
- organ_action_name = "Toggle Anti-Drop"
+ actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/brain/anti_drop/ui_action_click()
active = !active
@@ -263,7 +263,7 @@
implant_color = "#007ACC"
slot = "shoulders"
origin_tech = "materials=5;biotech=4;powerstorage=4"
- organ_action_name = "Toggle Arm Mod"
+ actions_types = list(/datum/action/item_action/organ_action/toggle)
var/obj/holder//is defined as the retractable item itself. ensure this is defined somewhere!
var/out = 0//determines if the item is in the owner's hand or not
var/overloaded = 0//is set to 1 when owner gets EMPed. if set to 1, implant doesn't work.
@@ -319,7 +319,7 @@
desc = "A variant of the arm cannon implant that fires electrodes and disabler shots. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_tase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4"
- organ_action_name = "Toggle Arm Cannon Taser"
+ actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/tase/New()//when the implant is created...
holder = new /obj/item/weapon/gun/energy/gun/advtaser/mounted(src)//assign a brand new item to it. (in this case, a gun)
@@ -329,7 +329,7 @@
desc = "A variant of the arm cannon implant that fires lethal laser beams. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_lase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4;syndicate=5"//this is kinda nutty and i might lower it
- organ_action_name = "Toggle Arm Cannon Laser"
+ actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/lase/New()
holder = new /obj/item/weapon/gun/energy/laser/mounted(src)
diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm
index 27ab9ea3b99..b7eba792060 100644
--- a/code/modules/surgery/organs/organ_internal.dm
+++ b/code/modules/surgery/organs/organ_internal.dm
@@ -8,9 +8,7 @@
var/zone = "chest"
var/slot
vital = 0
- var/organ_action_name = null
var/non_primary = 0
- action_button_custom_type = /datum/action/item_action/organ_action
/obj/item/organ/internal/New(var/mob/living/carbon/holder)
if(istype(holder))
@@ -41,8 +39,9 @@
parent.internal_organs |= src
//M.internal_organs_by_name[src] |= src(H,1)
loc = null
- if(organ_action_name)
- action_button_name = organ_action_name
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Grant(M)
/obj/item/organ/internal/remove(mob/living/carbon/M, special = 0)
@@ -61,14 +60,18 @@
else
parent.internal_organs -= src
- if(organ_action_name)
- action_button_name = null
+ for(var/X in actions)
+ var/datum/action/A = X
+ A.Remove(M)
/obj/item/organ/internal/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
insert(target)
..()
+/obj/item/organ/internal/item_action_slot_check(slot, mob/user)
+ return
+
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return
@@ -197,7 +200,7 @@
icon_state = "cursedheart-off"
icon_base = "cursedheart"
origin_tech = "biotech=5"
- organ_action_name = "pump your blood"
+ actions_types = list(/datum/action/item_action/organ_action/cursed_heart)
var/last_pump = 0
var/pump_delay = 30 //you can pump 1 second early, for lag, but no more (otherwise you could spam heal)
var/blood_loss = 100 //600 blood is human default, so 5 failures (below 122 blood is where humans die because reasons?)
@@ -235,25 +238,33 @@
if(owner)
to_chat(owner, "Your heart has been replaced with a cursed one, you have to pump this one manually otherwise you'll die!")
+
+/datum/action/item_action/organ_action/cursed_heart
+ name = "pump your blood"
+
//You are now brea- pumping blood manually
-/obj/item/organ/internal/heart/cursed/ui_action_click()
- if(world.time < (last_pump + (pump_delay-10))) //no spam
- to_chat(owner, "Too soon!")
- return
+/datum/action/item_action/organ_action/cursed_heart/Trigger()
+ . = ..()
+ if(. && istype(target,/obj/item/organ/internal/heart/cursed))
+ var/obj/item/organ/internal/heart/cursed/cursed_heart = target
- last_pump = world.time
- playsound(owner, 'sound/effects/singlebeat.ogg', 40, 1)
- to_chat(owner, "Your heart beats.")
+ if(world.time < (cursed_heart.last_pump + (cursed_heart.pump_delay-10))) //no spam
+ to_chat(owner, "Too soon!")
+ return
- var/mob/living/carbon/human/H = owner
- if(istype(H))
- H.vessel.add_reagent("blood", (blood_loss*0.5))//gain half the blood back from a failure
- if(owner.client)
- owner.client.color = ""
+ cursed_heart.last_pump = world.time
+ playsound(owner,'sound/effects/singlebeat.ogg',40,1)
+ to_chat(owner, "Your heart beats.")
- H.adjustBruteLoss(-heal_brute)
- H.adjustFireLoss(-heal_burn)
- H.adjustOxyLoss(-heal_oxy)
+ var/mob/living/carbon/human/H = owner
+ if(istype(H))
+ H.vessel.add_reagent("blood", (cursed_heart.blood_loss*0.5))//gain half the blood back from a failure
+ if(owner.client)
+ owner.client.color = ""
+
+ H.adjustBruteLoss(-cursed_heart.heal_brute)
+ H.adjustFireLoss(-cursed_heart.heal_burn)
+ H.adjustOxyLoss(-cursed_heart.heal_oxy)
/obj/item/organ/internal/lungs
name = "lungs"
diff --git a/icons/mob/actions.dmi b/icons/mob/actions.dmi
index 127b63a154a..3269c8ae7b5 100644
Binary files a/icons/mob/actions.dmi and b/icons/mob/actions.dmi differ
diff --git a/paradise.dme b/paradise.dme
index 843eb393f0a..900a30964da 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -98,7 +98,7 @@
#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\action_button.dm"
#include "code\_onclick\hud\ai.dm"
#include "code\_onclick\hud\alert.dm"
#include "code\_onclick\hud\alien.dm"
@@ -184,6 +184,7 @@
#include "code\controllers\Processes\weather.dm"
#include "code\controllers\ProcessScheduler\core\process.dm"
#include "code\controllers\ProcessScheduler\core\processScheduler.dm"
+#include "code\datums\action.dm"
#include "code\datums\ai_law_sets.dm"
#include "code\datums\ai_laws.dm"
#include "code\datums\beam.dm"