Action buttons will now only update when needed instead of every Life().

The action buttons now update their icon instantly.
Fixes versions of pickup(),equipped() and dropped not calling the parent.
Fixes drone not being able to remove a defib from their storage.
You can now cycle the mime mask by clicking it in your hand.
The action buttons for hardsuit and hooded suits now only appears when you're wearing the suit.
Created two mob helper procs getBeltSlot() and getBackSlot().
Created /datum/species/proc/on_species_loss() to handle stuff when our race change, currently only used by jelly and slime race to remove their exotic blood from our reagents and to remove slime people's action buttons.
This commit is contained in:
phil235
2016-02-22 00:34:59 +01:00
parent 24d17307a3
commit 91839f5f70
75 changed files with 428 additions and 386 deletions

View File

@@ -1,8 +1,7 @@
#define AB_CHECK_RESTRAINED 1 #define AB_CHECK_RESTRAINED 1
#define AB_CHECK_STUNNED 2 #define AB_CHECK_STUNNED 2
#define AB_CHECK_LYING 4 #define AB_CHECK_LYING 4
#define AB_CHECK_ALIVE 8 #define AB_CHECK_CONSCIOUS 8
#define AB_CHECK_INSIDE 16
/datum/action /datum/action
@@ -31,6 +30,13 @@
Remove(owner) Remove(owner)
owner = T owner = T
T.actions += src 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() T.update_action_buttons()
/datum/action/proc/Remove(mob/living/T) /datum/action/proc/Remove(mob/living/T)
@@ -44,37 +50,28 @@
owner = null owner = null
/datum/action/proc/Trigger() /datum/action/proc/Trigger()
if(!Checks()) if(!IsAvailable())
return 0 return 0
return 1 return 1
/datum/action/proc/Process() /datum/action/proc/Process()
return 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() /datum/action/proc/IsAvailable()
return Checks()
/datum/action/proc/Checks()// returns 1 if all checks pass
if(!owner) if(!owner)
return 0 return 0
if(check_flags & AB_CHECK_RESTRAINED) if(check_flags & AB_CHECK_RESTRAINED)
if(owner.restrained()) if(owner.restrained())
return 0 return 0
if(check_flags & AB_CHECK_STUNNED) if(check_flags & AB_CHECK_STUNNED)
if(owner.stunned) if(owner.stunned || owner.weakened)
return 0 return 0
if(check_flags & AB_CHECK_LYING) if(check_flags & AB_CHECK_LYING)
if(owner.lying) if(owner.lying)
return 0 return 0
if(check_flags & AB_CHECK_ALIVE) if(check_flags & AB_CHECK_CONSCIOUS)
if(owner.stat) if(owner.stat)
return 0 return 0
if(check_flags & AB_CHECK_INSIDE)
if(!(target in owner) && !(target.action_button_internal))
return 0
return 1 return 1
/datum/action/proc/UpdateName() /datum/action/proc/UpdateName()
@@ -90,8 +87,8 @@
current_button.overlays += img current_button.overlays += img
/obj/screen/movable/action_button /obj/screen/movable/action_button
var/datum/action/owner var/datum/action/linked_action
screen_loc = "WEST,NORTH" screen_loc = null
/obj/screen/movable/action_button/Click(location,control,params) /obj/screen/movable/action_button/Click(location,control,params)
var/list/modifiers = params2list(params) var/list/modifiers = params2list(params)
@@ -100,18 +97,18 @@
return 1 return 1
if(usr.next_move >= world.time) // Is this needed ? if(usr.next_move >= world.time) // Is this needed ?
return return
owner.Trigger() linked_action.Trigger()
return 1 return 1
/obj/screen/movable/action_button/proc/UpdateIcon() /obj/screen/movable/action_button/proc/UpdateIcon()
if(!owner) if(!linked_action)
return return
icon = owner.button_icon icon = linked_action.button_icon
icon_state = owner.background_icon_state 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) color = rgb(128,0,0,128)
else else
color = rgb(255,255,255,255) 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/ //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 return
#define AB_MAX_COLUMNS 10 #define AB_MAX_COLUMNS 10
@@ -191,7 +192,7 @@
//Presets for item actions //Presets for item actions
/datum/action/item_action /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() /datum/action/item_action/Trigger()
if(!..()) if(!..())
@@ -201,9 +202,6 @@
item.ui_action_click() item.ui_action_click()
return 1 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) /datum/action/item_action/ApplyIcon(obj/screen/movable/action_button/current_button)
current_button.overlays.Cut() current_button.overlays.Cut()
if(target) if(target)
@@ -214,17 +212,10 @@
I.layer = old I.layer = old
/datum/action/item_action/hands_free /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 /datum/action/item_action/organ_action
check_flags = AB_CHECK_ALIVE check_flags = AB_CHECK_CONSCIOUS
/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() /datum/action/item_action/organ_action/IsAvailable()
var/obj/item/organ/internal/I = target var/obj/item/organ/internal/I = target
@@ -246,8 +237,7 @@
return 1 return 1
/datum/action/spell_action/UpdateName() /datum/action/spell_action/UpdateName()
var/obj/effect/proc_holder/spell/spell = target return target.name
return spell.name
/datum/action/spell_action/IsAvailable() /datum/action/spell_action/IsAvailable()
if(!target) if(!target)
@@ -261,12 +251,6 @@
return spell.can_cast(owner) return spell.can_cast(owner)
return 1 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 //Preset for general and toggled actions
/datum/action/innate /datum/action/innate
check_flags = 0 check_flags = 0
@@ -304,7 +288,7 @@
/datum/action/innate/scan_mode /datum/action/innate/scan_mode
name = "Toggle Research Scanner" name = "Toggle Research Scanner"
button_icon_state = "scan_mode" 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 var/devices = 0 //How may enabled scanners the mob has
/datum/action/innate/scan_mode/Activate() /datum/action/innate/scan_mode/Activate()
@@ -320,11 +304,6 @@
/datum/action/innate/scan_mode/Grant(mob/living/T) /datum/action/innate/scan_mode/Grant(mob/living/T)
..(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) /datum/action/innate/scan_mode/Remove(mob/living/T)
owner.research_scanner = 0 owner.research_scanner = 0
active = 0 active = 0

View File

@@ -47,6 +47,8 @@
/datum/hud/New(mob/owner) /datum/hud/New(mob/owner)
mymob = owner mymob = owner
hide_actions_toggle = new
hide_actions_toggle.InitialiseIcon(mymob)
/datum/hud/Destroy() /datum/hud/Destroy()
if(mymob.hud_used == src) if(mymob.hud_used == src)
@@ -135,6 +137,8 @@
if(infodisplay.len) if(infodisplay.len)
mymob.client.screen += infodisplay mymob.client.screen += infodisplay
mymob.client.screen += hide_actions_toggle
if(action_intent) if(action_intent)
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position 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 hud_version = display_hud_version
persistant_inventory_update() persistant_inventory_update()
mymob.update_action_buttons() mymob.update_action_buttons(1)
reorganize_alerts() reorganize_alerts()
mymob.reload_fullscreen() mymob.reload_fullscreen()

View File

@@ -43,7 +43,7 @@
var/pix_Y = text2num(screen_loc_Y[2]) - 16 var/pix_Y = text2num(screen_loc_Y[2]) - 16
screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]" screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]"
moved = TRUE moved = screen_loc
//Debug procs //Debug procs

View File

@@ -174,9 +174,7 @@
/mob/living/carbon/set_species(datum/species/mrace = null, icon_update = 1) /mob/living/carbon/set_species(datum/species/mrace = null, icon_update = 1)
if(mrace && has_dna()) if(mrace && has_dna())
if(dna.species.exotic_blood) dna.species.on_species_loss(src)
var/datum/reagent/EB = dna.species.exotic_blood
reagents.del_reagent(initial(EB.id))
dna.species = new mrace() dna.species = new mrace()
/mob/living/carbon/human/set_species(datum/species/mrace, icon_update = 1) /mob/living/carbon/human/set_species(datum/species/mrace, icon_update = 1)

View File

@@ -248,14 +248,6 @@
/datum/action/innate/blob /datum/action/innate/blob
background_icon_state = "bg_alien" 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 /datum/action/innate/blob/earlyhelp
name = "Blob Help" name = "Blob Help"
button_icon_state = "blob" button_icon_state = "blob"

View File

@@ -27,6 +27,7 @@
..() ..()
/obj/item/weapon/melee/cultblade/pickup(mob/living/user) /obj/item/weapon/melee/cultblade/pickup(mob/living/user)
..()
if(!iscultist(user)) if(!iscultist(user))
user << "<span class='cultlarge'>\"I wouldn't advise that.\"</span>" user << "<span class='cultlarge'>\"I wouldn't advise that.\"</span>"
user << "<span class='warning'>An overwhelming sense of nausea overpowers you!</span>" user << "<span class='warning'>An overwhelming sense of nausea overpowers you!</span>"

View File

@@ -4,7 +4,7 @@
/datum/action/innate/godspeak /datum/action/innate/godspeak
name = "Godspeak" name = "Godspeak"
button_icon_state = "godspeak" button_icon_state = "godspeak"
check_flags = AB_CHECK_ALIVE check_flags = AB_CHECK_CONSCIOUS
var/mob/camera/god/god = null var/mob/camera/god/god = null
/datum/action/innate/godspeak/IsAvailable() /datum/action/innate/godspeak/IsAvailable()
@@ -19,3 +19,7 @@
return return
god << "<span class='notice'><B>[owner]:</B> [msg]</span>" god << "<span class='notice'><B>[owner]:</B> [msg]</span>"
owner << "You say: [msg]" owner << "You say: [msg]"
/datum/action/innate/godspeak/Destroy()
god = null
return ..()

View File

@@ -22,7 +22,7 @@
var/list/conduits = list() var/list/conduits = list()
var/prophets_sacrificed_in_name = 0 var/prophets_sacrificed_in_name = 0
var/image/ghostimage = null //For observer with darkness off visiblity var/image/ghostimage = null //For observer with darkness off visiblity
var/list/prophet_hats = list()
/mob/camera/god/New() /mob/camera/god/New()
..() ..()
@@ -51,6 +51,10 @@
for(var/datum/mind/F in followers) for(var/datum/mind/F in followers)
if(F.current) if(F.current)
F.current << "<span class='danger'>Your god is DEAD!</span>" F.current << "<span class='danger'>Your god is DEAD!</span>"
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 ghost_darkness_images -= ghostimage
updateallghostimages() updateallghostimages()
return ..() return ..()

View File

@@ -147,7 +147,12 @@
else else
speak2god = new() speak2god = new()
speak2god.god = G 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) /obj/item/clothing/head/helmet/plate/crusader/prophet/equipped(mob/user, slot)
if(slot == slot_head) if(slot == slot_head)

View File

@@ -14,7 +14,7 @@
origin_tech = "materials=5;biotech=4;powerstorage=5" origin_tech = "materials=5;biotech=4;powerstorage=5"
armor = list(melee = 15, bullet = 15, laser = 15, energy = 15, bomb = 15, bio = 15, rad = 15) armor = list(melee = 15, bullet = 15, laser = 15, energy = 15, bomb = 15, bio = 15, rad = 15)
action_button_name = "Activate" action_button_name = "Activate"
action_button_is_hands_free = 1 action_button_type = /datum/action/item_action/hands_free
var/mode = VEST_STEALTH var/mode = VEST_STEALTH
var/stealth_active = 0 var/stealth_active = 0
var/combat_cooldown = 10 var/combat_cooldown = 10
@@ -29,10 +29,6 @@
DeactivateStealth() DeactivateStealth()
armor = combat_armor armor = combat_armor
icon_state = "vest_combat" 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 if(VEST_COMBAT)// TO STEALTH
mode = VEST_STEALTH mode = VEST_STEALTH
armor = stealth_armor armor = stealth_armor
@@ -40,9 +36,12 @@
if(istype(loc, /mob/living/carbon/human)) if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc var/mob/living/carbon/human/H = loc
H.update_inv_wear_suit() H.update_inv_wear_suit()
return 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) /obj/item/clothing/suit/armor/abductor/vest/proc/SetDisguise(datum/icon_snapshot/entry)
disguise = entry disguise = entry

View File

@@ -169,9 +169,6 @@
return return
target.attack_animal(src) 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 //Spawn Event
/datum/round_event_control/morph /datum/round_event_control/morph

View File

@@ -79,7 +79,8 @@
name = "[initial(name)] ([cast_amount]E)" name = "[initial(name)] ([cast_amount]E)"
user.reveal(reveal) user.reveal(reveal)
user.stun(stun) user.stun(stun)
user.update_action_buttons() if(action && action.button)
action.button.UpdateIcon()
return 1 return 1
//Overload Light: Breaks a light that's online and sends out lightning bolts to all nearby people. //Overload Light: Breaks a light that's online and sends out lightning bolts to all nearby people.

View File

@@ -84,7 +84,7 @@
flash_protect = -1 flash_protect = -1
unacidable = 1 unacidable = 1
action_button_name = "Shift Nerves" 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/max_darkness_view = 8
var/min_darkness_view = 0 var/min_darkness_view = 0
flags = ABSTRACT | NODROP flags = ABSTRACT | NODROP

View File

@@ -14,6 +14,7 @@
usability = 1 usability = 1
/obj/item/device/soulstone/pickup(mob/living/user) /obj/item/device/soulstone/pickup(mob/living/user)
..()
if(!iscultist(user) && !iswizard(user) && !usability) if(!iscultist(user) && !iswizard(user) && !usability)
user << "<span class='danger'>An overwhelming feeling of dread comes over you as you pick up the soulstone. It would be wise to be rid of this quickly.</span>" user << "<span class='danger'>An overwhelming feeling of dread comes over you as you pick up the soulstone. It would be wise to be rid of this quickly.</span>"
user.Dizzy(120) user.Dizzy(120)

View File

@@ -1036,9 +1036,12 @@ var/year_integer = text2num(year) // = 2013???
/datum/action/innate/mecha /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 var/obj/mecha/chassis
/datum/action/innate/mecha/Destroy()
chassis = null
return ..()
/datum/action/innate/mecha/mech_eject /datum/action/innate/mecha/mech_eject
name = "Eject From Mech" name = "Eject From Mech"

View File

@@ -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. //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_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_type = null //if we want a special type of item action, not the standard one.
var/action_button_internal = 0 //If 1, bypass the inside check action buttons test for
var/datum/action/item_action/action = null 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. //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 return
/obj/item/proc/dropped(mob/user) /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) // called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user) /obj/item/proc/pickup(mob/user)
return 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. // 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) /obj/item/proc/on_exit_storage(obj/item/weapon/storage/S)
return 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 // for items that can be placed in multiple slots
// note this isn't called during the initial dressing of a player // note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(mob/user, slot) /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. //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. //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.

View File

@@ -91,12 +91,14 @@
/obj/item/candle/pickup(mob/user) /obj/item/candle/pickup(mob/user)
..()
if(lit) if(lit)
SetLuminosity(0) SetLuminosity(0)
user.AddLuminosity(CANDLE_LUMINOSITY) user.AddLuminosity(CANDLE_LUMINOSITY)
/obj/item/candle/dropped(mob/user) /obj/item/candle/dropped(mob/user)
..()
if(lit) if(lit)
user.AddLuminosity(-CANDLE_LUMINOSITY) user.AddLuminosity(-CANDLE_LUMINOSITY)
SetLuminosity(CANDLE_LUMINOSITY) SetLuminosity(CANDLE_LUMINOSITY)

View File

@@ -210,11 +210,13 @@ var/global/list/obj/item/device/pda/PDAs = list()
* The Actual PDA * The Actual PDA
*/ */
/obj/item/device/pda/pickup(mob/user) /obj/item/device/pda/pickup(mob/user)
..()
if(fon) if(fon)
SetLuminosity(0) SetLuminosity(0)
user.AddLuminosity(f_lum) user.AddLuminosity(f_lum)
/obj/item/device/pda/dropped(mob/user) /obj/item/device/pda/dropped(mob/user)
..()
if(fon) if(fon)
user.AddLuminosity(-f_lum) user.AddLuminosity(-f_lum)
SetLuminosity(f_lum) SetLuminosity(f_lum)

View File

@@ -19,6 +19,7 @@
saved_appearance = initial(butt.appearance) saved_appearance = initial(butt.appearance)
/obj/item/device/chameleon/dropped() /obj/item/device/chameleon/dropped()
..()
disrupt() disrupt()
/obj/item/device/chameleon/equipped() /obj/item/device/chameleon/equipped()

View File

@@ -41,6 +41,8 @@
return 0 return 0
on = !on on = !on
update_brightness(user) update_brightness(user)
if(action && action.button)
action.button.UpdateIcon()
return 1 return 1
@@ -84,12 +86,14 @@
/obj/item/device/flashlight/pickup(mob/user) /obj/item/device/flashlight/pickup(mob/user)
..()
if(on) if(on)
user.AddLuminosity(brightness_on) user.AddLuminosity(brightness_on)
SetLuminosity(0) SetLuminosity(0)
/obj/item/device/flashlight/dropped(mob/user) /obj/item/device/flashlight/dropped(mob/user)
..()
if(on) if(on)
user.AddLuminosity(-brightness_on) user.AddLuminosity(-brightness_on)
SetLuminosity(brightness_on) SetLuminosity(brightness_on)

View File

@@ -168,6 +168,10 @@ effective or pretty fucking useless.
Deactivate() Deactivate()
return 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) /obj/item/device/shadowcloak/proc/Activate(mob/living/carbon/human/user)
if(!user) if(!user)
return return
@@ -186,6 +190,7 @@ effective or pretty fucking useless.
user = null user = null
/obj/item/device/shadowcloak/dropped(mob/user) /obj/item/device/shadowcloak/dropped(mob/user)
..()
if(user && user.get_item_by_slot(slot_belt) != src) if(user && user.get_item_by_slot(slot_belt) != src)
Deactivate() Deactivate()

View File

@@ -236,7 +236,11 @@
cyborg = R cyborg = R
icon_state = "selfrepair_off" icon_state = "selfrepair_off"
action_button_name = "Toggle Self-Repair" action_button_name = "Toggle Self-Repair"
if(!action)
action = new
action.name = action_button_name
action.target = src
action.Grant(R)
return 1 return 1
/obj/item/borg/upgrade/selfrepair/ui_action_click() /obj/item/borg/upgrade/selfrepair/ui_action_click()
@@ -252,6 +256,8 @@
/obj/item/borg/upgrade/selfrepair/update_icon() /obj/item/borg/upgrade/selfrepair/update_icon()
if(cyborg) if(cyborg)
icon_state = "selfrepair_[on ? "on" : "off"]" icon_state = "selfrepair_[on ? "on" : "off"]"
if(action && action.button)
action.button.UpdateIcon()
else else
icon_state = "cyborg_upgrade5" icon_state = "cyborg_upgrade5"

View File

@@ -17,6 +17,7 @@
erased_minds += M erased_minds += M
/obj/item/weapon/chrono_eraser/dropped() /obj/item/weapon/chrono_eraser/dropped()
..()
if(PA) if(PA)
qdel(PA) qdel(PA)
@@ -33,7 +34,9 @@
PA = new(src) PA = new(src)
user.put_in_hands(PA) 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 /obj/item/weapon/gun/energy/chrono_gun
name = "T.E.D. Projection Apparatus" name = "T.E.D. Projection Apparatus"
@@ -59,6 +62,7 @@
qdel(src) qdel(src)
/obj/item/weapon/gun/energy/chrono_gun/dropped() /obj/item/weapon/gun/energy/chrono_gun/dropped()
..()
qdel(src) qdel(src)
/obj/item/weapon/gun/energy/chrono_gun/update_icon() /obj/item/weapon/gun/energy/chrono_gun/update_icon()

View File

@@ -541,6 +541,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return return
/obj/item/weapon/lighter/pickup(mob/user) /obj/item/weapon/lighter/pickup(mob/user)
..()
if(lit) if(lit)
SetLuminosity(0) SetLuminosity(0)
user.AddLuminosity(1) user.AddLuminosity(1)
@@ -548,6 +549,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/weapon/lighter/dropped(mob/user) /obj/item/weapon/lighter/dropped(mob/user)
..()
if(lit) if(lit)
if(user) if(user)
user.AddLuminosity(-1) user.AddLuminosity(-1)

View File

@@ -70,35 +70,40 @@
update_icon() update_icon()
/obj/item/weapon/defibrillator/ui_action_click() /obj/item/weapon/defibrillator/ui_action_click()
if(usr.get_item_by_slot(slot_back) == src)
toggle_paddles() toggle_paddles()
else
usr << "<span class='warning'>Put the defibrillator on your back first!</span>"
return
/obj/item/weapon/defibrillator/attack_hand(mob/user) /obj/item/weapon/defibrillator/attack_hand(mob/user)
if(src.loc == user) if(loc == user)
if(slot_flags == SLOT_BACK)
if(user.get_item_by_slot(slot_back) == src)
ui_action_click() ui_action_click()
else
user << "<span class='warning'>Put the defibrillator on your back first!</span>"
else if(slot_flags == SLOT_BELT)
if(user.get_item_by_slot(slot_belt) == src)
ui_action_click()
else
user << "<span class='warning'>Strap the defibrillator's belt on first!</span>"
return return
..() ..()
/obj/item/weapon/defibrillator/MouseDrop(obj/over_object) /obj/item/weapon/defibrillator/MouseDrop(obj/over_object)
if(ishuman(src.loc)) if(ismob(src.loc))
var/mob/living/carbon/human/H = src.loc var/mob/M = src.loc
switch(over_object.name) switch(over_object.name)
if("r_hand") if("r_hand")
if(H.r_hand) if(M.r_hand)
return return
if(!H.unEquip(src)) if(!M.unEquip(src))
return return
H.put_in_r_hand(src) M.put_in_r_hand(src)
if("l_hand") if("l_hand")
if(H.l_hand) if(M.l_hand)
return return
if(!H.unEquip(src)) if(!M.unEquip(src))
return
H.put_in_l_hand(src)
return return
M.put_in_l_hand(src)
/obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params) /obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params)
if(W == paddles) if(W == paddles)
@@ -172,16 +177,22 @@
remove_paddles(user) remove_paddles(user)
update_icon() update_icon()
return if(action && action.button)
action.button.UpdateIcon()
/obj/item/weapon/defibrillator/proc/make_paddles() /obj/item/weapon/defibrillator/proc/make_paddles()
return new /obj/item/weapon/twohanded/shockpaddles(src) return new /obj/item/weapon/twohanded/shockpaddles(src)
/obj/item/weapon/defibrillator/equipped(mob/user, slot) /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) remove_paddles(user)
update_icon() 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) /obj/item/weapon/defibrillator/proc/remove_paddles(mob/user)
var/mob/living/carbon/human/M = user var/mob/living/carbon/human/M = user
if(paddles in get_both_hands(M)) if(paddles in get_both_hands(M))
@@ -230,12 +241,9 @@
slot_flags = SLOT_BELT slot_flags = SLOT_BELT
origin_tech = "biotech=4" origin_tech = "biotech=4"
/obj/item/weapon/defibrillator/compact/ui_action_click() /obj/item/weapon/defibrillator/compact/item_action_slot_check(slot, mob/user)
if(usr.get_item_by_slot(slot_belt) == src) if(slot == user.getBeltSlot())
toggle_paddles() return 1
else
usr << "<span class='warning'>Strap the defibrillator's belt on first!</span>"
return
/obj/item/weapon/defibrillator/compact/loaded/New() /obj/item/weapon/defibrillator/compact/loaded/New()
..() ..()
@@ -322,7 +330,7 @@
if(!req_defib) if(!req_defib)
return ..() return ..()
if(user) 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)) if(istype(O))
O.unwield() O.unwield()
user << "<span class='notice'>The paddles snap back into the main unit.</span>" user << "<span class='notice'>The paddles snap back into the main unit.</span>"

View File

@@ -2,7 +2,6 @@
name = "implant" name = "implant"
icon = 'icons/obj/implants.dmi' icon = 'icons/obj/implants.dmi'
icon_state = "generic" //Shows up as the action button icon icon_state = "generic" //Shows up as the action button icon
action_button_is_hands_free = 1
origin_tech = "materials=2;biotech=3;programming=2" 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 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 else
return 0 return 0
if(activated)
action_button_name = "Activate [src.name]"
src.loc = source src.loc = source
imp_in = source imp_in = source
implanted = 1 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)) if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source var/mob/living/carbon/human/H = source
H.sec_hud_set_implants() H.sec_hud_set_implants()
@@ -59,7 +62,8 @@
src.loc = null src.loc = null
imp_in = null imp_in = null
implanted = 0 implanted = 0
if(action)
action.Remove(source)
if(istype(source, /mob/living/carbon/human)) if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source var/mob/living/carbon/human/H = source
H.sec_hud_set_implants() H.sec_hud_set_implants()
@@ -76,6 +80,7 @@
return "No information available" return "No information available"
/obj/item/weapon/implant/dropped(mob/user) /obj/item/weapon/implant/dropped(mob/user)
..()
. = 1 . = 1
qdel(src) qdel(src)
return .

View File

@@ -8,14 +8,13 @@
/obj/item/weapon/implant/freedom/activate() /obj/item/weapon/implant/freedom/activate()
if(uses == 0)
return 0
if(uses != -1)
uses-- uses--
imp_in << "You feel a faint click." imp_in << "You feel a faint click."
if(iscarbon(imp_in)) if(iscarbon(imp_in))
var/mob/living/carbon/C_imp_in = imp_in var/mob/living/carbon/C_imp_in = imp_in
C_imp_in.uncuff() C_imp_in.uncuff()
if(!uses)
qdel(src)
/obj/item/weapon/implant/freedom/get_data() /obj/item/weapon/implant/freedom/get_data()

View File

@@ -33,8 +33,6 @@
return dat return dat
/obj/item/weapon/implant/adrenalin/activate() /obj/item/weapon/implant/adrenalin/activate()
if(uses < 1)
return 0
uses-- uses--
imp_in << "<span class='notice'>You feel a sudden surge of energy!</span>" imp_in << "<span class='notice'>You feel a sudden surge of energy!</span>"
imp_in.SetStunned(0) imp_in.SetStunned(0)
@@ -47,6 +45,8 @@
imp_in.reagents.add_reagent("synaptizine", 10) imp_in.reagents.add_reagent("synaptizine", 10)
imp_in.reagents.add_reagent("omnizine", 10) imp_in.reagents.add_reagent("omnizine", 10)
imp_in.reagents.add_reagent("stimulants", 10) imp_in.reagents.add_reagent("stimulants", 10)
if(!uses)
qdel(src)
/obj/item/weapon/implant/emp /obj/item/weapon/implant/emp
@@ -57,7 +57,7 @@
uses = 2 uses = 2
/obj/item/weapon/implant/emp/activate() /obj/item/weapon/implant/emp/activate()
if (src.uses < 1) uses--
return 0
src.uses--
empulse(imp_in, 3, 5) empulse(imp_in, 3, 5)
if(!uses)
qdel(src)

View File

@@ -220,6 +220,7 @@
spark_system.attach(src) spark_system.attach(src)
/obj/item/weapon/melee/energy/blade/dropped() /obj/item/weapon/melee/energy/blade/dropped()
..()
qdel(src) qdel(src)
/obj/item/weapon/melee/energy/blade/attack_self(mob/user) /obj/item/weapon/melee/energy/blade/attack_self(mob/user)

View File

@@ -374,10 +374,6 @@
handle_item_insertion(W, 0 , user) handle_item_insertion(W, 0 , user)
return 1 return 1
/obj/item/weapon/storage/dropped(mob/user)
return
/obj/item/weapon/storage/attack_hand(mob/user) /obj/item/weapon/storage/attack_hand(mob/user)
playsound(loc, "rustle", 50, 1, -5) playsound(loc, "rustle", 50, 1, -5)

View File

@@ -2,7 +2,7 @@
name = "Jetpack Mode" name = "Jetpack Mode"
/datum/action/item_action/jetpack/cycle/Trigger() /datum/action/item_action/jetpack/cycle/Trigger()
if(!Checks()) if(!IsAvailable())
return return
var/obj/item/weapon/tank/jetpack/J = target var/obj/item/weapon/tank/jetpack/J = target
@@ -12,19 +12,6 @@
/datum/action/item_action/jetpack/cycle/suit /datum/action/item_action/jetpack/cycle/suit
name = "Internal Jetpack Mode" 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 /obj/item/weapon/tank/jetpack
name = "jetpack (empty)" name = "jetpack (empty)"
desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution." desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution."

View File

@@ -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 << "<span class='notice'>You close \the [target] valve.</span>"
C.update_internals_hud_icon(0)
else if(C.wear_mask && (C.wear_mask.flags & MASKINTERNALS))
C.internal = target
C << "<span class='notice'>You open \the [target] valve.</span>"
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 /obj/item/weapon/tank
name = "tank" name = "tank"
icon = 'icons/obj/tank.dmi' icon = 'icons/obj/tank.dmi'
flags = CONDUCT flags = CONDUCT
slot_flags = SLOT_BACK slot_flags = SLOT_BACK
hitsound = 'sound/weapons/smash.ogg' hitsound = 'sound/weapons/smash.ogg'
pressure_resistance = ONE_ATMOSPHERE * 5 pressure_resistance = ONE_ATMOSPHERE * 5
force = 5 force = 5
throwforce = 10 throwforce = 10
throw_speed = 1 throw_speed = 1
throw_range = 4 throw_range = 4
action_button_name = "Set Internals"
var/datum/gas_mixture/air_contents = null var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ONE_ATMOSPHERE var/distribute_pressure = ONE_ATMOSPHERE
var/integrity = 3 var/integrity = 3
var/volume = 70 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 << "<span class='warning'>You need a mask!</span>"
return
if(H.wear_mask.mask_adjusted)
H.wear_mask.adjustmask(H)
if(!(H.wear_mask.flags & MASKINTERNALS))
H << "<span class='warning'>[H.wear_mask] can't use [src]!</span>"
return
if(H.internal == src)
H.internal = null
H << "<span class='notice'>You close \the [src] valve.</span>"
H.update_internals_hud_icon(0)
else if(H.wear_mask && (H.wear_mask.flags & MASKINTERNALS))
H.internal = src
H << "<span class='notice'>You open \the [src] valve.</span>"
H.update_internals_hud_icon(1)
/obj/item/weapon/tank/New() /obj/item/weapon/tank/New()
..() ..()
@@ -52,8 +43,6 @@
air_contents = new(volume) //liters air_contents = new(volume) //liters
air_contents.temperature = T20C air_contents.temperature = T20C
internals_action = new(src)
SSobj.processing |= src SSobj.processing |= src
/obj/item/weapon/tank/Destroy() /obj/item/weapon/tank/Destroy()
@@ -63,14 +52,6 @@
SSobj.processing -= src SSobj.processing -= src
return ..() 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) /obj/item/weapon/tank/examine(mob/user)
var/obj/icon = src var/obj/icon = src
..() ..()

View File

@@ -22,10 +22,14 @@
/obj/item/weapon/watertank/ui_action_click() /obj/item/weapon/watertank/ui_action_click()
toggle_mister() 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() /obj/item/weapon/watertank/verb/toggle_mister()
set name = "Toggle Mister" set name = "Toggle Mister"
set category = "Object" set category = "Object"
if (usr.get_item_by_slot(usr.getWatertankSlot()) != src) if (usr.get_item_by_slot(usr.getBackSlot()) != src)
usr << "<span class='warning'>The watertank must be worn properly to use!</span>" usr << "<span class='warning'>The watertank must be worn properly to use!</span>"
return return
if(usr.incapacitated()) if(usr.incapacitated())
@@ -52,6 +56,7 @@
return new /obj/item/weapon/reagent_containers/spray/mister(src) return new /obj/item/weapon/reagent_containers/spray/mister(src)
/obj/item/weapon/watertank/equipped(mob/user, slot) /obj/item/weapon/watertank/equipped(mob/user, slot)
..()
if(slot != slot_back) if(slot != slot_back)
remove_noz() remove_noz()
@@ -75,22 +80,21 @@
..() ..()
/obj/item/weapon/watertank/MouseDrop(obj/over_object) /obj/item/weapon/watertank/MouseDrop(obj/over_object)
var/mob/H = src.loc var/mob/M = src.loc
if(istype(H)) if(istype(M))
switch(over_object.name) switch(over_object.name)
if("r_hand") if("r_hand")
if(H.r_hand) if(M.r_hand)
return return
if(!H.unEquip(src)) if(!M.unEquip(src))
return return
H.put_in_r_hand(src) M.put_in_r_hand(src)
if("l_hand") if("l_hand")
if(H.l_hand) if(M.l_hand)
return return
if(!H.unEquip(src)) if(!M.unEquip(src))
return
H.put_in_l_hand(src)
return return
M.put_in_l_hand(src)
/obj/item/weapon/watertank/attackby(obj/item/W, mob/user, params) /obj/item/weapon/watertank/attackby(obj/item/W, mob/user, params)
if(W == noz) if(W == noz)
@@ -98,12 +102,6 @@
return 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. // 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 // 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 // the watertank backpack. Allowing it to be placed elsewhere or created without a parent
@@ -131,6 +129,7 @@
return return
/obj/item/weapon/reagent_containers/spray/mister/dropped(mob/user) /obj/item/weapon/reagent_containers/spray/mister/dropped(mob/user)
..()
user << "<span class='notice'>The mister snaps back onto the watertank.</span>" user << "<span class='notice'>The mister snaps back onto the watertank.</span>"
tank.on = 0 tank.on = 0
loc = tank loc = tank
@@ -204,6 +203,7 @@
return new /obj/item/weapon/extinguisher/mini/nozzle(src) return new /obj/item/weapon/extinguisher/mini/nozzle(src)
/obj/item/weapon/watertank/atmos/dropped(mob/user) /obj/item/weapon/watertank/atmos/dropped(mob/user)
..()
icon_state = "waterbackpackatmos" icon_state = "waterbackpackatmos"
if(istype(noz, /obj/item/weapon/extinguisher/mini/nozzle)) if(istype(noz, /obj/item/weapon/extinguisher/mini/nozzle))
var/obj/item/weapon/extinguisher/mini/nozzle/N = noz var/obj/item/weapon/extinguisher/mini/nozzle/N = noz
@@ -261,6 +261,7 @@
return return
/obj/item/weapon/extinguisher/mini/nozzle/dropped(mob/user) /obj/item/weapon/extinguisher/mini/nozzle/dropped(mob/user)
..()
user << "<span class='notice'>The nozzle snaps back onto the tank!</span>" user << "<span class='notice'>The nozzle snaps back onto the tank!</span>"
tank.on = 0 tank.on = 0
loc = tank loc = tank
@@ -354,6 +355,10 @@
/obj/item/weapon/reagent_containers/chemtank/ui_action_click() /obj/item/weapon/reagent_containers/chemtank/ui_action_click()
toggle_injection() 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() /obj/item/weapon/reagent_containers/chemtank/proc/toggle_injection()
var/mob/living/carbon/human/user = usr var/mob/living/carbon/human/user = usr
if(!istype(user)) if(!istype(user))

View File

@@ -87,6 +87,7 @@
return ..() return ..()
/obj/item/weapon/twohanded/dropped(mob/user) /obj/item/weapon/twohanded/dropped(mob/user)
..()
//handles unwielding a twohanded weapon when dropped as well as clearing up the offhand //handles unwielding a twohanded weapon when dropped as well as clearing up the offhand
if(user) if(user)
var/obj/item/weapon/twohanded/O = user.get_inactive_hand() var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
@@ -411,6 +412,8 @@
if(src == user.get_active_hand()) //update inhands if(src == user.get_active_hand()) //update inhands
user.update_inv_l_hand() user.update_inv_l_hand()
user.update_inv_r_hand() user.update_inv_r_hand()
if(action && action.button)
action.button.UpdateIcon()
//GREY TIDE //GREY TIDE

View File

@@ -273,6 +273,7 @@
hitsound = "sound/weapons/chainsawhit.ogg" hitsound = "sound/weapons/chainsawhit.ogg"
/obj/item/weapon/mounted_chainsaw/dropped() /obj/item/weapon/mounted_chainsaw/dropped()
..()
new /obj/item/weapon/twohanded/required/chainsaw(get_turf(src)) new /obj/item/weapon/twohanded/required/chainsaw(get_turf(src))
qdel(src) qdel(src)

View File

@@ -78,6 +78,7 @@
handle_move(get_turf(loc)) handle_move(get_turf(loc))
/obj/item/device/assembly/prox_sensor/dropped() /obj/item/device/assembly/prox_sensor/dropped()
..()
if(scanning) if(scanning)
spawn(0) spawn(0)
sense() sense()

View File

@@ -62,6 +62,7 @@
SSobj.processing.Remove(src) SSobj.processing.Remove(src)
/obj/item/weapon/twohanded/required/ctf/dropped(mob/user) /obj/item/weapon/twohanded/required/ctf/dropped(mob/user)
..()
reset_cooldown = world.time + 200 //20 seconds reset_cooldown = world.time + 200 //20 seconds
SSobj.processing |= src SSobj.processing |= src
for(var/mob/M in player_list) for(var/mob/M in player_list)

View File

@@ -516,6 +516,8 @@ BLIND // can't see anything
if(istype(usr, /mob/living/carbon)) if(istype(usr, /mob/living/carbon))
var/mob/living/carbon/C = usr var/mob/living/carbon/C = usr
C.head_update(src, forced = 1) C.head_update(src, forced = 1)
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/proc/can_use(mob/user) /obj/item/clothing/proc/can_use(mob/user)
if(user && ismob(user)) if(user && ismob(user))

View File

@@ -10,10 +10,7 @@
var/invis_objects = list() var/invis_objects = list()
var/range = 1 var/range = 1
/obj/item/clothing/glasses/meson/engine/attack_self() /obj/item/clothing/glasses/meson/engine/attack_self(mob/user)
ui_action_click()
/obj/item/clothing/glasses/meson/engine/ui_action_click()
mode = !mode mode = !mode
if(mode) if(mode)
@@ -21,7 +18,7 @@
vision_flags = 0 vision_flags = 0
darkness_view = 2 darkness_view = 2
invis_view = SEE_INVISIBLE_LIVING invis_view = SEE_INVISIBLE_LIVING
loc << "<span class='notice'>You toggle the goggles' scanning mode to \[T-Ray].</span>" user << "<span class='notice'>You toggle the goggles' scanning mode to \[T-Ray].</span>"
else else
SSobj.processing.Remove(src) SSobj.processing.Remove(src)
vision_flags = SEE_TURFS vision_flags = SEE_TURFS
@@ -30,11 +27,14 @@
loc << "<span class='notice'>You toggle the goggles' scanning mode to \[Meson].</span>" loc << "<span class='notice'>You toggle the goggles' scanning mode to \[Meson].</span>"
invis_update() invis_update()
if(istype(loc,/mob/living/carbon)) if(ishuman(user))
var/mob/living/carbon/C = loc var/mob/living/carbon/human/H = user
C.update_sight() if(H.glasses == src)
H.update_sight()
update_icon() update_icon()
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/glasses/meson/engine/process() /obj/item/clothing/glasses/meson/engine/process()
if(!mode) if(!mode)
@@ -115,18 +115,20 @@
if(user.glasses == src) if(user.glasses == src)
user.update_inv_glasses() 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 on = !on
if(on) if(on)
SSobj.processing |= src SSobj.processing |= src
loc << "<span class='notice'>You turn the goggles on.</span>" user << "<span class='notice'>You turn the goggles on.</span>"
else else
SSobj.processing.Remove(src) SSobj.processing.Remove(src)
loc << "<span class='notice'>You turn the goggles off.</span>" user << "<span class='notice'>You turn the goggles off.</span>"
invis_update() invis_update()
update_icon() update_icon()
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/glasses/meson/engine/tray/t_ray_on() /obj/item/clothing/glasses/meson/engine/tray/t_ray_on()
return on && ..() return on && ..()

View File

@@ -11,6 +11,7 @@
H.add_hud_to(user) H.add_hud_to(user)
/obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user) /obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user)
..()
if(hud_type && istype(user) && user.glasses == src) if(hud_type && istype(user) && user.glasses == src)
var/datum/atom_hud/H = huds[hud_type] var/datum/atom_hud/H = huds[hud_type]
H.remove_hud_from(user) H.remove_hud_from(user)

View File

@@ -24,13 +24,17 @@
turn_on(user) turn_on(user)
else else
turn_off(user) turn_off(user)
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/head/hardhat/pickup(mob/user) /obj/item/clothing/head/hardhat/pickup(mob/user)
..()
if(on) if(on)
user.AddLuminosity(brightness_on) user.AddLuminosity(brightness_on)
SetLuminosity(0) SetLuminosity(0)
/obj/item/clothing/head/hardhat/dropped(mob/user) /obj/item/clothing/head/hardhat/dropped(mob/user)
..()
if(on) if(on)
user.AddLuminosity(-brightness_on) user.AddLuminosity(-brightness_on)
SetLuminosity(brightness_on) SetLuminosity(brightness_on)

View File

@@ -229,6 +229,13 @@
update_icon() update_icon()
update_helmlight(user) update_helmlight(user)
verbs += /obj/item/clothing/head/helmet/proc/toggle_helmlight 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 return
if(istype(A, /obj/item/weapon/screwdriver)) if(istype(A, /obj/item/weapon/screwdriver))
@@ -242,10 +249,12 @@
update_icon() update_icon()
usr.update_inv_head() usr.update_inv_head()
verbs -= /obj/item/clothing/head/helmet/proc/toggle_helmlight verbs -= /obj/item/clothing/head/helmet/proc/toggle_helmlight
action_button_name = null
if(action && loc == user)
action.Remove(user)
return return
..() ..()
return
/obj/item/clothing/head/helmet/proc/toggle_helmlight() /obj/item/clothing/head/helmet/proc/toggle_helmlight()
set name = "Toggle Helmetlight" set name = "Toggle Helmetlight"
@@ -269,7 +278,6 @@
/obj/item/clothing/head/helmet/proc/update_helmlight(mob/user = null) /obj/item/clothing/head/helmet/proc/update_helmlight(mob/user = null)
if(F) if(F)
action_button_name = "Toggle Helmetlight"
if(F.on) if(F.on)
if(loc == user) if(loc == user)
user.AddLuminosity(F.brightness_on) user.AddLuminosity(F.brightness_on)
@@ -281,15 +289,18 @@
else if(isturf(loc)) else if(isturf(loc))
SetLuminosity(0) SetLuminosity(0)
update_icon() update_icon()
else else
action_button_name = null
if(loc == user) if(loc == user)
user.AddLuminosity(-5) user.AddLuminosity(-5)
else if(isturf(loc)) else if(isturf(loc))
SetLuminosity(0) SetLuminosity(0)
return action_button_name = null
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/head/helmet/pickup(mob/user) /obj/item/clothing/head/helmet/pickup(mob/user)
..()
if(F) if(F)
if(F.on) if(F.on)
user.AddLuminosity(F.brightness_on) user.AddLuminosity(F.brightness_on)
@@ -297,6 +308,7 @@
/obj/item/clothing/head/helmet/dropped(mob/user) /obj/item/clothing/head/helmet/dropped(mob/user)
..()
if(F) if(F)
if(F.on) if(F.on)
user.AddLuminosity(-F.brightness_on) user.AddLuminosity(-F.brightness_on)

View File

@@ -111,12 +111,9 @@
burn_state = FLAMMABLE burn_state = FLAMMABLE
action_button_name = "Adjust Mask" 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) 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) /obj/item/clothing/mask/gas/mime/proc/cycle_mask(mob/user)
switch(icon_state) switch(icon_state)
if("mime") if("mime")

View File

@@ -72,3 +72,5 @@
else else
icon_state = "clown_prototype_off" icon_state = "clown_prototype_off"
usr.update_inv_shoes() usr.update_inv_shoes()
if(action && action.button)
action.button.UpdateIcon()

View File

@@ -331,16 +331,13 @@
/datum/action/innate/chrono_teleport /datum/action/innate/chrono_teleport
name = "Teleport Now" name = "Teleport Now"
button_icon_state = "chrono_phase" 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 var/obj/item/clothing/suit/space/chronos/chronosuit = null
/datum/action/innate/chrono_teleport/IsAvailable() /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() /datum/action/innate/chrono_teleport/Activate()
if(IsAvailable()) if(IsAvailable())
if(chronosuit.camera) if(chronosuit.camera)
chronosuit.chronowalk(chronosuit.camera) chronosuit.chronowalk(chronosuit.camera)
/datum/action/innate/chrono_teleport/CheckRemoval()
return (..() && !(chronosuit && chronosuit.activated && chronosuit.camera))

View File

@@ -25,21 +25,30 @@
user.AddLuminosity(brightness_on) user.AddLuminosity(brightness_on)
else else
user.AddLuminosity(-brightness_on) user.AddLuminosity(-brightness_on)
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/head/helmet/space/hardsuit/pickup(mob/user) /obj/item/clothing/head/helmet/space/hardsuit/pickup(mob/user)
..()
if(on) if(on)
user.AddLuminosity(brightness_on) user.AddLuminosity(brightness_on)
SetLuminosity(0) SetLuminosity(0)
/obj/item/clothing/head/helmet/space/hardsuit/dropped(mob/user) /obj/item/clothing/head/helmet/space/hardsuit/dropped(mob/user)
..()
if(on) if(on)
user.AddLuminosity(-brightness_on) user.AddLuminosity(-brightness_on)
SetLuminosity(brightness_on) SetLuminosity(brightness_on)
if(suit) if(suit)
suit.RemoveHelmet() 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) /obj/item/clothing/head/helmet/space/hardsuit/equipped(mob/user, slot)
..()
if(slot != slot_head) if(slot != slot_head)
if(suit) if(suit)
suit.RemoveHelmet() suit.RemoveHelmet()
@@ -75,7 +84,8 @@
/obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot) /obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot)
..() ..()
if(slot == slot_wear_suit && jetpack) if(jetpack)
if(slot == slot_wear_suit)
jetpack.cycle_action.Grant(user) jetpack.cycle_action.Grant(user)
/obj/item/clothing/suit/space/hardsuit/dropped(mob/user) /obj/item/clothing/suit/space/hardsuit/dropped(mob/user)
@@ -83,6 +93,10 @@
if(jetpack) if(jetpack)
jetpack.cycle_action.Remove(user) 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 //Engineering
/obj/item/clothing/head/helmet/space/hardsuit/engine /obj/item/clothing/head/helmet/space/hardsuit/engine
name = "engineering hardsuit helmet" name = "engineering hardsuit helmet"

View File

@@ -20,6 +20,10 @@
/obj/item/clothing/suit/hooded/ui_action_click() /obj/item/clothing/suit/hooded/ui_action_click()
ToggleHood() 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) /obj/item/clothing/suit/hooded/equipped(mob/user, slot)
if(slot != slot_wear_suit) if(slot != slot_wear_suit)
RemoveHood() RemoveHood()
@@ -33,8 +37,11 @@
H.unEquip(hood, 1) H.unEquip(hood, 1)
H.update_inv_wear_suit() H.update_inv_wear_suit()
hood.loc = src hood.loc = src
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/suit/hooded/dropped() /obj/item/clothing/suit/hooded/dropped()
..()
RemoveHood() RemoveHood()
/obj/item/clothing/suit/hooded/proc/ToggleHood() /obj/item/clothing/suit/hooded/proc/ToggleHood()
@@ -52,6 +59,8 @@
suittoggled = 1 suittoggled = 1
src.icon_state = "[initial(icon_state)]_t" src.icon_state = "[initial(icon_state)]_t"
H.update_inv_wear_suit() H.update_inv_wear_suit()
if(action && action.button)
action.button.UpdateIcon()
else else
RemoveHood() RemoveHood()
@@ -84,6 +93,8 @@
src.icon_state = "[initial(icon_state)]_t" src.icon_state = "[initial(icon_state)]_t"
src.suittoggled = 1 src.suittoggled = 1
usr.update_inv_wear_suit() usr.update_inv_wear_suit()
if(action && action.button)
action.button.UpdateIcon()
/obj/item/clothing/suit/toggle/examine(mob/user) /obj/item/clothing/suit/toggle/examine(mob/user)
..() ..()
@@ -140,6 +151,7 @@
helmet.loc = src helmet.loc = src
/obj/item/clothing/suit/space/hardsuit/dropped() /obj/item/clothing/suit/space/hardsuit/dropped()
..()
RemoveHelmet() RemoveHelmet()
/obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet() /obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet()

View File

@@ -308,10 +308,12 @@
return ..() return ..()
/obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/pickup(mob/user) /obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/pickup(mob/user)
..()
src.SetLuminosity(0) src.SetLuminosity(0)
user.AddLuminosity(round(potency / 5,1)) user.AddLuminosity(round(potency / 5,1))
/obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/dropped(mob/user) /obj/item/weapon/reagent_containers/food/snacks/grown/berries/glow/dropped(mob/user)
..()
user.AddLuminosity(round(-potency / 5,1)) user.AddLuminosity(round(-potency / 5,1))
src.SetLuminosity(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 ..() return ..()
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user)
..()
SetLuminosity(0) SetLuminosity(0)
user.AddLuminosity(round(potency / 10,1)) user.AddLuminosity(round(potency / 10,1))
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user)
..()
user.AddLuminosity(round(-potency / 10,1)) user.AddLuminosity(round(-potency / 10,1))
SetLuminosity(round(potency / 10,1)) SetLuminosity(round(potency / 10,1))

View File

@@ -158,6 +158,7 @@
qdel(src) qdel(src)
/obj/item/weapon/grown/novaflower/pickup(mob/living/carbon/human/user) /obj/item/weapon/grown/novaflower/pickup(mob/living/carbon/human/user)
..()
if(!user.gloves) if(!user.gloves)
user << "<span class='danger'>The [name] burns your bare hand!</span>" user << "<span class='danger'>The [name] burns your bare hand!</span>"
user.adjustFireLoss(rand(1, 5)) user.adjustFireLoss(rand(1, 5))
@@ -184,6 +185,7 @@
return (BRUTELOSS|TOXLOSS) return (BRUTELOSS|TOXLOSS)
/obj/item/weapon/grown/nettle/pickup(mob/living/user) /obj/item/weapon/grown/nettle/pickup(mob/living/user)
..()
if(!iscarbon(user)) if(!iscarbon(user))
return 0 return 0
var/mob/living/carbon/C = user var/mob/living/carbon/C = user

View File

@@ -264,3 +264,10 @@
var/obj/item/I = get_active_hand() var/obj/item/I = get_active_hand()
if (I) if (I)
I.equip_to_best_slot(src) 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

View File

@@ -7,10 +7,6 @@ Doesn't work on other aliens/AI.*/
/datum/action/spell_action/alien /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() /datum/action/spell_action/alien/IsAvailable()
if(!target) if(!target)
return 0 return 0
@@ -23,16 +19,6 @@ Doesn't work on other aliens/AI.*/
return ab.cost_check(ab.check_turf,owner,1) return ab.cost_check(ab.check_turf,owner,1)
return 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 /obj/effect/proc_holder/alien
name = "Alien Power" name = "Alien Power"
@@ -319,6 +305,11 @@ Doesn't work on other aliens/AI.*/
if(!vessel) return 0 if(!vessel) return 0
vessel.storedPlasma = max(vessel.storedPlasma + amount,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 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 return 1
/mob/living/carbon/alien/adjustPlasma(amount) /mob/living/carbon/alien/adjustPlasma(amount)

View File

@@ -789,6 +789,7 @@ var/const/GALOSHES_DONT_HELP = 4
throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed) throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
else else
clear_alert("handcuffed") clear_alert("handcuffed")
update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed.
update_inv_handcuffed() update_inv_handcuffed()
update_hud_handcuffed() update_hud_handcuffed()

View File

@@ -88,6 +88,8 @@
wear_suit = I wear_suit = I
if(I.flags_inv & HIDEJUMPSUIT) if(I.flags_inv & HIDEJUMPSUIT)
update_inv_w_uniform() 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() update_inv_wear_suit()
if(slot_w_uniform) if(slot_w_uniform)
w_uniform = I w_uniform = I
@@ -113,6 +115,8 @@
if(I == wear_suit) if(I == wear_suit)
if(s_store) if(s_store)
unEquip(s_store, 1) //It makes no sense for your suit storage to stay on you if you drop your suit. 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 wear_suit = null
if(I.flags_inv & HIDEJUMPSUIT) if(I.flags_inv & HIDEJUMPSUIT)
update_inv_w_uniform() update_inv_w_uniform()

View File

@@ -119,6 +119,12 @@
return 0 return 0
return 1 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) /datum/species/proc/update_base_icon_state(mob/living/carbon/human/H)
if(H.disabilities & HUSK) if(H.disabilities & HUSK)
H.remove_overlay(SPECIES_LAYER) // races lose their color H.remove_overlay(SPECIES_LAYER) // races lose their color

View File

@@ -240,11 +240,23 @@ var/regex/lizard_hiSS = new("S+", "g")
burnmod = 0.5 burnmod = 0.5
coldmod = 2 coldmod = 2
heatmod = 0.5 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) /datum/species/jelly/slime/spec_life(mob/living/carbon/human/H)
if(recently_changed) if(recently_changed)
var/datum/action/innate/split_body/S = new slime_split = new
S.Grant(H) slime_split.Grant(H)
for(var/datum/reagent/toxin/slimejelly/S in H.reagents.reagent_list) for(var/datum/reagent/toxin/slimejelly/S in H.reagents.reagent_list)
if(S.volume >= 200) if(S.volume >= 200)
@@ -259,16 +271,10 @@ var/regex/lizard_hiSS = new("S+", "g")
/datum/action/innate/split_body /datum/action/innate/split_body
name = "Split Body" name = "Split Body"
check_flags = AB_CHECK_ALIVE check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "slimesplit" button_icon_state = "slimesplit"
background_icon_state = "bg_alien" 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() /datum/action/innate/split_body/Activate()
var/mob/living/carbon/human/H = owner var/mob/living/carbon/human/H = owner
H << "<span class='notice'>You focus intently on moving your body while standing perfectly still...</span>" H << "<span class='notice'>You focus intently on moving your body while standing perfectly still...</span>"
@@ -286,12 +292,13 @@ var/regex/lizard_hiSS = new("S+", "g")
spare.Move(get_step(H.loc, pick(NORTH,SOUTH,EAST,WEST))) spare.Move(get_step(H.loc, pick(NORTH,SOUTH,EAST,WEST)))
S.volume = 80 S.volume = 80
H.notransform = 0 H.notransform = 0
var/datum/action/innate/swap_body/callforward = new /datum/action/innate/swap_body() var/datum/species/jelly/slime/SS = H.dna.species
var/datum/action/innate/swap_body/callback = new /datum/action/innate/swap_body() SS.callforward = new
callforward.body = spare SS.callforward.body = spare
callforward.Grant(H) SS.callforward.Grant(H)
callback.body = H SS.callback = new
callback.Grant(spare) SS.callback.body = H
SS.callback.Grant(spare)
H.mind.transfer_to(spare) H.mind.transfer_to(spare)
spare << "<span class='notice'>...and after a moment of disorentation, you're besides yourself!</span>" spare << "<span class='notice'>...and after a moment of disorentation, you're besides yourself!</span>"
return return
@@ -301,17 +308,11 @@ var/regex/lizard_hiSS = new("S+", "g")
/datum/action/innate/swap_body /datum/action/innate/swap_body
name = "Swap Body" name = "Swap Body"
check_flags = AB_CHECK_ALIVE check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "slimeswap" button_icon_state = "slimeswap"
background_icon_state = "bg_alien" background_icon_state = "bg_alien"
var/mob/living/carbon/human/body 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() /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)) if(!body || !istype(body) || !body.dna || !body.dna.species || body.dna.species.id != "slime" || body.stat == DEAD || qdeleted(body))
owner << "<span class='warning'>Something is wrong, you cannot sense your other body!</span>" owner << "<span class='warning'>Something is wrong, you cannot sense your other body!</span>"

View File

@@ -387,9 +387,3 @@
if(360.15 to INFINITY) //360.15 is 310.15 + 50, the temperature where you start to feel effects. 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...~ //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 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)

View File

@@ -52,6 +52,7 @@
blind_eyes(1) blind_eyes(1)
reset_perspective(null) reset_perspective(null)
hide_fullscreens() hide_fullscreens()
update_action_buttons_icon()
update_damage_hud() update_damage_hud()
update_health_hud() update_health_hud()
update_canmove() update_canmove()

View File

@@ -49,10 +49,6 @@
handle_disabilities() // eye, ear, brain damages handle_disabilities() // eye, ear, brain damages
handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc
handle_actions()
handle_regular_hud_updates()
/mob/living/proc/handle_breathing() /mob/living/proc/handle_breathing()
@@ -117,92 +113,50 @@
if(ear_damage < 100) if(ear_damage < 100)
adjustEarDamage(-0.05,-1) 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() /mob/living/proc/update_damage_hud()
return return
//this handles hud updates. /mob/living/update_action_buttons_icon()
/mob/living/proc/handle_regular_hud_updates() for(var/X in actions)
if(!client) var/datum/action/A = X
return 0 if(A.button)
update_action_buttons() A.button.UpdateIcon()
return 1
/mob/living/update_action_buttons() /mob/living/update_action_buttons(reload_screen)
if(!hud_used) return if(!hud_used || !client)
if(!client) return
if(hud_used.hud_shown != 1) //Hud toggled to minimal
return return
client.screen -= hud_used.hide_actions_toggle if(hud_used.hud_shown != HUD_STYLE_STANDARD)
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 return
var/button_number = 0 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) for(var/datum/action/A in actions)
button_number++ 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 var/obj/screen/movable/action_button/B = A.button
B.UpdateIcon() B.UpdateIcon()
B.name = A.UpdateName()
client.screen += B
if(!B.moved) if(!B.moved)
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number) B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
//hud_used.SetButtonCoords(B,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(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) if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1) hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,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 client.screen += hud_used.hide_actions_toggle

View File

@@ -6,8 +6,6 @@
update_gravity(mob_has_gravity()) update_gravity(mob_has_gravity())
update_action_buttons()
if(malfhack) if(malfhack)
if(malfhack.aidisabled) if(malfhack.aidisabled)
src << "<span class='danger'>ERROR: APC access disabled, hack attempt canceled.</span>" src << "<span class='danger'>ERROR: APC access disabled, hack attempt canceled.</span>"

View File

@@ -6,7 +6,7 @@
return return
..() ..()
handle_robot_hud_updates()
handle_robot_cell() handle_robot_cell()
/mob/living/silicon/robot/proc/handle_robot_cell() /mob/living/silicon/robot/proc/handle_robot_cell()
@@ -30,7 +30,7 @@
update_headlamp() update_headlamp()
diag_hud_set_borgcell() diag_hud_set_borgcell()
/mob/living/silicon/robot/handle_regular_hud_updates() /mob/living/silicon/robot/proc/handle_robot_hud_updates()
if(!client) if(!client)
return return
@@ -49,8 +49,7 @@
if(!mind.special_role) if(!mind.special_role)
mind.special_role = "traitor" mind.special_role = "traitor"
ticker.mode.traitors += mind ticker.mode.traitors += mind
..()
return 1
/mob/living/silicon/robot/update_health_hud() /mob/living/silicon/robot/update_health_hud()
if(!client || !hud_used) if(!client || !hud_used)
@@ -117,4 +116,5 @@
else else
canmove = 1 canmove = 1
update_transform() update_transform()
update_action_buttons_icon()
return canmove return canmove

View File

@@ -115,3 +115,9 @@
/mob/living/simple_animal/drone/stripPanelEquip(obj/item/what, mob/who, where) /mob/living/simple_animal/drone/stripPanelEquip(obj/item/what, mob/who, where)
..(what, who, where, 1) ..(what, who, where, 1)
/mob/living/simple_animal/drone/getBackSlot()
return slot_drone_storage
/mob/living/simple_animal/drone/getBeltSlot()
return slot_drone_storage

View File

@@ -586,6 +586,7 @@
return return
/obj/item/weapon/guardian_bomb/pickup(mob/living/user) /obj/item/weapon/guardian_bomb/pickup(mob/living/user)
..()
detonate(user) detonate(user)
return return

View File

@@ -535,6 +535,7 @@
else else
canmove = 1 canmove = 1
update_transform() update_transform()
update_action_buttons_icon()
return canmove return canmove
/mob/living/simple_animal/update_transform() /mob/living/simple_animal/update_transform()

View File

@@ -9,8 +9,6 @@
M.regenerate_icons() M.regenerate_icons()
is_adult = 0 is_adult = 0
maxHealth = 150 maxHealth = 150
var/datum/action/innate/slime/evolve/E = new
E.Grant(src)
revive(full_heal = 1) revive(full_heal = 1)
regenerate_icons() regenerate_icons()
number = rand(1, 1000) number = rand(1, 1000)

View File

@@ -230,6 +230,7 @@
else if (nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD) else if (nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD)
nutrition -= 20 nutrition -= 20
amount_grown++ amount_grown++
update_action_buttons_icon()
if(amount_grown >= SLIME_EVOLUTION_THRESHOLD && !buckled && !Target && !ckey) if(amount_grown >= SLIME_EVOLUTION_THRESHOLD && !buckled && !Target && !ckey)
if(is_adult) if(is_adult)

View File

@@ -6,22 +6,10 @@
#define GROWTH_NEEDED 1 #define GROWTH_NEEDED 1
/datum/action/innate/slime /datum/action/innate/slime
check_flags = AB_CHECK_ALIVE check_flags = AB_CHECK_CONSCIOUS
background_icon_state = "bg_alien" background_icon_state = "bg_alien"
var/adult_action = SIZE_DOESNT_MATTER
var/needs_growth = NO_GROWTH_NEEDED 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() /datum/action/innate/slime/IsAvailable()
if(..()) if(..())
var/mob/living/simple_animal/slime/S = owner var/mob/living/simple_animal/slime/S = owner
@@ -120,6 +108,8 @@
is_adult = 1 is_adult = 1
maxHealth = 200 maxHealth = 200
amount_grown = 0 amount_grown = 0
for(var/datum/action/innate/slime/evolve/E in actions)
E.Remove(src)
regenerate_icons() regenerate_icons()
name = text("[colour] [is_adult ? "adult" : "baby"] slime ([number])") name = text("[colour] [is_adult ? "adult" : "baby"] slime ([number])")
else else
@@ -130,7 +120,6 @@
/datum/action/innate/slime/evolve /datum/action/innate/slime/evolve
name = "Evolve" name = "Evolve"
button_icon_state = "slimegrow" button_icon_state = "slimegrow"
adult_action = BABIES_ONLY
needs_growth = GROWTH_NEEDED needs_growth = GROWTH_NEEDED
/datum/action/innate/slime/evolve/Activate() /datum/action/innate/slime/evolve/Activate()
@@ -191,7 +180,6 @@
/datum/action/innate/slime/reproduce /datum/action/innate/slime/reproduce
name = "Reproduce" name = "Reproduce"
button_icon_state = "slimesplit" button_icon_state = "slimesplit"
adult_action = ADULTS_ONLY
needs_growth = GROWTH_NEEDED needs_growth = GROWTH_NEEDED
/datum/action/innate/slime/reproduce/Activate() /datum/action/innate/slime/reproduce/Activate()

View File

@@ -708,6 +708,7 @@ var/next_mob_id = 0
if(layer == MOB_LAYER - 0.2) if(layer == MOB_LAYER - 0.2)
layer = initial(layer) layer = initial(layer)
update_transform() update_transform()
update_action_buttons_icon()
lying_prev = lying lying_prev = lying
return canmove return canmove

View File

@@ -211,6 +211,7 @@
add_logs(user, affecting, "attempted to put", src, "into [M]") add_logs(user, affecting, "attempted to put", src, "into [M]")
/obj/item/weapon/grab/dropped() /obj/item/weapon/grab/dropped()
..()
qdel(src) qdel(src)
#undef UPGRADE_COOLDOWN #undef UPGRADE_COOLDOWN

View File

@@ -272,6 +272,13 @@ obj/item/weapon/gun/proc/newshot()
update_icon() update_icon()
update_gunlight(user) update_gunlight(user)
verbs += /obj/item/weapon/gun/proc/toggle_gunlight 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(istype(A, /obj/item/weapon/screwdriver))
if(F) if(F)
@@ -283,6 +290,9 @@ obj/item/weapon/gun/proc/newshot()
S.update_brightness(user) S.update_brightness(user)
update_icon() update_icon()
verbs -= /obj/item/weapon/gun/proc/toggle_gunlight verbs -= /obj/item/weapon/gun/proc/toggle_gunlight
action_button_name = null
if(action && loc == user)
action.Remove(user)
if(unique_rename) if(unique_rename)
if(istype(A, /obj/item/weapon/pen)) 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) /obj/item/weapon/gun/proc/update_gunlight(mob/user = null)
if(F) if(F)
action_button_name = "Toggle Gunlight"
if(F.on) if(F.on)
if(loc == user) if(loc == user)
user.AddLuminosity(F.brightness_on) user.AddLuminosity(F.brightness_on)
@@ -324,14 +333,16 @@ obj/item/weapon/gun/proc/newshot()
SetLuminosity(0) SetLuminosity(0)
update_icon() update_icon()
else else
action_button_name = null
if(loc == user) if(loc == user)
user.AddLuminosity(-5) user.AddLuminosity(-5)
else if(isturf(loc)) else if(isturf(loc))
SetLuminosity(0) SetLuminosity(0)
return if(action && action.button)
action.button.UpdateIcon()
/obj/item/weapon/gun/pickup(mob/user) /obj/item/weapon/gun/pickup(mob/user)
..()
if(F) if(F)
if(F.on) if(F.on)
user.AddLuminosity(F.brightness_on) user.AddLuminosity(F.brightness_on)
@@ -340,6 +351,7 @@ obj/item/weapon/gun/proc/newshot()
azoom.Grant(user) azoom.Grant(user)
/obj/item/weapon/gun/dropped(mob/user) /obj/item/weapon/gun/dropped(mob/user)
..()
if(F) if(F)
if(F.on) if(F.on)
user.AddLuminosity(-F.brightness_on) user.AddLuminosity(-F.brightness_on)
@@ -426,7 +438,7 @@ obj/item/weapon/gun/proc/newshot()
/datum/action/toggle_scope_zoom /datum/action/toggle_scope_zoom
name = "Toggle Scope" 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" button_icon_state = "sniper_zoom"
var/obj/item/weapon/gun/gun = null 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) /obj/item/weapon/gun/proc/zoom(mob/living/user, forced_zoom)
if(!user || !user.client) if(!user || !user.client)
return return

View File

@@ -10,6 +10,7 @@
can_flashlight = 0 can_flashlight = 0
/obj/item/weapon/gun/energy/gun/advtaser/mounted/dropped()//if somebody manages to drop this somehow... /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. 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 /obj/item/weapon/gun/energy/laser/mounted
@@ -25,4 +26,5 @@
materials = null materials = null
/obj/item/weapon/gun/energy/laser/mounted/dropped() /obj/item/weapon/gun/energy/laser/mounted/dropped()
..()
src.loc = null src.loc = null

View File

@@ -67,7 +67,8 @@
playsound(user, 'sound/weapons/empty.ogg', 100, 1) playsound(user, 'sound/weapons/empty.ogg', 100, 1)
update_icon() update_icon()
return if(action && action.button)
action.button.UpdateIcon()
/obj/item/weapon/gun/projectile/automatic/can_shoot() /obj/item/weapon/gun/projectile/automatic/can_shoot()
return get_ammo() return get_ammo()

View File

@@ -134,6 +134,7 @@
pump() pump()
/obj/item/weapon/gun/projectile/shotgun/boltaction/enchanted/dropped() /obj/item/weapon/gun/projectile/shotgun/boltaction/enchanted/dropped()
..()
guns_left = 0 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) /obj/item/weapon/gun/projectile/shotgun/boltaction/enchanted/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1)

View File

@@ -169,9 +169,13 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
return return
/obj/effect/proc_holder/spell/proc/start_recharge() /obj/effect/proc_holder/spell/proc/start_recharge()
if(action && action.button)
action.button.UpdateIcon()
while(charge_counter < charge_max && isnull(gc_destroyed)) while(charge_counter < charge_max && isnull(gc_destroyed))
sleep(1) sleep(1)
charge_counter++ 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 /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) before_cast(targets)

View File

@@ -31,12 +31,13 @@
name = "Activate Pill" name = "Activate Pill"
/datum/action/item_action/hands_free/activate_pill/Trigger() /datum/action/item_action/hands_free/activate_pill/Trigger()
if(!..() || CheckRemoval(owner)) if(!..())
return 0 return 0
owner << "<span class='caution'>You grit your teeth and burst the implanted [target]!</span>" owner << "<span class='caution'>You grit your teeth and burst the implanted [target]!</span>"
add_logs(owner, null, "swallowed an implanted pill", target) add_logs(owner, null, "swallowed an implanted pill", target)
if(target.reagents.total_volume) if(target.reagents.total_volume)
target.reagents.reaction(owner, INGEST) target.reagents.reaction(owner, INGEST)
target.reagents.trans_to(owner, target.reagents.total_volume) target.reagents.trans_to(owner, target.reagents.total_volume)
Remove(owner)
qdel(target) qdel(target)
return 1 return 1

View File

@@ -20,8 +20,11 @@
M.internal_organs |= src M.internal_organs |= src
loc = null loc = null
if(organ_action_name) 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) /obj/item/organ/internal/proc/Remove(mob/living/carbon/M, special = 0)
owner = null owner = null
@@ -29,9 +32,9 @@
M.internal_organs -= src M.internal_organs -= src
if(vital && !special) if(vital && !special)
M.death() M.death()
if(organ_action_name) if(organ_action_name)
action_button_name = null if(action)
action.Remove(M)
/obj/item/organ/internal/proc/on_find(mob/living/finder) /obj/item/organ/internal/proc/on_find(mob/living/finder)
return return