diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm deleted file mode 100644 index 84a49083a9d..00000000000 --- a/code/_onclick/hud/action.dm +++ /dev/null @@ -1,331 +0,0 @@ -#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/obj/item/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/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) - return ..() - -/datum/action/proc/Grant(mob/living/T) - if(owner) - if(owner == T) - return - Remove(owner) - owner = T - T.actions += src - T.update_action_buttons() - -/datum/action/proc/Remove(mob/living/T) - if(button) - if(T.client) - T.client.screen -= button - qdel(button) - button = null - T.actions -= src - T.update_action_buttons() - owner = null - -/datum/action/proc/Trigger() - if(!Checks()) - return 0 - return 1 - -/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) && !(target.action_button_internal)) - return 0 - return 1 - -/datum/action/proc/UpdateName() - return name - -/datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button) - current_button.overlays.Cut() - if(button_icon && button_icon_state) - var/image/img - img = image(button_icon, current_button, button_icon_state) - img.pixel_x = 0 - img.pixel_y = 0 - current_button.overlays += img - -/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 - - owner.ApplyIcon(src) - - 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(location,control,params) - var/list/modifiers = params2list(params) - if(modifiers["shift"]) - moved = 0 - return 1 - usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden - - hidden = usr.hud_used.action_buttons_hidden - if(hidden) - name = "Show Buttons" - else - name = "Hide Buttons" - UpdateIcon() - usr.update_action_buttons() - - -/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(mob/living/user) - if(isalien(user)) - icon_state = "bg_alien" - else - icon_state = "bg_default" - UpdateIcon() - return - -/obj/screen/movable/action_button/hide_toggle/UpdateIcon() - overlays.Cut() - var/image/img = image(icon, src, hidden ? "show" : "hide") - overlays += img - return - - -/obj/screen/movable/action_button/MouseEntered(location,control,params) - openToolTip(usr,src,params,title = name,content = desc) - - -/obj/screen/movable/action_button/MouseExited() - closeToolTip(usr) - - -//This is the proc used to update all the action buttons. Properly defined in /mob/living/ -/mob/proc/update_action_buttons() - return - -#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 - -//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/Trigger() - if(!..()) - return 0 - if(target) - var/obj/item/item = target - item.ui_action_click() - return 1 - -/datum/action/item_action/CheckRemoval(mob/living/user) - return !(target in user) - -/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 = I.layer - I.layer = FLOAT_LAYER //AAAH - current_button.overlays += I - I.layer = old - -/datum/action/item_action/hands_free - check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE - -/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 - check_flags = 0 - background_icon_state = "bg_spell" - -/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/UpdateName() - var/obj/effect/proc_holder/spell/spell = target - 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.mob_spell_list) - -//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 - - -//Action button controlling a mob's research examine ability. -/datum/action/innate/scan_mode - name = "Toggle Research Scanner" - button_icon_state = "scan_mode" - check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_ALIVE - var/devices = 0 //How may enabled scanners the mob has - -/datum/action/innate/scan_mode/Activate() - active = 1 - owner.research_scanner = 1 - owner << "Research analyzer is now active." - -/datum/action/innate/scan_mode/Deactivate() - active = 0 - owner.research_scanner = 0 - owner << "Research analyzer deactivated." - -/datum/action/innate/scan_mode/Grant(mob/living/T) - ..(T) - -/datum/action/innate/scan_mode/CheckRemoval(mob/living/user) - if(devices) - return 0 - return 1 - -/datum/action/innate/scan_mode/Remove(mob/living/T) - owner.research_scanner = 0 - active = 0 - ..(T) \ No newline at end of file diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm new file mode 100644 index 00000000000..e24462f6493 --- /dev/null +++ b/code/_onclick/hud/action_button.dm @@ -0,0 +1,136 @@ + +/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 + return 1 + if(usr.next_move >= world.time) // Is this needed ? + return + linked_action.Trigger() + return 1 + +//Hide/Show Action Buttons ... Button +/obj/screen/movable/action_button/hide_toggle + name = "Hide Buttons" + icon = 'icons/mob/actions.dmi' + icon_state = "bg_default" + var/hidden = 0 + +/obj/screen/movable/action_button/hide_toggle/Click(location,control,params) + var/list/modifiers = params2list(params) + if(modifiers["shift"]) + moved = 0 + return 1 + usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden + + hidden = usr.hud_used.action_buttons_hidden + if(hidden) + name = "Show Buttons" + else + name = "Hide Buttons" + UpdateIcon() + usr.update_action_buttons() + + +/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(mob/living/user) + if(isalien(user)) + icon_state = "bg_alien" + else + icon_state = "bg_default" + UpdateIcon() + return + +/obj/screen/movable/action_button/hide_toggle/proc/UpdateIcon() + overlays.Cut() + var/image/img = image(icon, src, hidden ? "show" : "hide") + overlays += img + return + + +/obj/screen/movable/action_button/MouseEntered(location,control,params) + openToolTip(usr,src,params,title = name,content = desc) + + +/obj/screen/movable/action_button/MouseExited() + closeToolTip(usr) + + + +//used to update the buttons icon. +/mob/proc/update_action_buttons_icon() + return + +/mob/living/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) + return + +/mob/living/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 ca18c3c387e..d794ff09c7c 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -47,6 +47,8 @@ /datum/hud/New(mob/owner) mymob = owner + hide_actions_toggle = new + hide_actions_toggle.InitialiseIcon(mymob) /datum/hud/Destroy() if(mymob.hud_used == src) @@ -135,6 +137,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 @@ -171,7 +175,7 @@ hud_version = display_hud_version persistant_inventory_update() - mymob.update_action_buttons() + mymob.update_action_buttons(1) reorganize_alerts() mymob.reload_fullscreen() 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 9c7eb1513b9..fd3bc349f4c 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -106,54 +106,59 @@ screen_loc = ui_internal /obj/screen/internals/Click() - if(iscarbon(usr)) - var/mob/living/carbon/C = usr - if(!C.incapacitated()) + if(!iscarbon(usr)) + return + var/mob/living/carbon/C = usr + if(C.incapacitated()) + return + + if(C.internal) + C.internal = null + C << "You are no longer running on internals." + icon_state = "internal0" + else + if(!istype(C.wear_mask, /obj/item/clothing/mask)) + C << "You are not wearing an internals mask!" + return 1 + else + var/obj/item/clothing/mask/M = C.wear_mask + if(M.mask_adjusted) // if mask on face but pushed down + M.adjustmask(C) // adjust it back + if( !(M.flags & MASKINTERNALS) ) + C << "You are not wearing an internals mask!" + return + if(istype(C.l_hand, /obj/item/weapon/tank)) + C << "You are now running on internals from the [C.l_hand] on your left hand." + C.internal = C.l_hand + else if(istype(C.r_hand, /obj/item/weapon/tank)) + C << "You are now running on internals from the [C.r_hand] on your right hand." + C.internal = C.r_hand + else if(ishuman(C)) + var/mob/living/carbon/human/H = C + if(istype(H.s_store, /obj/item/weapon/tank)) + H << "You are now running on internals from the [H.s_store] on your [H.wear_suit]." + H.internal = H.s_store + else if(istype(H.belt, /obj/item/weapon/tank)) + H << "You are now running on internals from the [H.belt] on your belt." + H.internal = H.belt + else if(istype(H.l_store, /obj/item/weapon/tank)) + H << "You are now running on internals from the [H.l_store] in your left pocket." + H.internal = H.l_store + else if(istype(H.r_store, /obj/item/weapon/tank)) + H << "You are now running on internals from the [H.r_store] in your right pocket." + H.internal = H.r_store + + //Seperate so CO2 jetpacks are a little less cumbersome. + if(!C.internal && istype(C.back, /obj/item/weapon/tank)) + C << "You are now running on internals from the [C.back] on your back." + C.internal = C.back + if(C.internal) - C.internal = null - C << "You are no longer running on internals." - icon_state = "internal0" + icon_state = "internal1" else - if(!istype(C.wear_mask, /obj/item/clothing/mask)) - C << "You are not wearing an internals mask!" - return 1 - else - var/obj/item/clothing/mask/M = C.wear_mask - if(M.mask_adjusted) // if mask on face but pushed down - M.adjustmask(C) // adjust it back - if( !(M.flags & MASKINTERNALS) ) - C << "You are not wearing an internals mask!" - return - if(istype(C.l_hand, /obj/item/weapon/tank)) - C << "You are now running on internals from the [C.l_hand] on your left hand." - C.internal = C.l_hand - else if(istype(C.r_hand, /obj/item/weapon/tank)) - C << "You are now running on internals from the [C.r_hand] on your right hand." - C.internal = C.r_hand - else if(ishuman(C)) - var/mob/living/carbon/human/H = C - if(istype(H.s_store, /obj/item/weapon/tank)) - H << "You are now running on internals from the [H.s_store] on your [H.wear_suit]." - H.internal = H.s_store - else if(istype(H.belt, /obj/item/weapon/tank)) - H << "You are now running on internals from the [H.belt] on your belt." - H.internal = H.belt - else if(istype(H.l_store, /obj/item/weapon/tank)) - H << "You are now running on internals from the [H.l_store] in your left pocket." - H.internal = H.l_store - else if(istype(H.r_store, /obj/item/weapon/tank)) - H << "You are now running on internals from the [H.r_store] in your right pocket." - H.internal = H.r_store - - //Seperate so CO2 jetpacks are a little less cumbersome. - if(!C.internal && istype(C.back, /obj/item/weapon/tank)) - C << "You are now running on internals from the [C.back] on your back." - C.internal = C.back - - if(C.internal) - icon_state = "internal1" - else - C << "You don't have an oxygen tank!" + C << "You don't have an oxygen tank!" + return + 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..59b1021b579 --- /dev/null +++ b/code/datums/action.dm @@ -0,0 +1,360 @@ +#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/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/button_icon_state = "default" + var/background_icon_state = "bg_default" + var/mob/living/owner + +/datum/action/New(Target) + target = Target + button = new + button.linked_action = src + button.name = name + +/datum/action/Destroy() + if(owner) + Remove(owner) + target = null + qdel(button) + button = null + return ..() + +/datum/action/proc/Grant(mob/living/L) + if(owner) + if(owner == L) + return + Remove(owner) + owner = L + L.actions += src + if(L.client) + L.client.screen += button + L.update_action_buttons() + +/datum/action/proc/Remove(mob/living/L) + if(L.client) + L.client.screen -= button + button.moved = FALSE //so the button appears in its normal position when given to another owner. + L.actions -= src + L.update_action_buttons() + owner = null + +/datum/action/proc/Trigger() + if(!IsAvailable()) + return 0 + return 1 + +/datum/action/proc/Process() + return + +/datum/action/proc/IsAvailable() + 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(button_icon && button_icon_state) + var/image/img + img = image(button_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, src.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 = I.layer + I.layer = FLOAT_LAYER //AAAH + current_button.overlays += I + I.layer = old + +/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_internals_on" + +/datum/action/item_action/toggle_mister + name = "Toggle Mister" + +/datum/action/item_action/activate_injector + name = "Activate Injector" + +/datum/action/item_action/toggle_helmet_light + name = "Toggle Helmet Light" + +/datum/action/item_action/toggle_helmet_flashlight + name = "Toggle Helmet Flashlight" + +/datum/action/item_action/toggle_helmet_mode + name = "Toggle Helmet Mode" + +/datum/action/item_action/toggle + +/datum/action/item_action/toggle/New(Target) + ..() + name = "Toggle [target.name]" + button.name = name + +/datum/action/item_action/halt + name = "HALT!" + +/datum/action/item_action/toggle_voice_box + name = "Toggle Voice Box" + +/datum/action/item_action/change + name = "Change" + +/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_human_head + name = "Toggle Human Head" + +/datum/action/item_action/toggle_helmet + name = "Toggle Helmet" + +/datum/action/item_action/jetpack_mode + name = "Jetpack Mode" + +/datum/action/item_action/hands_free + check_flags = AB_CHECK_CONSCIOUS + +/datum/action/item_action/hands_free/activate + name = "Activate" + + +/datum/action/item_action/hands_free/shift_nerves + name = "Shift Nerves" + + +/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 + 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/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 + + + + +//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(usr) + return spell.can_cast(usr) + else + if(owner) + return spell.can_cast(owner) + return 1 + + +/datum/action/spell_action/alien + +/datum/action/spell_action/alien/IsAvailable() + if(!target) + return 0 + var/obj/effect/proc_holder/alien/ab = target + + if(usr) + return ab.cost_check(ab.check_turf,usr,1) + else + if(owner) + return ab.cost_check(ab.check_turf,owner,1) + return 1 + + + +//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 ab14f6575c9..7fc41c16e58 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1549,34 +1549,20 @@ return 1 -/datum/mind/proc/AddSpell(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/AddSpell(obj/effect/proc_holder/spell/S) + spell_list += S + S.action.Grant(current) + /datum/mind/proc/transfer_actions(mob/living/new_character) if(current && current.actions) for(var/datum/action/A in current.actions) A.Grant(new_character) 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 +/datum/mind/proc/transfer_mindbound_actions(mob/living/new_character) + for(var/X in spell_list) + var/obj/effect/proc_holder/spell/S = X + S.action.Grant(new_character) /mob/proc/sync_mind() mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist) diff --git a/code/game/dna.dm b/code/game/dna.dm index 24b464d41ab..01ff138e1aa 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -174,9 +174,7 @@ /mob/living/carbon/set_species(datum/species/mrace = null, icon_update = 1) if(mrace && has_dna()) - if(dna.species.exotic_blood) - var/datum/reagent/EB = dna.species.exotic_blood - reagents.del_reagent(initial(EB.id)) + dna.species.on_species_loss(src) dna.species = new mrace() /mob/living/carbon/human/set_species(datum/species/mrace, icon_update = 1) diff --git a/code/game/gamemodes/blob/powers.dm b/code/game/gamemodes/blob/powers.dm index ef732b7f93b..62c9c72a3c6 100644 --- a/code/game/gamemodes/blob/powers.dm +++ b/code/game/gamemodes/blob/powers.dm @@ -248,14 +248,6 @@ /datum/action/innate/blob background_icon_state = "bg_alien" -/datum/action/innate/blob/CheckRemoval() - if(ticker.mode.name != "blob" || !ishuman(owner)) - return 1 - var/datum/game_mode/blob/B = ticker.mode - if(!owner.mind || !(owner.mind in B.infected_crew)) - return 1 - return 0 - /datum/action/innate/blob/earlyhelp name = "Blob Help" button_icon_state = "blob" diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 6c0883e0976..1824d7a2280 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -27,6 +27,7 @@ ..() /obj/item/weapon/melee/cultblade/pickup(mob/living/user) + ..() if(!iscultist(user)) user << "\"I wouldn't advise that.\"" user << "An overwhelming sense of nausea overpowers you!" diff --git a/code/game/gamemodes/handofgod/actions.dm b/code/game/gamemodes/handofgod/actions.dm index 76949a66487..762a8b4d683 100644 --- a/code/game/gamemodes/handofgod/actions.dm +++ b/code/game/gamemodes/handofgod/actions.dm @@ -4,7 +4,7 @@ /datum/action/innate/godspeak name = "Godspeak" button_icon_state = "godspeak" - check_flags = AB_CHECK_ALIVE + check_flags = AB_CHECK_CONSCIOUS var/mob/camera/god/god = null /datum/action/innate/godspeak/IsAvailable() @@ -19,3 +19,7 @@ return god << "[owner]: [msg]" owner << "You say: [msg]" + +/datum/action/innate/godspeak/Destroy() + god = null + return ..() \ No newline at end of file diff --git a/code/game/gamemodes/handofgod/god.dm b/code/game/gamemodes/handofgod/god.dm index 771141213f4..55f5a16738f 100644 --- a/code/game/gamemodes/handofgod/god.dm +++ b/code/game/gamemodes/handofgod/god.dm @@ -22,7 +22,7 @@ var/list/conduits = list() var/prophets_sacrificed_in_name = 0 var/image/ghostimage = null //For observer with darkness off visiblity - + var/list/prophet_hats = list() /mob/camera/god/New() ..() @@ -51,6 +51,10 @@ for(var/datum/mind/F in followers) if(F.current) F.current << "Your god is DEAD!" + for(var/X in prophet_hats) + var/obj/item/clothing/head/helmet/plate/crusader/prophet/P = X + if(P.speak2god && P.speak2god.god == src) + qdel(P.speak2god) ghost_darkness_images -= ghostimage updateallghostimages() return ..() diff --git a/code/game/gamemodes/handofgod/items.dm b/code/game/gamemodes/handofgod/items.dm index 71137852025..010afd2c091 100644 --- a/code/game/gamemodes/handofgod/items.dm +++ b/code/game/gamemodes/handofgod/items.dm @@ -147,7 +147,12 @@ else speak2god = new() speak2god.god = G + G.prophet_hats += src +/obj/item/clothing/head/helmet/plate/crusader/prophet/Destroy() + if(speak2god) + qdel(speak2god) + return ..() /obj/item/clothing/head/helmet/plate/crusader/prophet/equipped(mob/user, slot) if(slot == slot_head) diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 74d1cbf3a32..41b35e2f108 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" armor = list(melee = 15, bullet = 15, laser = 15, energy = 15, bomb = 15, bio = 15, rad = 15) - action_button_name = "Activate" - action_button_is_hands_free = 1 + actions_types = list(/datum/action/item_action/hands_free/activate) var/mode = VEST_STEALTH var/stealth_active = 0 var/combat_cooldown = 10 @@ -29,20 +28,20 @@ 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(istype(loc, /mob/living/carbon/human)) + 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 @@ -366,7 +365,7 @@ Congratulations! You are now trained for xenobiology research!"} origin_tech = "materials=6;combat=5;biotech=7" 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/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm index 89329de5e8c..79a6c4491eb 100644 --- a/code/game/gamemodes/miniantags/morph/morph.dm +++ b/code/game/gamemodes/miniantags/morph/morph.dm @@ -170,9 +170,6 @@ return target.attack_animal(src) -/mob/living/simple_animal/hostile/morph/update_action_buttons() //So all eaten objects are not counted every life - return - //Spawn Event /datum/round_event_control/morph diff --git a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm index a0a0a89880f..1fda4627f26 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm @@ -175,7 +175,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/shadowling/shadowling_items.dm b/code/game/gamemodes/shadowling/shadowling_items.dm index 8239ecc7724..0284386cde5 100644 --- a/code/game/gamemodes/shadowling/shadowling_items.dm +++ b/code/game/gamemodes/shadowling/shadowling_items.dm @@ -83,8 +83,7 @@ invis_view = 2 flash_protect = -1 unacidable = 1 - action_button_name = "Shift Nerves" - action_button_is_hands_free = 1 + actions_types = list(/datum/action/item_action/hands_free/shift_nerves) var/max_darkness_view = 8 var/min_darkness_view = 0 flags = ABSTRACT | NODROP diff --git a/code/game/gamemodes/wizard/soulstone.dm b/code/game/gamemodes/wizard/soulstone.dm index bc6e64bdacc..4dcfa1db23e 100644 --- a/code/game/gamemodes/wizard/soulstone.dm +++ b/code/game/gamemodes/wizard/soulstone.dm @@ -14,6 +14,7 @@ usability = 1 /obj/item/device/soulstone/pickup(mob/living/user) + ..() if(!iscultist(user) && !iswizard(user) && !usability) user << "An overwhelming feeling of dread comes over you as you pick up the soulstone. It would be wise to be rid of this quickly." user.Dizzy(120) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index d56706d2e09..40a9a5f4641 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -134,7 +134,7 @@ icon = 'icons/obj/grenade.dmi' icon_state = "flashbang" item_state = "flashbang" - action_button_name = "Toggle Barrier Spread" + actions_types = list(/datum/action/item_action/toggle_barrier_spread) var/mode = SINGLE /obj/item/weapon/grenade/barrier/AltClick(mob/user) @@ -172,8 +172,8 @@ new /obj/structure/barricade/security(target_turf2) qdel(src) -/obj/item/weapon/grenade/barrier/ui_action_click() - toggle_mode(usr) +/obj/item/weapon/grenade/barrier/ui_action_click(mob/user) + toggle_mode(user) #undef SINGLE diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 3aef2883536..3cba2799aef 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1036,9 +1036,12 @@ var/year_integer = text2num(year) // = 2013??? /datum/action/innate/mecha - check_flags = AB_CHECK_RESTRAINED | AB_CHECK_STUNNED | AB_CHECK_ALIVE + check_flags = AB_CHECK_RESTRAINED | AB_CHECK_STUNNED | AB_CHECK_CONSCIOUS var/obj/mecha/chassis +/datum/action/innate/mecha/Destroy() + chassis = null + return ..() /datum/action/innate/mecha/mech_eject name = "Eject From Mech" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index fc24fb14bad..7d9eddc24a4 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -33,11 +33,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s 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_is_hands_free = 0 //If 1, bypass the restrained, lying, and stunned checks action buttons normally test for - var/action_button_internal = 0 //If 1, bypass the inside check action buttons test for - 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(). //Since any item can now be a piece of clothing, this has to be put here so all items share it. var/flags_inv //This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc. @@ -131,10 +128,17 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s /obj/item/device icon = 'icons/obj/device.dmi' +/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/blob_act() @@ -363,12 +367,15 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s return /obj/item/proc/dropped(mob/user) - return + 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) return + // called when this item is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called. /obj/item/proc/on_exit_storage(obj/item/weapon/storage/S) return @@ -387,7 +394,14 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s // 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(mob/user, 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) + +//sometimes we only want to grant the item's action if it's equipped in a specific slot. +obj/item/proc/item_action_slot_check(slot, mob/user) + return 1 //the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't. //If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen. @@ -409,11 +423,11 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s if(usr.get_active_hand() == null) // Let me know if this has any problems -Yota usr.UnarmedAttack(src) -//This proc is executed when someone clicks the on-screen UI button. To make the UI button show, set the 'action_button_name'. +//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/candle.dm b/code/game/objects/items/candle.dm index 0d26ff0d940..dde1c59f567 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -91,12 +91,14 @@ /obj/item/candle/pickup(mob/user) + ..() if(lit) SetLuminosity(0) user.AddLuminosity(CANDLE_LUMINOSITY) /obj/item/candle/dropped(mob/user) + ..() if(lit) user.AddLuminosity(-CANDLE_LUMINOSITY) SetLuminosity(CANDLE_LUMINOSITY) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 3f284a0481a..7a0f85626ef 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -210,11 +210,13 @@ var/global/list/obj/item/device/pda/PDAs = list() * The Actual PDA */ /obj/item/device/pda/pickup(mob/user) + ..() if(fon) SetLuminosity(0) user.AddLuminosity(f_lum) /obj/item/device/pda/dropped(mob/user) + ..() if(fon) user.AddLuminosity(-f_lum) SetLuminosity(f_lum) diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 92dbf4d6d27..3b14c41e5a5 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -19,6 +19,7 @@ saved_appearance = initial(butt.appearance) /obj/item/device/chameleon/dropped() + ..() disrupt() /obj/item/device/chameleon/equipped() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 954bf101e38..94a556d9b2e 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 = "Toggle Light" + actions_types = list(/datum/action/item_action/toggle_light) var/on = 0 var/brightness_on = 4 //luminosity when on @@ -41,6 +41,9 @@ return 0 on = !on update_brightness(user) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() return 1 @@ -84,12 +87,14 @@ /obj/item/device/flashlight/pickup(mob/user) + ..() if(on) user.AddLuminosity(brightness_on) SetLuminosity(0) /obj/item/device/flashlight/dropped(mob/user) + ..() if(on) user.AddLuminosity(-brightness_on) SetLuminosity(brightness_on) @@ -191,7 +196,7 @@ obj/item/device/flashlight/lamp/bananalamp brightness_on = 7 // Pretty bright. icon_state = "flare" item_state = "flare" - action_button_name = null //just pull it manually, neckbeard. + actions_types = list() var/fuel = 0 var/on_damage = 7 var/produce_heat = 1500 diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 7f77a68f41a..43864b56684 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -158,16 +158,20 @@ effective or pretty fucking useless. var/max_charge = 300 var/on = 0 var/old_alpha = 0 - action_button_name = "Toggle Cloaker" + actions_types = list(/datum/action/item_action/toggle) -/obj/item/device/shadowcloak/ui_action_click() - if(usr.get_item_by_slot(slot_belt) == src) +/obj/item/device/shadowcloak/ui_action_click(mob/user) + if(user.get_item_by_slot(slot_belt) == src) if(!on) Activate(usr) else Deactivate() return +/obj/item/device/shadowcloak/item_action_slot_check(slot, mob/user) + if(slot == slot_belt) + return 1 + /obj/item/device/shadowcloak/proc/Activate(mob/living/carbon/human/user) if(!user) return @@ -186,6 +190,7 @@ effective or pretty fucking useless. user = null /obj/item/device/shadowcloak/dropped(mob/user) + ..() if(user && user.get_item_by_slot(slot_belt) != src) Deactivate() diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 0739c9a8b6d..7cd44cecb81 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -235,8 +235,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/ui_action_click() @@ -252,6 +252,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 2695041736a..b325e95844f 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,16 +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 name = "T.E.D. Projection Apparatus" @@ -59,6 +63,7 @@ qdel(src) /obj/item/weapon/gun/energy/chrono_gun/dropped() + ..() qdel(src) /obj/item/weapon/gun/energy/chrono_gun/update_icon() diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index c18f344a717..644bc612139 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -541,6 +541,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM return /obj/item/weapon/lighter/pickup(mob/user) + ..() if(lit) SetLuminosity(0) user.AddLuminosity(1) @@ -548,6 +549,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/weapon/lighter/dropped(mob/user) + ..() if(lit) if(user) user.AddLuminosity(-1) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 99affc6fccf..0152f03c41d 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) var/on = 0 //if the paddles are equipped (1) or on the defib (0) var/safety = 1 //if you can zap people with the defibs on harm mode @@ -70,35 +70,40 @@ update_icon() /obj/item/weapon/defibrillator/ui_action_click() - if(usr.get_item_by_slot(slot_back) == src) - toggle_paddles() - else - usr << "Put the defibrillator on your back first!" - return + toggle_paddles() /obj/item/weapon/defibrillator/attack_hand(mob/user) - if(src.loc == user) - ui_action_click() + if(loc == user) + if(slot_flags == SLOT_BACK) + if(user.get_item_by_slot(slot_back) == src) + ui_action_click() + else + user << "Put the defibrillator on your back first!" + + else if(slot_flags == SLOT_BELT) + if(user.get_item_by_slot(slot_belt) == src) + ui_action_click() + else + user << "Strap the defibrillator's belt on first!" return ..() /obj/item/weapon/defibrillator/MouseDrop(obj/over_object) - if(ishuman(src.loc)) - var/mob/living/carbon/human/H = src.loc + if(ismob(src.loc)) + var/mob/M = src.loc switch(over_object.name) if("r_hand") - if(H.r_hand) + if(M.r_hand) return - if(!H.unEquip(src)) + if(!M.unEquip(src)) return - H.put_in_r_hand(src) + M.put_in_r_hand(src) if("l_hand") - if(H.l_hand) + if(M.l_hand) return - if(!H.unEquip(src)) + if(!M.unEquip(src)) return - H.put_in_l_hand(src) - return + M.put_in_l_hand(src) /obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params) if(W == paddles) @@ -172,16 +177,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) + ..() + if((slot_flags == SLOT_BACK && slot != slot_back) || (slot_flags == SLOT_BELT && slot != slot_belt)) remove_paddles(user) update_icon() +/obj/item/weapon/defibrillator/item_action_slot_check(slot, mob/user) + if(slot == user.getBackSlot()) + 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)) @@ -230,12 +242,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 - usr << "Strap the defibrillator's belt on first!" - return +/obj/item/weapon/defibrillator/compact/item_action_slot_check(slot, mob/user) + if(slot == user.getBeltSlot()) + return 1 /obj/item/weapon/defibrillator/compact/loaded/New() ..() @@ -322,7 +331,7 @@ if(!req_defib) return ..() 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() 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 c8c2c07365b..a19a828d64e 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -2,9 +2,8 @@ name = "implant" icon = 'icons/obj/implants.dmi' icon_state = "generic" //Shows up as the action button icon - action_button_is_hands_free = 1 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 loyalty implants var/implanted = null var/mob/living/imp_in = null @@ -40,12 +39,13 @@ else 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() @@ -59,7 +59,9 @@ src.loc = null 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 +78,7 @@ 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 106615e78e2..43d496081b0 100644 --- a/code/game/objects/items/weapons/implants/implant_freedom.dm +++ b/code/game/objects/items/weapons/implants/implant_freedom.dm @@ -8,14 +8,13 @@ /obj/item/weapon/implant/freedom/activate() - if(uses == 0) - return 0 - if(uses != -1) - uses-- + uses-- 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 e32c94b128f..d23101cdc8f 100644 --- a/code/game/objects/items/weapons/implants/implant_misc.dm +++ b/code/game/objects/items/weapons/implants/implant_misc.dm @@ -33,8 +33,6 @@ return dat /obj/item/weapon/implant/adrenalin/activate() - if(uses < 1) - return 0 uses-- imp_in << "You feel a sudden surge of energy!" imp_in.SetStunned(0) @@ -47,6 +45,8 @@ imp_in.reagents.add_reagent("synaptizine", 10) imp_in.reagents.add_reagent("omnizine", 10) imp_in.reagents.add_reagent("stimulants", 10) + if(!uses) + qdel(src) /obj/item/weapon/implant/emp @@ -57,7 +57,7 @@ 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) \ No newline at end of file diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 4cbd991c98c..770adc191ed 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -220,6 +220,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 cac36746465..48afb1f4bcc 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -374,10 +374,6 @@ handle_item_insertion(W, 0 , user) return 1 - -/obj/item/weapon/storage/dropped(mob/user) - return - /obj/item/weapon/storage/attack_hand(mob/user) playsound(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 9fde058f0e9..02b89d5cd51 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -1,30 +1,3 @@ -/datum/action/item_action/jetpack/cycle - name = "Jetpack Mode" - -/datum/action/item_action/jetpack/cycle/Trigger() - if(!Checks()) - return - - var/obj/item/weapon/tank/jetpack/J = target - J.cycle(owner) - return 1 - -/datum/action/item_action/jetpack/cycle/suit - name = "Internal Jetpack Mode" - -/datum/action/item_action/jetpack/cycle/suit/New() - ..() - check_flags &= ~AB_CHECK_INSIDE // The jetpack is inside the suit. - -/datum/action/item_action/jetpack/cycle/suit/CheckRemoval(mob/living/user) - return !(target.loc in user) // Check that the suit is on the user. - -/datum/action/item_action/jetpack/cycle/suit/IsAvailable() - var/mob/living/carbon/human/H = owner - if(!H.wear_suit) - return - return ..() - /obj/item/weapon/tank/jetpack name = "jetpack (empty)" desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution." @@ -32,15 +5,12 @@ item_state = "jetpack" w_class = 4 distribute_pressure = ONE_ATMOSPHERE * O2STANDARD + actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/jetpack_mode) var/gas_type = "o2" var/on = FALSE var/turbo = FALSE - var/datum/effect_system/trail_follow/ion/ion_trail - var/datum/action/item_action/jetpack/cycle/cycle_action - var/cycle_action_type = /datum/action/item_action/jetpack/cycle - /obj/item/weapon/tank/jetpack/New() ..() air_contents.assert_gas(gas_type) @@ -49,15 +19,12 @@ ion_trail = new ion_trail.set_up(src) - cycle_action = new cycle_action_type(src) +/obj/item/weapon/tank/jetpack/ui_action_click(mob/user, actiontype) + if(actiontype == /datum/action/item_action/jetpack_mode) + cycle(user) + else + toggle_internals(user) -/obj/item/weapon/tank/jetpack/pickup(mob/user) - ..() - cycle_action.Grant(user) - -/obj/item/weapon/tank/jetpack/dropped(mob/user) - ..() - cycle_action.Remove(user) /obj/item/weapon/tank/jetpack/proc/cycle(mob/user) if(user.incapacitated()) @@ -73,6 +40,10 @@ turn_off() turbo = FALSE user << "You turn jetpack off." + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() + /obj/item/weapon/tank/jetpack/proc/turn_on() on = TRUE @@ -143,8 +114,8 @@ desc = "A device that will use your internals tank as a gas source for propulsion." icon_state = "jetpack-void" item_state = "jetpack-void" + actions_types = list(/datum/action/item_action/jetpack_mode) var/obj/item/weapon/tank/internals/tank = null - cycle_action_type = /datum/action/item_action/jetpack/cycle/suit /obj/item/weapon/tank/jetpack/suit/New() ..() diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index 2eb9fbb2904..58b230917d2 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -1,50 +1,50 @@ -/datum/action/item_action/tank/internals - name = "Set Internals" - -/datum/action/item_action/tank/internals/Trigger() - if(!Checks()) - return - - var/mob/living/carbon/human/C = owner - if(!istype(C)) - return - - if(C.internal == target) - C.internal = null - C << "You close \the [target] valve." - C.update_internals_hud_icon(0) - else if(C.wear_mask && (C.wear_mask.flags & MASKINTERNALS)) - C.internal = target - C << "You open \the [target] valve." - C.update_internals_hud_icon(1) - return 1 - -/datum/action/item_action/tank/internals/IsAvailable() - var/mob/living/carbon/C = owner - if(!C.wear_mask || !(C.wear_mask.flags & MASKINTERNALS)) - return - return ..() - /obj/item/weapon/tank name = "tank" icon = 'icons/obj/tank.dmi' flags = CONDUCT slot_flags = SLOT_BACK hitsound = 'sound/weapons/smash.ogg' - pressure_resistance = ONE_ATMOSPHERE * 5 - force = 5 throwforce = 10 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 var/volume = 70 - var/datum/action/item_action/tank/internals/internals_action +/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/human/H = user + if(!istype(H)) + return + + if(H.internal == src) + H << "You close [src] valve." + H.internal = null + H.update_internals_hud_icon(0) + else + if(!H.wear_mask) + H << "You need a mask!" + return + if(H.wear_mask.mask_adjusted) + H.wear_mask.adjustmask(H) + if(!(H.wear_mask.flags & MASKINTERNALS)) + H << "[H.wear_mask] can't use [src]!" + return + + if(H.internal) + H << "You switch your internals to [src]." + else + H << "You open [src] valve." + H.internal = src + H.update_internals_hud_icon(1) + H.update_action_buttons_icon() + /obj/item/weapon/tank/New() ..() @@ -52,8 +52,6 @@ air_contents = new(volume) //liters air_contents.temperature = T20C - internals_action = new(src) - SSobj.processing |= src /obj/item/weapon/tank/Destroy() @@ -63,14 +61,6 @@ SSobj.processing -= src return ..() -/obj/item/weapon/tank/pickup(mob/user) - ..() - internals_action.Grant(user) - -/obj/item/weapon/tank/dropped(mob/user) - ..() - internals_action.Remove(user) - /obj/item/weapon/tank/examine(mob/user) var/obj/icon = src ..() diff --git a/code/game/objects/items/weapons/tanks/watertank.dm b/code/game/objects/items/weapons/tanks/watertank.dm index eea4519a819..fdb0cdf157d 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,10 +22,14 @@ /obj/item/weapon/watertank/ui_action_click() toggle_mister() +/obj/item/weapon/watertank/item_action_slot_check(slot, mob/user) + if(slot == user.getBackSlot()) + return 1 + /obj/item/weapon/watertank/verb/toggle_mister() set name = "Toggle Mister" set category = "Object" - if (usr.get_item_by_slot(usr.getWatertankSlot()) != src) + if (usr.get_item_by_slot(usr.getBackSlot()) != src) usr << "The watertank must be worn properly to use!" return if(usr.incapacitated()) @@ -52,7 +56,8 @@ return new /obj/item/weapon/reagent_containers/spray/mister(src) /obj/item/weapon/watertank/equipped(mob/user, slot) - if (slot != slot_back) + ..() + if(slot != slot_back) remove_noz() /obj/item/weapon/watertank/proc/remove_noz() @@ -75,22 +80,21 @@ ..() /obj/item/weapon/watertank/MouseDrop(obj/over_object) - var/mob/H = src.loc - if(istype(H)) + var/mob/M = src.loc + if(istype(M)) switch(over_object.name) if("r_hand") - if(H.r_hand) + if(M.r_hand) return - if(!H.unEquip(src)) + if(!M.unEquip(src)) return - H.put_in_r_hand(src) + M.put_in_r_hand(src) if("l_hand") - if(H.l_hand) + if(M.l_hand) return - if(!H.unEquip(src)) + if(!M.unEquip(src)) return - H.put_in_l_hand(src) - return + M.put_in_l_hand(src) /obj/item/weapon/watertank/attackby(obj/item/W, mob/user, params) if(W == noz) @@ -98,12 +102,6 @@ return ..() -/mob/proc/getWatertankSlot() - return slot_back - -/mob/living/simple_animal/drone/getWatertankSlot() - return slot_drone_storage - // This mister item is intended as an extension of the watertank and always attached to it. // Therefore, it's designed to be "locked" to the player's hands or extended back onto // the watertank backpack. Allowing it to be placed elsewhere or created without a parent @@ -131,6 +129,7 @@ return /obj/item/weapon/reagent_containers/spray/mister/dropped(mob/user) + ..() user << "The mister snaps back onto the watertank." tank.on = 0 loc = tank @@ -204,6 +203,7 @@ return new /obj/item/weapon/extinguisher/mini/nozzle(src) /obj/item/weapon/watertank/atmos/dropped(mob/user) + ..() icon_state = "waterbackpackatmos" if(istype(noz, /obj/item/weapon/extinguisher/mini/nozzle)) var/obj/item/weapon/extinguisher/mini/nozzle/N = noz @@ -261,6 +261,7 @@ return /obj/item/weapon/extinguisher/mini/nozzle/dropped(mob/user) + ..() user << "The nozzle snaps back onto the tank!" tank.on = 0 loc = tank @@ -340,7 +341,7 @@ w_class = 4 slot_flags = SLOT_BACK slowdown = 1 - action_button_name = "Activate Injector" + actions_types = list(/datum/action/item_action/activate_injector) var/on = 0 volume = 300 @@ -354,6 +355,10 @@ /obj/item/weapon/reagent_containers/chemtank/ui_action_click() toggle_injection() +/obj/item/weapon/reagent_containers/chemtank/item_action_slot_check(slot, mob/user) + if(slot == slot_back) + return 1 + /obj/item/weapon/reagent_containers/chemtank/proc/toggle_injection() var/mob/living/carbon/human/user = usr if(!istype(user)) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index ce535fbd7e6..1e4cc29fb10 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -87,6 +87,7 @@ 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() @@ -393,7 +394,7 @@ attack_verb = list("sawed", "torn", "cut", "chopped", "diced") hitsound = "swing_hit" sharpness = IS_SHARP - action_button_name = "Pull the starting cord" + actions_types = list(/datum/action/item_action/startchainsaw) var/on = 0 /obj/item/weapon/twohanded/required/chainsaw/attack_self(mob/user) @@ -411,6 +412,9 @@ if(src == user.get_active_hand()) //update inhands user.update_inv_l_hand() user.update_inv_r_hand() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() //GREY TIDE diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index 382d28f2af2..ea174df13f2 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -273,6 +273,7 @@ hitsound = "sound/weapons/chainsawhit.ogg" /obj/item/weapon/mounted_chainsaw/dropped() + ..() new /obj/item/weapon/twohanded/required/chainsaw(get_turf(src)) qdel(src) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index ce2f468e0d6..32352855eb2 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -78,6 +78,7 @@ handle_move(get_turf(loc)) /obj/item/device/assembly/prox_sensor/dropped() + ..() if(scanning) spawn(0) sense() diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 625a12c01be..7108940c287 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -62,6 +62,7 @@ SSobj.processing.Remove(src) /obj/item/weapon/twohanded/required/ctf/dropped(mob/user) + ..() reset_cooldown = world.time + 200 //20 seconds SSobj.processing |= src for(var/mob/M in player_list) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 52d11937cb8..9cd995349a6 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -116,7 +116,6 @@ BLIND // can't see anything strip_delay = 40 put_on_delay = 40 var/mask_adjusted = 0 - var/ignore_maskadjust = 1 var/adjusted_flags = null @@ -132,30 +131,32 @@ BLIND // can't see anything //Proc that moves gas/breath masks out of the way, disabling them and allowing pill/food consumption /obj/item/clothing/mask/proc/adjustmask(mob/living/user) - if(!ignore_maskadjust) - if(user.incapacitated()) - return - mask_adjusted = !mask_adjusted - if(!mask_adjusted) - src.icon_state = initial(icon_state) - gas_transfer_coefficient = initial(gas_transfer_coefficient) - permeability_coefficient = initial(permeability_coefficient) - flags |= visor_flags - flags_inv |= visor_flags_inv - flags_cover = initial(flags_cover) - user << "You push \the [src] back into place." - slot_flags = initial(slot_flags) - else - icon_state += "_up" - user << "You push \the [src] out of the way." - gas_transfer_coefficient = null - permeability_coefficient = null - flags &= ~visor_flags - flags_inv &= ~visor_flags_inv - flags_cover &= 0 - if(adjusted_flags) - slot_flags = adjusted_flags - user.wear_mask_update(src, toggle_off = mask_adjusted) + if(user.incapacitated()) + return + mask_adjusted = !mask_adjusted + if(!mask_adjusted) + src.icon_state = initial(icon_state) + gas_transfer_coefficient = initial(gas_transfer_coefficient) + permeability_coefficient = initial(permeability_coefficient) + flags |= visor_flags + flags_inv |= visor_flags_inv + flags_cover = initial(flags_cover) + user << "You push \the [src] back into place." + slot_flags = initial(slot_flags) + else + icon_state += "_up" + user << "You push \the [src] out of the way." + gas_transfer_coefficient = null + permeability_coefficient = null + flags &= ~visor_flags + flags_inv &= ~visor_flags_inv + flags_cover &= 0 + if(adjusted_flags) + slot_flags = adjusted_flags + user.wear_mask_update(src, toggle_off = mask_adjusted) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() @@ -515,6 +516,9 @@ BLIND // can't see anything if(istype(usr, /mob/living/carbon)) var/mob/living/carbon/C = usr C.head_update(src, forced = 1) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/proc/can_use(mob/user) if(user && ismob(user)) diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index ec8c5750012..c5e4954152c 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -4,16 +4,13 @@ name = "Engineering Scanner Goggles" desc = "Goggles used by engineers. The Meson Scanner mode lets you see basic structural and terrain layouts through walls, regardless of lighting condition. The T-ray Scanner mode lets you see underfloor objects such as cables and pipes." icon_state = "trayson-meson" - action_button_name = "Change Scanning Mode" + actions_types = list(/datum/action/item_action/toggle_mode) var/mode = 0 //0 - regular mesons mode 1 - t-ray mode var/invis_objects = list() var/range = 1 -/obj/item/clothing/glasses/meson/engine/attack_self() - ui_action_click() - -/obj/item/clothing/glasses/meson/engine/ui_action_click() +/obj/item/clothing/glasses/meson/engine/attack_self(mob/user) mode = !mode if(mode) @@ -21,7 +18,7 @@ vision_flags = 0 darkness_view = 2 invis_view = SEE_INVISIBLE_LIVING - loc << "You toggle the goggles' scanning mode to \[T-Ray]." + user << "You toggle the goggles' scanning mode to \[T-Ray]." else SSobj.processing.Remove(src) vision_flags = SEE_TURFS @@ -30,11 +27,15 @@ loc << "You toggle the goggles' scanning mode to \[Meson]." invis_update() - if(istype(loc,/mob/living/carbon)) - var/mob/living/carbon/C = loc - C.update_sight() + if(ishuman(user)) + var/mob/living/carbon/human/H = user + if(H.glasses == src) + H.update_sight() update_icon() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/glasses/meson/engine/process() if(!mode) @@ -94,7 +95,6 @@ name = "Optical T-Ray Scanner" desc = "Used by engineering staff to see underfloor objects such as cables and pipes." icon_state = "trayson-tray_off" - action_button_name = "Toggle Scanner Power" mode = 1 var/on = 0 @@ -115,18 +115,21 @@ if(user.glasses == src) user.update_inv_glasses() -/obj/item/clothing/glasses/meson/engine/tray/ui_action_click() +/obj/item/clothing/glasses/meson/engine/tray/attack_self(mob/user) on = !on if(on) SSobj.processing |= src - loc << "You turn the goggles on." + user << "You turn the goggles on." else SSobj.processing.Remove(src) - loc << "You turn the goggles off." + user << "You turn the goggles off." invis_update() update_icon() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/glasses/meson/engine/tray/t_ray_on() return on && ..() \ No newline at end of file diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 31f9e2aefae..df0f18f5405 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -50,16 +50,11 @@ item_state = "glasses" origin_tech = "magnets=2;engineering=2" scan_reagents = 1 //You can see reagents while wearing science goggles + 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.devices += 1 - user.scanner.Grant(user) - ..(user, slot) - -/obj/item/clothing/glasses/science/dropped(mob/user) - user.scanner.devices = max(0, user.scanner.devices - 1) - ..() + return 1 /obj/item/clothing/glasses/night name = "Night Vision Goggles" @@ -170,7 +165,7 @@ desc = "Protects the eyes from welders; approved by the mad scientist association." icon_state = "welding-g" item_state = "welding-g" - action_button_name = "Toggle Welding Goggles" + actions_types = list(/datum/action/item_action/toggle) materials = list(MAT_METAL = 250) flash_protect = 2 tint = 2 diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 133e55cc1f0..7ab535c4d9d 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -11,6 +11,7 @@ H.add_hud_to(user) /obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user) + ..() if(hud_type && istype(user) && user.glasses == src) var/datum/atom_hud/H = huds[hud_type] H.remove_hud_from(user) @@ -113,7 +114,7 @@ /obj/item/clothing/glasses/hud/toggle name = "Toggle Hud" desc = "A hud with multiple functions." - action_button_name = "Switch HUD" + actions_types = list(/datum/action/item_action/switch_hud) /obj/item/clothing/glasses/hud/toggle/attack_self(mob/user) if(!ishuman(user)) diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index 43349c6a541..1c0e4b04794 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -8,7 +8,7 @@ item_color = "yellow" //Determines used sprites: hardhat[on]_[item_color] and hardhat[on]_[item_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) burn_state = FIRE_PROOF /obj/item/clothing/head/hardhat/attack_self(mob/user) @@ -24,13 +24,18 @@ turn_on(user) else turn_off(user) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/head/hardhat/pickup(mob/user) + ..() if(on) user.AddLuminosity(brightness_on) SetLuminosity(0) /obj/item/clothing/head/hardhat/dropped(mob/user) + ..() if(on) user.AddLuminosity(-brightness_on) SetLuminosity(brightness_on) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 1bf81645127..543f765addb 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -43,7 +43,7 @@ armor = list(melee = 41, bullet = 15, laser = 5,energy = 5, bomb = 5, bio = 2, rad = 0) flags_inv = HIDEMASK|HIDEEARS|HIDEFACE strip_delay = 80 - action_button_name = "Toggle Helmet Visor" + actions_types = list(/datum/action/item_action/toggle) visor_flags_inv = HIDEMASK|HIDEFACE toggle_cooldown = 0 flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH @@ -75,7 +75,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 Lights" + actions_types = list(/datum/action/item_action/toggle_helmet_light) can_toggle = 1 toggle_cooldown = 20 active_sound = 'sound/items/WEEOO1.ogg' @@ -86,7 +86,6 @@ icon_state = "justice2" toggle_message = "You turn off the light on" alt_toggle_message = "You turn on the light on" - action_button_name = "Toggle Alarm Lights" /obj/item/clothing/head/helmet/swat name = "\improper SWAT helmet" @@ -210,28 +209,33 @@ return -/obj/item/clothing/head/helmet/ui_action_click() - toggle_helmlight() - ..() +/obj/item/clothing/head/helmet/ui_action_click(mob/user, actiontype) + if(actiontype == /datum/action/item_action/toggle_helmet_flashlight) + toggle_helmlight() + else + ..() -/obj/item/clothing/head/helmet/attackby(obj/item/A, mob/user, params) - if(istype(A, /obj/item/device/flashlight/seclite)) - var/obj/item/device/flashlight/seclite/S = A +/obj/item/clothing/head/helmet/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/device/flashlight/seclite)) + var/obj/item/device/flashlight/seclite/S = I if(can_flashlight) if(!F) - if(!user.unEquip(A)) + if(!user.unEquip(S)) return user << "You click [S] into place on [src]." if(S.on) SetLuminosity(0) F = S - A.loc = src + S.loc = src update_icon() update_helmlight(user) verbs += /obj/item/clothing/head/helmet/proc/toggle_helmlight + var/datum/action/A = new /datum/action/item_action/toggle_helmet_flashlight(src) + if(loc == user) + A.Grant(user) return - if(istype(A, /obj/item/weapon/screwdriver)) + if(istype(I, /obj/item/weapon/screwdriver)) if(F) for(var/obj/item/device/flashlight/seclite/S in src) user << "You unscrew the seclite from [src]." @@ -242,10 +246,11 @@ update_icon() usr.update_inv_head() verbs -= /obj/item/clothing/head/helmet/proc/toggle_helmlight + for(var/datum/action/item_action/toggle_helmet_flashlight/THL in actions) + qdel(THL) return ..() - return /obj/item/clothing/head/helmet/proc/toggle_helmlight() set name = "Toggle Helmetlight" @@ -269,7 +274,6 @@ /obj/item/clothing/head/helmet/proc/update_helmlight(mob/user = null) if(F) - action_button_name = "Toggle Helmetlight" if(F.on) if(loc == user) user.AddLuminosity(F.brightness_on) @@ -281,15 +285,18 @@ else if(isturf(loc)) SetLuminosity(0) update_icon() + else - action_button_name = null if(loc == user) user.AddLuminosity(-5) else if(isturf(loc)) SetLuminosity(0) - return + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/head/helmet/pickup(mob/user) + ..() if(F) if(F.on) user.AddLuminosity(F.brightness_on) @@ -297,6 +304,7 @@ /obj/item/clothing/head/helmet/dropped(mob/user) + ..() if(F) if(F.on) user.AddLuminosity(-F.brightness_on) diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 91265c6cd01..9b660fb015c 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -23,7 +23,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 = "Toggle Welding Helmet" + actions_types = list(/datum/action/item_action/toggle) visor_flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE burn_state = FIRE_PROOF @@ -49,7 +49,6 @@ item_state = "hardhat0_cakehat" item_color = "cakehat" flags_inv = HIDEEARS|HIDEHAIR - action_button_name = "Toggle Candle" armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) brightness_on = 2 //luminosity when on flags_cover = HEADCOVERSEYES @@ -116,7 +115,6 @@ item_state = "hardhat0_pumpkin" item_color = "pumpkin" flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR - 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 flags_cover = HEADCOVERSEYES @@ -147,6 +145,5 @@ 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 8b537b722f6..2c9fa24c27f 100644 --- a/code/modules/clothing/masks/boxing.dm +++ b/code/modules/clothing/masks/boxing.dm @@ -6,8 +6,7 @@ flags_inv = HIDEFACE|HIDEHAIR|HIDEFACIALHAIR visor_flags_inv = HIDEFACE|HIDEFACIALHAIR w_class = 2 - action_button_name = "Adjust Balaclava" - ignore_maskadjust = 0 + actions_types = list(/datum/action/item_action/adjust) /obj/item/clothing/mask/balaclava/attack_self(mob/user) adjustmask(user) diff --git a/code/modules/clothing/masks/breath.dm b/code/modules/clothing/masks/breath.dm index ef684dac5f7..2ac22361d26 100644 --- a/code/modules/clothing/masks/breath.dm +++ b/code/modules/clothing/masks/breath.dm @@ -9,8 +9,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) flags_cover = MASKCOVERSMOUTH burn_state = FIRE_PROOF diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index 6055104b49f..99eb30afe61 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -22,7 +22,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 Mask" + actions_types = list(/datum/action/item_action/toggle) flags_inv = HIDEEARS|HIDEEYES|HIDEFACE flags_cover = MASKCOVERSEYES visor_flags_inv = HIDEEYES @@ -60,7 +60,7 @@ var/voice = "Unknown" var/vchange = 0//This didn't do anything before. It now checks if the mask has special functions/N origin_tech = "syndicate=4" - action_button_name = "Toggle mask" + actions_types = list(/datum/action/item_action/toggle) /obj/item/clothing/mask/gas/voice/attack_self(mob/user) vchange = !vchange @@ -109,14 +109,11 @@ item_state = "mime" flags_cover = MASKCOVERSEYES burn_state = FLAMMABLE - action_button_name = "Adjust Mask" + actions_types = list(/datum/action/item_action/adjust) -/obj/item/clothing/mask/gas/mime/ui_action_click() +/obj/item/clothing/mask/gas/mime/attack_self(mob/user) cycle_mask(usr) -/obj/item/clothing/mask/gas/mime/AltClick(mob/user) - cycle_mask(user) - /obj/item/clothing/mask/gas/mime/proc/cycle_mask(mob/user) switch(icon_state) if("mime") diff --git a/code/modules/clothing/masks/hailer.dm b/code/modules/clothing/masks/hailer.dm index d35e67bde87..040ef0bab42 100644 --- a/code/modules/clothing/masks/hailer.dm +++ b/code/modules/clothing/masks/hailer.dm @@ -4,9 +4,8 @@ /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!" + actions_types = list(/datum/action/item_action/halt, /datum/action/item_action/adjust) icon_state = "sechailer" - ignore_maskadjust = 0 flags = BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS flags_inv = HIDEFACIALHAIR|HIDEFACE w_class = 2 @@ -21,10 +20,9 @@ /obj/item/clothing/mask/gas/sechailer/swat name = "\improper SWAT mask" desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000." - action_button_name = "HALT!" + actions_types = list(/datum/action/item_action/halt) icon_state = "swat" aggressiveness = 3 - ignore_maskadjust = 1 flags_inv = HIDEFACIALHAIR|HIDEFACE|HIDEEYES|HIDEEARS visor_flags_inv = 0 @@ -34,11 +32,7 @@ icon = 'icons/obj/device.dmi' icon_state = "taperecorder_idle" aggressiveness = 1 //Borgs are nicecurity! - ignore_maskadjust = 1 - -/obj/item/clothing/mask/gas/sechailer/cyborg/New() - ..() - verbs -= /obj/item/clothing/mask/gas/sechailer/verb/adjust + actions_types = list(/datum/action/item_action/halt) /obj/item/clothing/mask/gas/sechailer/attackby(obj/item/weapon/W, mob/user, params) if(istype(W, /obj/item/weapon/screwdriver)) @@ -61,10 +55,11 @@ else ..() -/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/attack_self() halt() diff --git a/code/modules/clothing/masks/miscellaneous.dm b/code/modules/clothing/masks/miscellaneous.dm index 1a6a0f006ea..669c5467606 100644 --- a/code/modules/clothing/masks/miscellaneous.dm +++ b/code/modules/clothing/masks/miscellaneous.dm @@ -28,8 +28,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) /obj/item/clothing/mask/surgical/attack_self(mob/user) adjustmask(user) @@ -47,7 +46,7 @@ item_state = "pig" flags_inv = HIDEFACE|HIDEHAIR|HIDEFACIALHAIR w_class = 2 - action_button_name = "Toggle Voice Box" + actions_types = list(/datum/action/item_action/toggle_voice_box) var/voicechange = 0 /obj/item/clothing/mask/pig/attack_self(mob/user) @@ -110,7 +109,6 @@ flags_inv = HIDEFACE|HIDEFACIALHAIR visor_flags_inv = HIDEFACE|HIDEFACIALHAIR slot_flags = SLOT_MASK - ignore_maskadjust = 0 adjusted_flags = SLOT_HEAD icon_state = "bandbotany" diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index a51af2db1b4..0f7accc2e5d 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -6,7 +6,7 @@ icon_state = "clown_prototype_off" var/on = 0 var/datum/material_container/bananium - action_button_name = "Toggle Shoes" + actions_types = list(/datum/action/item_action/toggle) /obj/item/clothing/shoes/clown_shoes/banana_shoes/New() ..() @@ -58,13 +58,13 @@ var/ban_amt = bananium.amount(MAT_BANANIUM) user << "The shoes are [on ? "enabled" : "disabled"]. There is [ban_amt ? ban_amt : "no"] bananium left." -/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click() +/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click(mob/user) if(bananium.amount(MAT_BANANIUM)) on = !on update_icon() - loc << "You [on ? "activate" : "deactivate"] the prototype shoes." + user << "You [on ? "activate" : "deactivate"] the prototype shoes." else - loc << "You need bananium to turn the prototype shoes on!" + user << "You need bananium to turn the prototype shoes on!" /obj/item/clothing/shoes/clown_shoes/banana_shoes/update_icon() if(on) @@ -72,3 +72,6 @@ else icon_state = "clown_prototype_off" usr.update_inv_shoes() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index ed673d40c50..bc4c31f0aa3 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -5,7 +5,7 @@ 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 burn_state = FIRE_PROOF diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index 2e95c4c9f0a..de2d07a8e87 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/list/chronosafe_items = list(/obj/item/weapon/chrono_eraser, /obj/item/weapon/gun/energy/chrono_gun) var/hands_nodrop_states @@ -93,8 +93,7 @@ if(camera) camera.remove_target_ui() camera.loc = user - if(teleport_now.button) - teleport_now.button.UpdateIcon() + teleport_now.UpdateButtonIcon() /obj/item/clothing/suit/space/chronos/proc/chronowalk(atom/location) var/mob/living/carbon/human/user = src.loc @@ -108,8 +107,7 @@ if(camera) camera.remove_target_ui() - if(teleport_now.button) - teleport_now.button.UpdateIcon() + teleport_now.UpdateButtonIcon() var/list/nonsafe_slots = list(slot_belt, slot_back, slot_l_hand, slot_r_hand) for(var/slot in nonsafe_slots) @@ -331,16 +329,13 @@ /datum/action/innate/chrono_teleport name = "Teleport Now" button_icon_state = "chrono_phase" - check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE + check_flags = AB_CHECK_CONSCIOUS //|AB_CHECK_INSIDE var/obj/item/clothing/suit/space/chronos/chronosuit = null /datum/action/innate/chrono_teleport/IsAvailable() - return (!CheckRemoval(owner) && !chronosuit.teleporting) + return (chronosuit && chronosuit.activated && chronosuit.camera && !chronosuit.teleporting) /datum/action/innate/chrono_teleport/Activate() if(IsAvailable()) if(chronosuit.camera) chronosuit.chronowalk(chronosuit.camera) - -/datum/action/innate/chrono_teleport/CheckRemoval() - return (..() && !(chronosuit && chronosuit.activated && chronosuit.camera)) \ No newline at end of file diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 4c410c014c2..8117736920a 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -10,7 +10,7 @@ var/on = 0 var/obj/item/clothing/suit/space/hardsuit/suit item_color = "engineering" //Determines used sprites: hardsuit[on]-[color] and hardsuit[on]-[color]2 (lying down sprite) - action_button_name = "Toggle Helmet Light" + actions_types = list(/datum/action/item_action/toggle_helmet_light) /obj/item/clothing/head/helmet/space/hardsuit/attack_self(mob/user) @@ -25,21 +25,31 @@ user.AddLuminosity(brightness_on) else user.AddLuminosity(-brightness_on) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/head/helmet/space/hardsuit/pickup(mob/user) + ..() if(on) user.AddLuminosity(brightness_on) SetLuminosity(0) /obj/item/clothing/head/helmet/space/hardsuit/dropped(mob/user) + ..() if(on) user.AddLuminosity(-brightness_on) SetLuminosity(brightness_on) if(suit) suit.RemoveHelmet() +/obj/item/clothing/head/helmet/space/hardsuit/item_action_slot_check(slot) + if(slot == slot_head) + return 1 + /obj/item/clothing/head/helmet/space/hardsuit/equipped(mob/user, slot) + ..() if(slot != slot_head) if(suit) suit.RemoveHelmet() @@ -69,19 +79,28 @@ allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/internals,/obj/item/device/t_scanner, /obj/item/weapon/rcd, /obj/item/weapon/pipe_dispenser) siemens_coefficient = 0 var/obj/item/clothing/head/helmet/space/hardsuit/helmet - action_button_name = "Toggle Helmet" + actions_types = list(/datum/action/item_action/toggle_helmet) var/helmettype = /obj/item/clothing/head/helmet/space/hardsuit var/obj/item/weapon/tank/jetpack/suit/jetpack = null /obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot) ..() - if(slot == slot_wear_suit && jetpack) - jetpack.cycle_action.Grant(user) + if(jetpack) + if(slot == slot_wear_suit) + for(var/X in jetpack.actions) + var/datum/action/A = X + A.Grant(user) /obj/item/clothing/suit/space/hardsuit/dropped(mob/user) ..() if(jetpack) - jetpack.cycle_action.Remove(user) + for(var/X in jetpack.actions) + var/datum/action/A = X + A.Remove(user) + +/obj/item/clothing/suit/space/hardsuit/item_action_slot_check(slot) + if(slot == slot_wear_suit) //we only give the mob the ability to toggle the helmet if he's wearing the hardsuit. + return 1 //Engineering /obj/item/clothing/head/helmet/space/hardsuit/engine @@ -184,7 +203,7 @@ armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50) on = 1 var/obj/item/clothing/suit/space/hardsuit/syndi/linkedsuit = null - action_button_name = "Toggle Helmet Mode" + actions_types = list(/datum/action/item_action/toggle_helmet_mode) visor_flags_inv = HIDEMASK|HIDEEYES|HIDEFACE|HIDEFACIALHAIR visor_flags = STOPSPRESSUREDMAGE @@ -226,6 +245,9 @@ if(istype(user, /mob/living/carbon)) var/mob/living/carbon/C = user C.head_update(src, forced = 1) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/head/helmet/space/hardsuit/syndi/proc/toggle_hardsuit_mode(mob/user) //Helmet Toggles Suit Mode if(linkedsuit) @@ -256,7 +278,6 @@ item_state = "syndie_hardsuit" item_color = "syndi" w_class = 3 - action_button_name = "Toggle Helmet" 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/internals) helmettype = /obj/item/clothing/head/helmet/space/hardsuit/syndi @@ -373,15 +394,14 @@ armor = list(melee = 30, bullet = 5, laser = 10, energy = 5, bomb = 100, bio = 100, rad = 60) var/obj/machinery/doppler_array/integrated/bomb_radar scan_reagents = 1 + actions_types = list(/datum/action/item_action/toggle_helmet_light, /datum/action/item_action/toggle_research_scanner) /obj/item/clothing/head/helmet/space/hardsuit/rd/New() ..() bomb_radar = new /obj/machinery/doppler_array/integrated(src) /obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/living/carbon/human/user, slot) - ..(user, slot) - user.scanner.Grant(user) - user.scanner.devices += 1 + ..() if(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic)) user << ("Your [user.glasses] prevents you using [src]'s diagnostic visor HUD.") else @@ -390,8 +410,7 @@ DHUD.add_hud_to(user) /obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/living/carbon/human/user) - ..(user) - user.scanner.devices = max(0, user.scanner.devices - 1) + ..() if(onboard_hud_enabled && !(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic))) var/datum/atom_hud/DHUD = huds[DATA_HUD_DIAGNOSTIC] DHUD.remove_hud_from(user) diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index dbce102f077..e89458f6da9 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -44,7 +44,7 @@ Contains: strip_delay = 130 max_heat_protection_temperature = FIRE_IMMUNITY_HELM_MAX_TEMP_PROTECT unacidable = 1 - action_button_name = null + actions_types = list() /obj/item/clothing/head/helmet/space/hardsuit/deathsquad/attack_self(mob/user) return @@ -262,7 +262,7 @@ Contains: item_state = "syndicate" armor = list(melee = -20, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 100, rad = 75) //As whimpy as a space carp brightness_on = 0 //luminosity when on - action_button_name = "" + actions_types = list() flags = STOPSPRESSUREDMAGE | THICKMATERIAL | NODROP @@ -284,7 +284,7 @@ Contains: item_state = "hardsuit0-prt" item_color = "knight_grey" max_heat_protection_temperature = FIRE_IMMUNITY_HELM_MAX_TEMP_PROTECT - action_button_name = null + actions_types = list() /obj/item/clothing/suit/space/hardsuit/ert/paranormal name = "paranormal response team suit" diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 83d21d2117a..1cd1b4616a5 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -131,7 +131,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 Armor" + actions_types = list(/datum/action/item_action/toggle) unacidable = 1 hit_reaction_chance = 50 diff --git a/code/modules/clothing/suits/jobs.dm b/code/modules/clothing/suits/jobs.dm index b4444726662..b1386ed9eea 100644 --- a/code/modules/clothing/suits/jobs.dm +++ b/code/modules/clothing/suits/jobs.dm @@ -31,7 +31,6 @@ body_parts_covered = CHEST|GROIN|LEGS|ARMS allowed = list(/obj/item/weapon/storage/book/bible, /obj/item/weapon/nullrod, /obj/item/weapon/reagent_containers/food/drinks/bottle/holywater, /obj/item/weapon/storage/fancy/candle_box, /obj/item/candle, /obj/item/weapon/tank/internals/emergency_oxygen) hooded = 1 - action_button_name = "Toggle Chaplain Hoodie" hoodtype = /obj/item/clothing/head/chaplain_hood /obj/item/clothing/head/chaplain_hood diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index d0c8e507ab9..f565dd1d316 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -136,7 +136,7 @@ togglename = "wings" body_parts_covered = ARMS|CHEST 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,/obj/item/weapon/melee/classic_baton/telescopic) - action_button_name = "Toggle Owl Wings" + actions_types = list(/datum/action/item_action/toggle_wings) /obj/item/clothing/suit/toggle/owlwings/griffinwings name = "griffon cloak" @@ -215,7 +215,6 @@ min_cold_protection_temperature = FIRE_SUIT_MIN_TEMP_PROTECT //Space carp like space, so you should too allowed = list(/obj/item/weapon/tank/internals/emergency_oxygen, /obj/item/weapon/gun/projectile/automatic/speargun) hooded = 1 - action_button_name = "Toggle Carp Hood" hoodtype = /obj/item/clothing/head/carp_hood /obj/item/clothing/head/carp_hood @@ -238,7 +237,6 @@ //min_cold_protection_temperature = FIRE_SUIT_MIN_TEMP_PROTECT allowed = list(,) hooded = 1 - action_button_name = "Toggle Ian Hood" hoodtype = /obj/item/clothing/head/ian_hood /obj/item/clothing/head/ian_hood @@ -259,7 +257,7 @@ body_parts_covered = CHEST|GROIN|ARMS allowed = list(,) hooded = 1 - action_button_name = "Toggle Human Head" + actions_types = list(/datum/action/item_action/toggle_human_head) hoodtype = /obj/item/clothing/head/human_head /obj/item/clothing/head/human_head @@ -374,7 +372,6 @@ armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 10, rad = 0) allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/internals/emergency_oxygen,/obj/item/toy,/obj/item/weapon/storage/fancy/cigarettes,/obj/item/weapon/lighter) hooded = 1 - action_button_name = "Toggle Winter Hood" /obj/item/clothing/head/winterhood name = "winter hood" diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index 5283af92d42..fc8d0cf89ac 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -20,6 +20,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() @@ -33,8 +37,12 @@ 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() + ..() RemoveHood() /obj/item/clothing/suit/hooded/proc/ToggleHood() @@ -52,6 +60,9 @@ suittoggled = 1 src.icon_state = "[initial(icon_state)]_t" H.update_inv_wear_suit() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() else RemoveHood() @@ -84,6 +95,9 @@ src.icon_state = "[initial(icon_state)]_t" src.suittoggled = 1 usr.update_inv_wear_suit() + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/suit/toggle/examine(mob/user) ..() @@ -140,6 +154,7 @@ helmet.loc = src /obj/item/clothing/suit/space/hardsuit/dropped() + ..() RemoveHelmet() /obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet() diff --git a/code/modules/clothing/under/chameleon.dm b/code/modules/clothing/under/chameleon.dm index f38708348bb..a72f6ea4539 100644 --- a/code/modules/clothing/under/chameleon.dm +++ b/code/modules/clothing/under/chameleon.dm @@ -5,7 +5,7 @@ item_state = "bl_suit" item_color = "black" desc = "It's a plain jumpsuit. It has a small dial on the wrist." - action_button_name = "Change" + actions_types = list(/datum/action/item_action/change) origin_tech = "syndicate=3" sensor_mode = 0 //Hey who's this guy on the Syndicate Shuttle?? random_sensor = 0 diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index fc30cec85e5..d9e24ecd69c 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -308,10 +308,12 @@ return ..() /obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/pickup(mob/user) + ..() src.SetLuminosity(0) user.AddLuminosity(round(potency / 5,1)) /obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/dropped(mob/user) + ..() user.AddLuminosity(round(-potency / 5,1)) src.SetLuminosity(round(potency / 5,1)) @@ -1222,10 +1224,12 @@ obj/item/weapon/reagent_containers/food/snacks/grown/shell/eggy/add_juice() return ..() /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user) + ..() SetLuminosity(0) user.AddLuminosity(round(potency / 10,1)) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user) + ..() user.AddLuminosity(round(-potency / 10,1)) SetLuminosity(round(potency / 10,1)) diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index bbb49c96cae..dc4bdd7a2f7 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -158,6 +158,7 @@ qdel(src) /obj/item/weapon/grown/novaflower/pickup(mob/living/carbon/human/user) + ..() if(!user.gloves) user << "The [name] burns your bare hand!" user.adjustFireLoss(rand(1, 5)) @@ -184,6 +185,7 @@ return (BRUTELOSS|TOXLOSS) /obj/item/weapon/grown/nettle/pickup(mob/living/user) + ..() if(!iscarbon(user)) return 0 var/mob/living/carbon/C = user diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 073eb5be33c..3a8e0dcaaa6 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -263,4 +263,11 @@ var/obj/item/I = get_active_hand() if (I) - I.equip_to_best_slot(src) \ No newline at end of file + I.equip_to_best_slot(src) + +//used in code for items usable by both carbon and drones, this gives the proper back slot for each mob.(defibrillator, backpack watertank, ...) +/mob/proc/getBackSlot() + return slot_back + +/mob/proc/getBeltSlot() + return slot_belt \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index 6f3d4b26df3..3d7c28a98c4 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -5,34 +5,6 @@ These are general powers. Specific powers are stored under the appropriate alien /*Alien spit now works like a taser shot. It won't home in on the target but will act the same once it does hit. Doesn't work on other aliens/AI.*/ -/datum/action/spell_action/alien - -/datum/action/spell_action/alien/UpdateName() - var/obj/effect/proc_holder/alien/ab = target - return ab.name - -/datum/action/spell_action/alien/IsAvailable() - if(!target) - return 0 - var/obj/effect/proc_holder/alien/ab = target - - if(usr) - return ab.cost_check(ab.check_turf,usr,1) - else - if(owner) - return ab.cost_check(ab.check_turf,owner,1) - return 1 - -/datum/action/spell_action/alien/CheckRemoval() - if(!iscarbon(owner)) - return 1 - - var/mob/living/carbon/C = owner - if(target.loc && !(target.loc in C.internal_organs)) - return 1 - - return 0 - /obj/effect/proc_holder/alien name = "Alien Power" @@ -46,6 +18,10 @@ Doesn't work on other aliens/AI.*/ var/action_icon_state = "spell_default" var/action_background_icon_state = "bg_alien" +/obj/effect/proc_holder/alien/New() + ..() + action = new(src) + /obj/effect/proc_holder/alien/Click() if(!istype(usr,/mob/living/carbon)) return 1 @@ -319,6 +295,10 @@ Doesn't work on other aliens/AI.*/ if(!vessel) return 0 vessel.storedPlasma = max(vessel.storedPlasma + amount,0) vessel.storedPlasma = min(vessel.storedPlasma, vessel.max_plasma) //upper limit of max_plasma, lower limit of 0 + for(var/X in abilities) + var/obj/effect/proc_holder/alien/APH = X + if(APH.has_action) + APH.action.UpdateButtonIcon() return 1 /mob/living/carbon/alien/adjustPlasma(amount) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 90a165abc9a..b6b13b41669 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -555,13 +555,6 @@ var/const/GALOSHES_DONT_HELP = 4 abilities.Add(A) A.on_gain(src) if(A.has_action) - if(!A.action) - A.action = new/datum/action/spell_action/alien - A.action.target = A - A.action.name = A.name - A.action.button_icon = A.action_icon - A.action.button_icon_state = A.action_icon_state - A.action.background_icon_state = A.action_background_icon_state A.action.Grant(src) sortInsert(abilities, /proc/cmp_abilities_cost, 0) @@ -789,6 +782,7 @@ var/const/GALOSHES_DONT_HELP = 4 throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed) else clear_alert("handcuffed") + update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed. update_inv_handcuffed() update_hud_handcuffed() diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 9f6d91dc52a..c7e5f8174fe 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -88,6 +88,8 @@ wear_suit = I if(I.flags_inv & HIDEJUMPSUIT) update_inv_w_uniform() + if(wear_suit.breakouttime) //when equipping a straightjacket + update_action_buttons_icon() //certain action buttons will no longer be usable. update_inv_wear_suit() if(slot_w_uniform) w_uniform = I @@ -113,6 +115,8 @@ if(I == wear_suit) if(s_store) unEquip(s_store, 1) //It makes no sense for your suit storage to stay on you if you drop your suit. + if(wear_suit.breakouttime) //when unequipping a straightjacket + update_action_buttons_icon() //certain action buttons may be usable again. wear_suit = null if(I.flags_inv & HIDEJUMPSUIT) update_inv_w_uniform() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index d789d65410a..856669964b4 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -119,6 +119,12 @@ return 0 return 1 +/datum/species/proc/on_species_loss(mob/living/carbon/C) + if(C.dna.species) + if(C.dna.species.exotic_blood) + var/datum/reagent/EB = C.dna.species.exotic_blood + C.reagents.del_reagent(initial(EB.id)) + /datum/species/proc/update_base_icon_state(mob/living/carbon/human/H) if(H.disabilities & HUSK) H.remove_overlay(SPECIES_LAYER) // races lose their color diff --git a/code/modules/mob/living/carbon/human/species_types.dm b/code/modules/mob/living/carbon/human/species_types.dm index d76cdfa4384..e12098c125c 100644 --- a/code/modules/mob/living/carbon/human/species_types.dm +++ b/code/modules/mob/living/carbon/human/species_types.dm @@ -240,11 +240,23 @@ var/regex/lizard_hiSS = new("S+", "g") burnmod = 0.5 coldmod = 2 heatmod = 0.5 + var/datum/action/innate/split_body/slime_split + var/datum/action/innate/swap_body/callforward + var/datum/action/innate/swap_body/callback + +/datum/species/jelly/slime/on_species_loss(mob/living/carbon/C) + if(slime_split) + slime_split.Remove(C) + if(callforward) + callforward.Remove(C) + if(callback) + callback.Remove(C) + ..() /datum/species/jelly/slime/spec_life(mob/living/carbon/human/H) if(recently_changed) - var/datum/action/innate/split_body/S = new - S.Grant(H) + slime_split = new + slime_split.Grant(H) for(var/datum/reagent/toxin/slimejelly/S in H.reagents.reagent_list) if(S.volume >= 200) @@ -259,16 +271,10 @@ var/regex/lizard_hiSS = new("S+", "g") /datum/action/innate/split_body name = "Split Body" - check_flags = AB_CHECK_ALIVE + check_flags = AB_CHECK_CONSCIOUS button_icon_state = "slimesplit" background_icon_state = "bg_alien" -/datum/action/innate/split_body/CheckRemoval() - var/mob/living/carbon/human/H = owner - if(!ishuman(H) || !H.dna || !H.dna.species || H.dna.species.id != "slime") - return 1 - return 0 - /datum/action/innate/split_body/Activate() var/mob/living/carbon/human/H = owner H << "You focus intently on moving your body while standing perfectly still..." @@ -286,12 +292,13 @@ var/regex/lizard_hiSS = new("S+", "g") spare.Move(get_step(H.loc, pick(NORTH,SOUTH,EAST,WEST))) S.volume = 80 H.notransform = 0 - var/datum/action/innate/swap_body/callforward = new /datum/action/innate/swap_body() - var/datum/action/innate/swap_body/callback = new /datum/action/innate/swap_body() - callforward.body = spare - callforward.Grant(H) - callback.body = H - callback.Grant(spare) + var/datum/species/jelly/slime/SS = H.dna.species + SS.callforward = new + SS.callforward.body = spare + SS.callforward.Grant(H) + SS.callback = new + SS.callback.body = H + SS.callback.Grant(spare) H.mind.transfer_to(spare) spare << "...and after a moment of disorentation, you're besides yourself!" return @@ -301,17 +308,11 @@ var/regex/lizard_hiSS = new("S+", "g") /datum/action/innate/swap_body name = "Swap Body" - check_flags = AB_CHECK_ALIVE + check_flags = AB_CHECK_CONSCIOUS button_icon_state = "slimeswap" background_icon_state = "bg_alien" var/mob/living/carbon/human/body -/datum/action/innate/swap_body/CheckRemoval() - var/mob/living/carbon/human/H = owner - if(!ishuman(H) || !H.dna || !H.dna.species || H.dna.species.id != "slime") - return 1 - return 0 - /datum/action/innate/swap_body/Activate() if(!body || !istype(body) || !body.dna || !body.dna.species || body.dna.species.id != "slime" || body.stat == DEAD || qdeleted(body)) owner << "Something is wrong, you cannot sense your other body!" diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index d88efc079a6..910cbf3c338 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -40,7 +40,7 @@ update_inv_back() if(slot_wear_mask) wear_mask = I - wear_mask_update(I, toggle_off=0) + wear_mask_update(I, toggle_off = 0) if(slot_head) head = I head_update(I) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index cd005be1be1..ada5f67baf6 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -196,7 +196,7 @@ /mob/living/carbon/proc/get_breath_from_internal(volume_needed) if(internal) - if (!contents.Find(internal)) + if(internal.loc != src) internal = null update_internals_hud_icon(0) else @@ -382,9 +382,3 @@ if(360.15 to INFINITY) //360.15 is 310.15 + 50, the temperature where you start to feel effects. //We totally need a sweat system cause it totally makes sense...~ bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers - - -/mob/living/carbon/handle_actions() - ..() - for(var/obj/item/I in internal_organs) - give_action_button(I, 1) \ No newline at end of file diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index b78d0fae14e..8490523610e 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -52,6 +52,7 @@ blind_eyes(1) reset_perspective(null) hide_fullscreens() + update_action_buttons_icon() update_damage_hud() update_health_hud() update_canmove() diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index e3ef16ce291..be63fc849a6 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -49,10 +49,6 @@ handle_disabilities() // eye, ear, brain damages handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc - handle_actions() - - handle_regular_hud_updates() - /mob/living/proc/handle_breathing() @@ -117,92 +113,7 @@ if(ear_damage < 100) adjustEarDamage(-0.05,-1) -/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(istype(I, /obj/item/organ/internal)) - I.action = new/datum/action/item_action/organ_action - else if(I.action_button_is_hands_free) - I.action = new/datum/action/item_action/hands_free - 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/proc/update_damage_hud() return -//this handles hud updates. -/mob/living/proc/handle_regular_hud_updates() - if(!client) - return 0 - update_action_buttons() - return 1 -/mob/living/update_action_buttons() - if(!hud_used) return - if(!client) return - - if(hud_used.hud_shown != 1) //Hud toggled to minimal - 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 diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 842842a37bf..c977343e8ef 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -6,8 +6,6 @@ update_gravity(mob_has_gravity()) - update_action_buttons() - if(malfhack) if(malfhack.aidisabled) src << "ERROR: APC access disabled, hack attempt canceled." diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 7ddc810833c..ea12c449a86 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -6,7 +6,7 @@ return ..() - + handle_robot_hud_updates() handle_robot_cell() /mob/living/silicon/robot/proc/handle_robot_cell() @@ -30,7 +30,7 @@ update_headlamp() diag_hud_set_borgcell() -/mob/living/silicon/robot/handle_regular_hud_updates() +/mob/living/silicon/robot/proc/handle_robot_hud_updates() if(!client) return @@ -49,8 +49,7 @@ if(!mind.special_role) mind.special_role = "traitor" ticker.mode.traitors += mind - ..() - return 1 + /mob/living/silicon/robot/update_health_hud() if(!client || !hud_used) @@ -117,4 +116,5 @@ else canmove = 1 update_transform() + update_action_buttons_icon() return canmove diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 58c5c241ccd..b86e8f7ca21 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -80,7 +80,6 @@ equip_to_slot_or_del(I, slot_head) access_card.flags |= NODROP - scanner.Grant(src) alert_drones(DRONE_NET_CONNECT) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm index 3efd4d48f15..a4368fd585a 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm @@ -115,3 +115,9 @@ /mob/living/simple_animal/drone/stripPanelEquip(obj/item/what, mob/who, where) ..(what, who, where, 1) + +/mob/living/simple_animal/drone/getBackSlot() + return slot_drone_storage + +/mob/living/simple_animal/drone/getBeltSlot() + return slot_drone_storage diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index d5bec802eb6..31218b5e5aa 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -586,6 +586,7 @@ return /obj/item/weapon/guardian_bomb/pickup(mob/living/user) + ..() detonate(user) return diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 8dbf0beae1b..7351dcdb064 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -535,6 +535,7 @@ else canmove = 1 update_transform() + update_action_buttons_icon() return canmove /mob/living/simple_animal/update_transform() diff --git a/code/modules/mob/living/simple_animal/slime/death.dm b/code/modules/mob/living/simple_animal/slime/death.dm index dca7d56c4e3..fb9d09c1565 100644 --- a/code/modules/mob/living/simple_animal/slime/death.dm +++ b/code/modules/mob/living/simple_animal/slime/death.dm @@ -9,6 +9,8 @@ M.regenerate_icons() is_adult = 0 maxHealth = 150 + for(var/datum/action/innate/slime/reproduce/R in actions) + R.Remove(src) var/datum/action/innate/slime/evolve/E = new E.Grant(src) revive(full_heal = 1) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index c0e0ead4f98..f5c892ab426 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -230,6 +230,7 @@ else if (nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD) nutrition -= 20 amount_grown++ + update_action_buttons_icon() if(amount_grown >= SLIME_EVOLUTION_THRESHOLD && !buckled && !Target && !ckey) if(is_adult) diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index 4f838717b87..74a32d22cd6 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -6,22 +6,10 @@ #define GROWTH_NEEDED 1 /datum/action/innate/slime - check_flags = AB_CHECK_ALIVE + check_flags = AB_CHECK_CONSCIOUS background_icon_state = "bg_alien" - var/adult_action = SIZE_DOESNT_MATTER var/needs_growth = NO_GROWTH_NEEDED -/datum/action/innate/slime/CheckRemoval() - if(!isslime(owner)) - return 1 - var/mob/living/simple_animal/slime/S = owner - if(adult_action != SIZE_DOESNT_MATTER) - if(adult_action == ADULTS_ONLY && !S.is_adult) - return 1 - else if(adult_action == BABIES_ONLY && S.is_adult) - return 1 - return 0 - /datum/action/innate/slime/IsAvailable() if(..()) var/mob/living/simple_animal/slime/S = owner @@ -120,6 +108,8 @@ is_adult = 1 maxHealth = 200 amount_grown = 0 + for(var/datum/action/innate/slime/evolve/E in actions) + E.Remove(src) regenerate_icons() name = text("[colour] [is_adult ? "adult" : "baby"] slime ([number])") else @@ -130,7 +120,6 @@ /datum/action/innate/slime/evolve name = "Evolve" button_icon_state = "slimegrow" - adult_action = BABIES_ONLY needs_growth = GROWTH_NEEDED /datum/action/innate/slime/evolve/Activate() @@ -191,7 +180,6 @@ /datum/action/innate/slime/reproduce name = "Reproduce" button_icon_state = "slimesplit" - adult_action = ADULTS_ONLY needs_growth = GROWTH_NEEDED /datum/action/innate/slime/reproduce/Activate() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e28645e4ece..6f47cb5d2f6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -708,6 +708,7 @@ var/next_mob_id = 0 if(layer == MOB_LAYER - 0.2) layer = initial(layer) update_transform() + update_action_buttons_icon() lying_prev = lying return canmove @@ -887,18 +888,9 @@ var/next_mob_id = 0 /mob/proc/setEarDamage() return -/mob/proc/AddSpell(obj/effect/proc_holder/spell/spell) - mob_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 +/mob/proc/AddSpell(obj/effect/proc_holder/spell/S) + mob_spell_list += S + S.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 017c9a0369b..5be8673a352 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -84,7 +84,6 @@ var/datum/hud/hud_used = null var/research_scanner = 0 //For research scanner equipped mobs. Enable to show research data when examining. - var/datum/action/innate/scan_mode/scanner = new var/list/grabbed_by = list( ) var/list/requests = list( ) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index d8032f467bf..4517dea695e 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -211,6 +211,7 @@ add_logs(user, affecting, "attempted to put", src, "into [M]") /obj/item/weapon/grab/dropped() + ..() qdel(src) #undef UPGRADE_COOLDOWN diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index aa308644e11..e749d430867 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -257,23 +257,26 @@ obj/item/weapon/gun/proc/newshot() else return -/obj/item/weapon/gun/attackby(obj/item/A, mob/user, params) - if(istype(A, /obj/item/device/flashlight/seclite)) - var/obj/item/device/flashlight/seclite/S = A +/obj/item/weapon/gun/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/device/flashlight/seclite)) + var/obj/item/device/flashlight/seclite/S = I if(can_flashlight) if(!F) - if(!user.unEquip(A)) + if(!user.unEquip(I)) return user << "You click [S] into place on [src]." if(S.on) SetLuminosity(0) F = S - A.loc = src + 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(A, /obj/item/weapon/screwdriver)) + if(istype(I, /obj/item/weapon/screwdriver)) if(F) for(var/obj/item/device/flashlight/seclite/S in src) user << "You unscrew the seclite from [src]." @@ -283,13 +286,13 @@ obj/item/weapon/gun/proc/newshot() 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(A, /obj/item/weapon/pen)) + if(istype(I, /obj/item/weapon/pen)) rename_gun(user) - ..() - return /obj/item/weapon/gun/proc/toggle_gunlight() set name = "Toggle Gunlight" @@ -311,7 +314,6 @@ obj/item/weapon/gun/proc/newshot() /obj/item/weapon/gun/proc/update_gunlight(mob/user = null) if(F) - action_button_name = "Toggle Gunlight" if(F.on) if(loc == user) user.AddLuminosity(F.brightness_on) @@ -324,14 +326,17 @@ obj/item/weapon/gun/proc/newshot() SetLuminosity(0) update_icon() else - action_button_name = null if(loc == user) user.AddLuminosity(-5) else if(isturf(loc)) SetLuminosity(0) - return + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() + /obj/item/weapon/gun/pickup(mob/user) + ..() if(F) if(F.on) user.AddLuminosity(F.brightness_on) @@ -340,6 +345,7 @@ obj/item/weapon/gun/proc/newshot() azoom.Grant(user) /obj/item/weapon/gun/dropped(mob/user) + ..() if(F) if(F.on) user.AddLuminosity(-F.brightness_on) @@ -426,7 +432,7 @@ obj/item/weapon/gun/proc/newshot() /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 @@ -443,7 +449,6 @@ obj/item/weapon/gun/proc/newshot() ..() - /obj/item/weapon/gun/proc/zoom(mob/living/user, forced_zoom) if(!user || !user.client) return diff --git a/code/modules/projectiles/guns/mounted.dm b/code/modules/projectiles/guns/mounted.dm index d6a54ffa0ea..84549c8e09f 100644 --- a/code/modules/projectiles/guns/mounted.dm +++ b/code/modules/projectiles/guns/mounted.dm @@ -10,6 +10,7 @@ can_flashlight = 0 /obj/item/weapon/gun/energy/gun/advtaser/mounted/dropped()//if somebody manages to drop this somehow... + ..() src.loc = null//send it to nullspace to get retrieved by the implant later on. gotta cover those edge cases. /obj/item/weapon/gun/energy/laser/mounted @@ -25,4 +26,5 @@ materials = null /obj/item/weapon/gun/energy/laser/mounted/dropped() + ..() src.loc = null diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 681db297fc3..54313c7f174 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -6,7 +6,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/proto name = "\improper NanoTrasen Saber SMG" @@ -67,7 +67,9 @@ playsound(user, 'sound/weapons/empty.ogg', 100, 1) update_icon() - return + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/weapon/gun/projectile/automatic/can_shoot() return get_ammo() @@ -118,7 +120,7 @@ fire_delay = 2 can_suppress = 0 burst_size = 0 - action_button_name = null + actions_types = list() /obj/item/weapon/gun/projectile/automatic/wt550/update_icon() ..() diff --git a/code/modules/projectiles/guns/projectile/launchers.dm b/code/modules/projectiles/guns/projectile/launchers.dm index ed5c2f204e9..e7d55f30c16 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/process_chamber(eject_casing = 0, empty_chamber = 1) ..() @@ -62,7 +62,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 6df4c8eb333..5c45df2cb17 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/update_icon() ..() @@ -55,4 +55,4 @@ can_suppress = 0 burst_size = 3 fire_delay = 2 - action_button_name = "Toggle Firemode" + actions_types = list(/datum/action/item_action/toggle_firemode) \ No newline at end of file diff --git a/code/modules/projectiles/guns/projectile/rechargable_magazine.dm b/code/modules/projectiles/guns/projectile/rechargable_magazine.dm index 7557e16db23..c5b3ecd2bec 100644 --- a/code/modules/projectiles/guns/projectile/rechargable_magazine.dm +++ b/code/modules/projectiles/guns/projectile/rechargable_magazine.dm @@ -36,7 +36,7 @@ fire_delay = 2 can_suppress = 0 burst_size = 0 - action_button_name = null + actions_types = list() fire_sound = 'sound/weapons/Laser.ogg' /obj/item/weapon/gun/projectile/automatic/laser/process_chamber(eject_casing = 0, empty_chamber = 1) diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 58113e9ee7a..76f18ad2a36 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -134,6 +134,7 @@ pump() /obj/item/weapon/gun/projectile/shotgun/boltaction/enchanted/dropped() + ..() guns_left = 0 /obj/item/weapon/gun/projectile/shotgun/boltaction/enchanted/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1) @@ -311,7 +312,7 @@ burst_size = 1 fire_delay = 0 pin = /obj/item/device/firing_pin/implant/pindicate - action_button_name = null + actions_types = list() /obj/item/weapon/gun/projectile/automatic/shotgun/bulldog/unrestricted pin = /obj/item/device/firing_pin diff --git a/code/modules/projectiles/guns/projectile/toy.dm b/code/modules/projectiles/guns/projectile/toy.dm index 2555a8ac16a..417f13ea9b5 100644 --- a/code/modules/projectiles/guns/projectile/toy.dm +++ b/code/modules/projectiles/guns/projectile/toy.dm @@ -29,7 +29,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/spells/spell.dm b/code/modules/spells/spell.dm index b38d951b5c9..b46d9f4a49c 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -156,6 +156,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 @@ -169,9 +170,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 && isnull(gc_destroyed)) 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/modules/surgery/dental_implant.dm b/code/modules/surgery/dental_implant.dm index 189d37da341..44ead63927f 100644 --- a/code/modules/surgery/dental_implant.dm +++ b/code/modules/surgery/dental_implant.dm @@ -31,12 +31,13 @@ name = "Activate Pill" /datum/action/item_action/hands_free/activate_pill/Trigger() - if(!..() || CheckRemoval(owner)) + if(!..()) return 0 owner << "You grit your teeth and burst the implanted [target]!" add_logs(owner, null, "swallowed an implanted pill", target) if(target.reagents.total_volume) target.reagents.reaction(owner, INGEST) target.reagents.trans_to(owner, target.reagents.total_volume) + Remove(owner) qdel(target) return 1 \ No newline at end of file diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 6fd62d8c645..b793fd05fc8 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -47,7 +47,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 @@ -260,7 +260,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. @@ -309,7 +309,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) @@ -319,7 +319,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 e1e4ac7a3d5..5501ac870ed 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -6,7 +6,6 @@ var/zone = "chest" var/slot var/vital = 0 - var/organ_action_name = null /obj/item/organ/internal/proc/Insert(mob/living/carbon/M, special = 0) if(!iscarbon(M) || owner == M) @@ -19,9 +18,9 @@ owner = M M.internal_organs |= src loc = null - if(organ_action_name) - action_button_name = organ_action_name - + for(var/X in actions) + var/datum/action/A = X + A.Grant(src) /obj/item/organ/internal/proc/Remove(mob/living/carbon/M, special = 0) owner = null @@ -29,9 +28,9 @@ M.internal_organs -= src if(vital && !special) M.death() - - 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/proc/on_find(mob/living/finder) return @@ -76,6 +75,9 @@ else ..() +/obj/item/organ/internal/item_action_slot_check(slot,mob/user) + return //so we don't grant the organ's action to mobs who pick up the organ. + //Looking for brains? //Try code/modules/mob/living/carbon/brain/brain_item.dm diff --git a/icons/mob/actions.dmi b/icons/mob/actions.dmi index 6f1f472ab00..2c7c3309126 100644 Binary files a/icons/mob/actions.dmi and b/icons/mob/actions.dmi differ diff --git a/tgstation.dme b/tgstation.dme index dd03750a894..4d742004b8e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -96,7 +96,7 @@ #include "code\_onclick\overmind.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" @@ -142,6 +142,7 @@ #include "code\controllers\subsystem\ticker.dm" #include "code\controllers\subsystem\timer.dm" #include "code\controllers\subsystem\voting.dm" +#include "code\datums\action.dm" #include "code\datums\ai_laws.dm" #include "code\datums\beam.dm" #include "code\datums\browser.dm"