diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm
index 84a49083a9d2..f7408e3ff8fb 100644
--- a/code/_onclick/hud/action.dm
+++ b/code/_onclick/hud/action.dm
@@ -1,8 +1,7 @@
#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
+#define AB_CHECK_CONSCIOUS 8
/datum/action
@@ -31,6 +30,13 @@
Remove(owner)
owner = T
T.actions += src
+
+ if(!button)
+ button = new
+ button.linked_action = src
+ button.name = UpdateName()
+ if(T.client)
+ T.client.screen += button
T.update_action_buttons()
/datum/action/proc/Remove(mob/living/T)
@@ -44,37 +50,28 @@
owner = null
/datum/action/proc/Trigger()
- if(!Checks())
+ if(!IsAvailable())
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)
+ if(owner.stunned || owner.weakened)
return 0
if(check_flags & AB_CHECK_LYING)
if(owner.lying)
return 0
- if(check_flags & AB_CHECK_ALIVE)
+ if(check_flags & AB_CHECK_CONSCIOUS)
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()
@@ -90,8 +87,8 @@
current_button.overlays += img
/obj/screen/movable/action_button
- var/datum/action/owner
- screen_loc = "WEST,NORTH"
+ var/datum/action/linked_action
+ screen_loc = null
/obj/screen/movable/action_button/Click(location,control,params)
var/list/modifiers = params2list(params)
@@ -100,18 +97,18 @@
return 1
if(usr.next_move >= world.time) // Is this needed ?
return
- owner.Trigger()
+ linked_action.Trigger()
return 1
/obj/screen/movable/action_button/proc/UpdateIcon()
- if(!owner)
+ if(!linked_action)
return
- icon = owner.button_icon
- icon_state = owner.background_icon_state
+ icon = linked_action.button_icon
+ icon_state = linked_action.background_icon_state
- owner.ApplyIcon(src)
+ linked_action.ApplyIcon(src)
- if(!owner.IsAvailable())
+ if(!linked_action.IsAvailable())
color = rgb(128,0,0,128)
else
color = rgb(255,255,255,255)
@@ -163,7 +160,11 @@
//This is the proc used to update all the action buttons. Properly defined in /mob/living/
-/mob/proc/update_action_buttons()
+/mob/proc/update_action_buttons(reload_screen)
+ return
+
+//used to update the buttons icon.
+/mob/proc/update_action_buttons_icon()
return
#define AB_MAX_COLUMNS 10
@@ -191,7 +192,7 @@
//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
+ check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_CONSCIOUS
/datum/action/item_action/Trigger()
if(!..())
@@ -201,9 +202,6 @@
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)
@@ -214,17 +212,10 @@
I.layer = old
/datum/action/item_action/hands_free
- check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE
+ check_flags = AB_CHECK_CONSCIOUS
/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
+ check_flags = AB_CHECK_CONSCIOUS
/datum/action/item_action/organ_action/IsAvailable()
var/obj/item/organ/internal/I = target
@@ -246,8 +237,7 @@
return 1
/datum/action/spell_action/UpdateName()
- var/obj/effect/proc_holder/spell/spell = target
- return spell.name
+ return target.name
/datum/action/spell_action/IsAvailable()
if(!target)
@@ -261,12 +251,6 @@
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
@@ -304,7 +288,7 @@
/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
+ check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_CONSCIOUS
var/devices = 0 //How may enabled scanners the mob has
/datum/action/innate/scan_mode/Activate()
@@ -320,11 +304,6 @@
/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
diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm
index ca18c3c387e2..d794ff09c7cc 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 e8d4e4b3d732..315fce5bf65a 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/game/dna.dm b/code/game/dna.dm
index 24b464d41ab9..01ff138e1aa6 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 ef732b7f93b2..62c9c72a3c61 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 6c0883e09764..1824d7a22807 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 76949a66487e..762a8b4d6837 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 771141213f42..55f5a16738fe 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 71137852025c..010afd2c0917 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 74d1cbf3a327..707df3c16f0f 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
@@ -14,7 +14,7 @@
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
+ action_button_type = /datum/action/item_action/hands_free
var/mode = VEST_STEALTH
var/stealth_active = 0
var/combat_cooldown = 10
@@ -29,20 +29,19 @@
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()
+ if(action && action.button)
+ action.button.UpdateIcon()
+/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
diff --git a/code/game/gamemodes/miniantags/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm
index f90b2b78bbaa..00b42efbc4db 100644
--- a/code/game/gamemodes/miniantags/morph/morph.dm
+++ b/code/game/gamemodes/miniantags/morph/morph.dm
@@ -169,9 +169,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 65ac50afd8bc..f61cf1c8a6e6 100644
--- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
+++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
@@ -79,7 +79,8 @@
name = "[initial(name)] ([cast_amount]E)"
user.reveal(reveal)
user.stun(stun)
- user.update_action_buttons()
+ if(action && action.button)
+ action.button.UpdateIcon()
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 8239ecc77246..7be25cd4722d 100644
--- a/code/game/gamemodes/shadowling/shadowling_items.dm
+++ b/code/game/gamemodes/shadowling/shadowling_items.dm
@@ -84,7 +84,7 @@
flash_protect = -1
unacidable = 1
action_button_name = "Shift Nerves"
- action_button_is_hands_free = 1
+ action_button_type = /datum/action/item_action/hands_free
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 f0248c3076e2..cdef3cbe85af 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/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 3aef28835367..3cba2799aefb 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 fc24fb14bad2..c520f594834b 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -35,8 +35,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
//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/action_button_type = null //if we want a special type of item action, not the standard one.
var/datum/action/item_action/action = null
//Since any item can now be a piece of clothing, this has to be put here so all items share it.
@@ -363,12 +362,14 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
return
/obj/item/proc/dropped(mob/user)
- return
+ if(action)
+ action.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 +388,20 @@ 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
+ if(action_button_name)
+ if(!action)
+ if(action_button_type)
+ action = new action_button_type
+ else
+ action = new/datum/action/item_action
+ action.name = action_button_name
+ action.target = src
+ if(item_action_slot_check(slot, user)) //some items only give their action button when in a specific slot.
+ action.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.
diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm
index 0d26ff0d940e..dde1c59f567d 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 3f284a0481a3..7a0f85626ef5 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 92dbf4d6d276..3b14c41e5a54 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 954bf101e388..8e136bbb6820 100644
--- a/code/game/objects/items/devices/flashlight.dm
+++ b/code/game/objects/items/devices/flashlight.dm
@@ -41,6 +41,8 @@
return 0
on = !on
update_brightness(user)
+ if(action && action.button)
+ action.button.UpdateIcon()
return 1
@@ -84,12 +86,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)
diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm
index 7f77a68f41a0..5ef14db2bdc0 100644
--- a/code/game/objects/items/devices/traitordevices.dm
+++ b/code/game/objects/items/devices/traitordevices.dm
@@ -168,6 +168,10 @@ effective or pretty fucking useless.
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 0739c9a8b6df..278156bb3cef 100644
--- a/code/game/objects/items/robot/robot_upgrades.dm
+++ b/code/game/objects/items/robot/robot_upgrades.dm
@@ -236,7 +236,11 @@
cyborg = R
icon_state = "selfrepair_off"
action_button_name = "Toggle Self-Repair"
-
+ if(!action)
+ action = new
+ action.name = action_button_name
+ action.target = src
+ action.Grant(R)
return 1
/obj/item/borg/upgrade/selfrepair/ui_action_click()
@@ -252,6 +256,8 @@
/obj/item/borg/upgrade/selfrepair/update_icon()
if(cyborg)
icon_state = "selfrepair_[on ? "on" : "off"]"
+ if(action && action.button)
+ action.button.UpdateIcon()
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 2695041736a3..f89da1dcc97f 100644
--- a/code/game/objects/items/weapons/chrono_eraser.dm
+++ b/code/game/objects/items/weapons/chrono_eraser.dm
@@ -17,6 +17,7 @@
erased_minds += M
/obj/item/weapon/chrono_eraser/dropped()
+ ..()
if(PA)
qdel(PA)
@@ -33,7 +34,9 @@
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 +62,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 c18f344a717d..644bc612139f 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 dce70f51d29b..6a7476b4c940 100644
--- a/code/game/objects/items/weapons/defib.dm
+++ b/code/game/objects/items/weapons/defib.dm
@@ -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,22 @@
remove_paddles(user)
update_icon()
- return
+ if(action && action.button)
+ action.button.UpdateIcon()
/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 +241,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 +330,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 c8c2c07365bb..13a9a9f4c737 100644
--- a/code/game/objects/items/weapons/implants/implant.dm
+++ b/code/game/objects/items/weapons/implants/implant.dm
@@ -2,7 +2,6 @@
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"
var/activated = 1 //1 for implant types that can be activated, 0 for ones that are "always on" like loyalty implants
@@ -40,12 +39,16 @@
else
return 0
-
- if(activated)
- action_button_name = "Activate [src.name]"
src.loc = source
imp_in = source
implanted = 1
+ if(activated)
+ action_button_name = "Activate [src.name]"
+ if(!action)
+ action = new /datum/action/item_action/hands_free
+ action.name = action_button_name
+ action.target = src
+ action.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -59,7 +62,8 @@
src.loc = null
imp_in = null
implanted = 0
-
+ if(action)
+ action.Remove(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -76,6 +80,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 106615e78e21..43d496081b0e 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 e32c94b128f2..d23101cdc8f2 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 4cbd991c98ce..770adc191edb 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 cac36746465c..48afb1f4bcc8 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 9fde058f0e95..fad276107cf6 100644
--- a/code/game/objects/items/weapons/tanks/jetpack.dm
+++ b/code/game/objects/items/weapons/tanks/jetpack.dm
@@ -2,7 +2,7 @@
name = "Jetpack Mode"
/datum/action/item_action/jetpack/cycle/Trigger()
- if(!Checks())
+ if(!IsAvailable())
return
var/obj/item/weapon/tank/jetpack/J = target
@@ -12,19 +12,6 @@
/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."
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 2eb9fbb2904e..9130d3c75f88 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -1,50 +1,41 @@
-/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
-
+ action_button_name = "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()
+ var/mob/living/carbon/human/H = action.owner
+ if(!istype(H))
+ return
+
+ 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 == src)
+ H.internal = null
+ H << "You close \the [src] valve."
+ H.update_internals_hud_icon(0)
+ else if(H.wear_mask && (H.wear_mask.flags & MASKINTERNALS))
+ H.internal = src
+ H << "You open \the [src] valve."
+ H.update_internals_hud_icon(1)
/obj/item/weapon/tank/New()
..()
@@ -52,8 +43,6 @@
air_contents = new(volume) //liters
air_contents.temperature = T20C
- internals_action = new(src)
-
SSobj.processing |= src
/obj/item/weapon/tank/Destroy()
@@ -63,14 +52,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 eea4519a819b..33a83cbd03e6 100644
--- a/code/game/objects/items/weapons/tanks/watertank.dm
+++ b/code/game/objects/items/weapons/tanks/watertank.dm
@@ -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
@@ -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 ce535fbd7e69..03556edae0e8 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()
@@ -411,6 +412,8 @@
if(src == user.get_active_hand()) //update inhands
user.update_inv_l_hand()
user.update_inv_r_hand()
+ if(action && action.button)
+ action.button.UpdateIcon()
//GREY TIDE
diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm
index 382d28f2af2b..ea174df13f2d 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 ce2f468e0d63..32352855eb22 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 625a12c01be1..7108940c287d 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 d8f576c911c7..f1ce059d3aec 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -516,6 +516,8 @@ BLIND // can't see anything
if(istype(usr, /mob/living/carbon))
var/mob/living/carbon/C = usr
C.head_update(src, forced = 1)
+ if(action && action.button)
+ action.button.UpdateIcon()
/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 ec8c57500123..4194f474fc09 100644
--- a/code/modules/clothing/glasses/engine_goggles.dm
+++ b/code/modules/clothing/glasses/engine_goggles.dm
@@ -10,10 +10,7 @@
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,14 @@
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()
+ if(action && action.button)
+ action.button.UpdateIcon()
/obj/item/clothing/glasses/meson/engine/process()
if(!mode)
@@ -115,18 +115,20 @@
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()
+ if(action && action.button)
+ action.button.UpdateIcon()
/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/hud.dm b/code/modules/clothing/glasses/hud.dm
index 133e55cc1f01..55b4786b8132 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)
diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm
index 43349c6a5411..756732dbabea 100644
--- a/code/modules/clothing/head/hardhat.dm
+++ b/code/modules/clothing/head/hardhat.dm
@@ -24,13 +24,17 @@
turn_on(user)
else
turn_off(user)
+ if(action && action.button)
+ action.button.UpdateIcon()
/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 1bf816451271..5592732ca14c 100644
--- a/code/modules/clothing/head/helmet.dm
+++ b/code/modules/clothing/head/helmet.dm
@@ -229,6 +229,13 @@
update_icon()
update_helmlight(user)
verbs += /obj/item/clothing/head/helmet/proc/toggle_helmlight
+ action_button_name = "Toggle Helmetlight"
+ if(loc == user)
+ if(!action)
+ action = new
+ action.name = action_button_name
+ action.target = src
+ action.Grant(user)
return
if(istype(A, /obj/item/weapon/screwdriver))
@@ -242,10 +249,12 @@
update_icon()
usr.update_inv_head()
verbs -= /obj/item/clothing/head/helmet/proc/toggle_helmlight
+ action_button_name = null
+ if(action && loc == user)
+ action.Remove(user)
return
..()
- return
/obj/item/clothing/head/helmet/proc/toggle_helmlight()
set name = "Toggle Helmetlight"
@@ -269,7 +278,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 +289,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
+ action_button_name = null
+ if(action && action.button)
+ action.button.UpdateIcon()
/obj/item/clothing/head/helmet/pickup(mob/user)
+ ..()
if(F)
if(F.on)
user.AddLuminosity(F.brightness_on)
@@ -297,6 +308,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/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm
index 6055104b49fc..07a038729a26 100644
--- a/code/modules/clothing/masks/gasmask.dm
+++ b/code/modules/clothing/masks/gasmask.dm
@@ -111,12 +111,9 @@
burn_state = FLAMMABLE
action_button_name = "Adjust Mask"
-/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/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm
index a51af2db1b42..dea88acaef8a 100644
--- a/code/modules/clothing/shoes/bananashoes.dm
+++ b/code/modules/clothing/shoes/bananashoes.dm
@@ -72,3 +72,5 @@
else
icon_state = "clown_prototype_off"
usr.update_inv_shoes()
+ if(action && action.button)
+ action.button.UpdateIcon()
diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm
index 2e95c4c9f0a6..ec6fdaa65fd3 100644
--- a/code/modules/clothing/spacesuits/chronosuit.dm
+++ b/code/modules/clothing/spacesuits/chronosuit.dm
@@ -331,16 +331,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 4c410c014c2a..7e586e890c51 100644
--- a/code/modules/clothing/spacesuits/hardsuit.dm
+++ b/code/modules/clothing/spacesuits/hardsuit.dm
@@ -25,21 +25,30 @@
user.AddLuminosity(brightness_on)
else
user.AddLuminosity(-brightness_on)
+ if(action && action.button)
+ action.button.UpdateIcon()
/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()
@@ -75,14 +84,19 @@
/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)
+ jetpack.cycle_action.Grant(user)
/obj/item/clothing/suit/space/hardsuit/dropped(mob/user)
..()
if(jetpack)
jetpack.cycle_action.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
name = "engineering hardsuit helmet"
diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm
index 5283af92d42b..dbbfc5dbb007 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,11 @@
H.unEquip(hood, 1)
H.update_inv_wear_suit()
hood.loc = src
+ if(action && action.button)
+ action.button.UpdateIcon()
/obj/item/clothing/suit/hooded/dropped()
+ ..()
RemoveHood()
/obj/item/clothing/suit/hooded/proc/ToggleHood()
@@ -52,6 +59,8 @@
suittoggled = 1
src.icon_state = "[initial(icon_state)]_t"
H.update_inv_wear_suit()
+ if(action && action.button)
+ action.button.UpdateIcon()
else
RemoveHood()
@@ -84,6 +93,8 @@
src.icon_state = "[initial(icon_state)]_t"
src.suittoggled = 1
usr.update_inv_wear_suit()
+ if(action && action.button)
+ action.button.UpdateIcon()
/obj/item/clothing/suit/toggle/examine(mob/user)
..()
@@ -140,6 +151,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/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm
index fc30cec85e5d..d9e24ecd69cf 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 bbb49c96caef..dc4bdd7a2f75 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 073eb5be33c6..3a8e0dcaaa6d 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 6f3d4b26df35..de750a6d8339 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm
@@ -7,10 +7,6 @@ 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
@@ -23,16 +19,6 @@ Doesn't work on other aliens/AI.*/
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"
@@ -319,6 +305,11 @@ 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.action && APH.action.button)
+ var/obj/screen/movable/action_button/AB = APH.action.button
+ AB.UpdateIcon()
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 90a165abc9a5..cb6a42efb163 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -789,6 +789,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 20a1005d2138..6bde0e6fc254 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 d789d65410a0..856669964b47 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 d76cdfa43842..e12098c125c0 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/life.dm b/code/modules/mob/living/carbon/life.dm
index a4a68b8ac66c..6b90a274f3de 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -387,9 +387,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 b78d0fae14e3..8490523610e8 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 e3ef16ce291a..190ad0dfc101 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,50 @@
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_icon()
+ for(var/X in actions)
+ var/datum/action/A = X
+ if(A.button)
+ A.button.UpdateIcon()
-/mob/living/update_action_buttons()
- if(!hud_used) return
- if(!client) return
-
- if(hud_used.hud_shown != 1) //Hud toggled to minimal
+/mob/living/update_action_buttons(reload_screen)
+ if(!hud_used || !client)
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
+ if(hud_used.hud_shown != HUD_STYLE_STANDARD)
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
+ 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++
+ var/obj/screen/movable/action_button/B = A.button
+ B.UpdateIcon()
+ if(!B.moved)
+ B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
+ else
+ B.screen_loc = B.moved
+ if(reload_screen)
+ client.screen += B
- B.UpdateIcon()
+ if(!button_number)
+ hud_used.hide_actions_toggle.screen_loc = null
+ return
- 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)
+ 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
+
+
diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm
index 842842a37bfa..c977343e8ef6 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 7ddc810833cf..ea12c449a867 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/inventory.dm b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm
index 3efd4d48f153..a4368fd585a4 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 d5bec802eb68..31218b5e5aa6 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 8dbf0beae1bc..7351dcdb0643 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 dca7d56c4e36..cbb931974266 100644
--- a/code/modules/mob/living/simple_animal/slime/death.dm
+++ b/code/modules/mob/living/simple_animal/slime/death.dm
@@ -9,8 +9,6 @@
M.regenerate_icons()
is_adult = 0
maxHealth = 150
- var/datum/action/innate/slime/evolve/E = new
- E.Grant(src)
revive(full_heal = 1)
regenerate_icons()
number = rand(1, 1000)
diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm
index c0e0ead4f984..f5c892ab4260 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 4f838717b877..74a32d22cd66 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 eaea18ded6ab..7f908f28430e 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
diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm
index d8032f467bfc..4517dea695e0 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 aa308644e11c..85063e88e109 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -272,6 +272,13 @@ obj/item/weapon/gun/proc/newshot()
update_icon()
update_gunlight(user)
verbs += /obj/item/weapon/gun/proc/toggle_gunlight
+ action_button_name = "Toggle Gunlight"
+ if(loc == user)
+ if(!action)
+ action = new
+ action.name = action_button_name
+ action.target = src
+ action.Grant(user)
if(istype(A, /obj/item/weapon/screwdriver))
if(F)
@@ -283,6 +290,9 @@ obj/item/weapon/gun/proc/newshot()
S.update_brightness(user)
update_icon()
verbs -= /obj/item/weapon/gun/proc/toggle_gunlight
+ action_button_name = null
+ if(action && loc == user)
+ action.Remove(user)
if(unique_rename)
if(istype(A, /obj/item/weapon/pen))
@@ -311,7 +321,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 +333,16 @@ 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
+ if(action && action.button)
+ action.button.UpdateIcon()
+
/obj/item/weapon/gun/pickup(mob/user)
+ ..()
if(F)
if(F.on)
user.AddLuminosity(F.brightness_on)
@@ -340,6 +351,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 +438,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 +455,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 d6a54ffa0ea1..84549c8e09f8 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 681db297fc3c..4bd3852b935a 100644
--- a/code/modules/projectiles/guns/projectile/automatic.dm
+++ b/code/modules/projectiles/guns/projectile/automatic.dm
@@ -67,7 +67,8 @@
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
update_icon()
- return
+ if(action && action.button)
+ action.button.UpdateIcon()
/obj/item/weapon/gun/projectile/automatic/can_shoot()
return get_ammo()
diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm
index 58113e9ee7aa..72a3631cb3f3 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)
diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm
index b38d951b5c96..5b26cc14c336 100644
--- a/code/modules/spells/spell.dm
+++ b/code/modules/spells/spell.dm
@@ -169,9 +169,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.button)
+ action.button.UpdateIcon()
while(charge_counter < charge_max && isnull(gc_destroyed))
sleep(1)
charge_counter++
+ if(action && action.button)
+ action.button.UpdateIcon()
/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 189d37da3416..44ead63927fb 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/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm
index e1e4ac7a3d55..93ef30267aef 100644
--- a/code/modules/surgery/organs/organ_internal.dm
+++ b/code/modules/surgery/organs/organ_internal.dm
@@ -20,8 +20,11 @@
M.internal_organs |= src
loc = null
if(organ_action_name)
- action_button_name = organ_action_name
-
+ if(!action)
+ action = new/datum/action/item_action/organ_action
+ action.name = organ_action_name
+ action.target = src
+ action.Grant(src)
/obj/item/organ/internal/proc/Remove(mob/living/carbon/M, special = 0)
owner = null
@@ -29,9 +32,9 @@
M.internal_organs -= src
if(vital && !special)
M.death()
-
if(organ_action_name)
- action_button_name = null
+ if(action)
+ action.Remove(M)
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return