Refactored the item's action system. Items can now hold multiple actions.

The "set internals" button of tank items now turn green when it's used as internals.
Removed research scanner from drones (since cyborgs don't have it, it's more consistent)
Removed the ignore_madkadjust mask var.
The sechailer mask now has an adjust mask action button, so I removed the adjust verb that it was using.
The item's action are now created on item/New() instead of trying to create it every time someone picks the item up.
I split hud/action.dm, the datum/action stuff is now in the datum folder (/datum/action.dm), whereas the code for action buttons is kept in the hud folder under action_button.dm. Also I moved some /datum/action code that was in some files back into datum/action.dm where it belongs.
This commit is contained in:
phil235
2016-02-23 19:37:42 +01:00
parent 91839f5f70
commit 0ec876d9fe
64 changed files with 850 additions and 776 deletions
+29 -28
View File
@@ -116,7 +116,6 @@ BLIND // can't see anything
strip_delay = 40
put_on_delay = 40
var/mask_adjusted = 0
var/ignore_maskadjust = 1
var/adjusted_flags = null
@@ -132,31 +131,32 @@ BLIND // can't see anything
//Proc that moves gas/breath masks out of the way, disabling them and allowing pill/food consumption
/obj/item/clothing/mask/proc/adjustmask(mob/living/user)
if(!ignore_maskadjust)
if(user.incapacitated())
return
if(mask_adjusted == 1)
src.icon_state = initial(icon_state)
gas_transfer_coefficient = initial(gas_transfer_coefficient)
permeability_coefficient = initial(permeability_coefficient)
flags |= visor_flags
flags_inv |= visor_flags_inv
flags_cover = initial(flags_cover)
user << "<span class='notice'>You push \the [src] back into place.</span>"
src.mask_adjusted = 0
slot_flags = initial(slot_flags)
else
icon_state += "_up"
user << "<span class='notice'>You push \the [src] out of the way.</span>"
gas_transfer_coefficient = null
permeability_coefficient = null
flags &= ~visor_flags
flags_inv &= ~visor_flags_inv
flags_cover &= 0
src.mask_adjusted = 1
if(adjusted_flags)
slot_flags = adjusted_flags
user.wear_mask_update(src, unequip = 0)
if(user.incapacitated())
return
mask_adjusted = !mask_adjusted
if(!mask_adjusted)
src.icon_state = initial(icon_state)
gas_transfer_coefficient = initial(gas_transfer_coefficient)
permeability_coefficient = initial(permeability_coefficient)
flags |= visor_flags
flags_inv |= visor_flags_inv
flags_cover = initial(flags_cover)
user << "<span class='notice'>You push \the [src] back into place.</span>"
slot_flags = initial(slot_flags)
else
icon_state += "_up"
user << "<span class='notice'>You push \the [src] out of the way.</span>"
gas_transfer_coefficient = null
permeability_coefficient = null
flags &= ~visor_flags
flags_inv &= ~visor_flags_inv
flags_cover &= 0
if(adjusted_flags)
slot_flags = adjusted_flags
user.wear_mask_update(src, toggle_off = mask_adjusted)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
@@ -516,8 +516,9 @@ BLIND // can't see anything
if(istype(usr, /mob/living/carbon))
var/mob/living/carbon/C = usr
C.head_update(src, forced = 1)
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/proc/can_use(mob/user)
if(user && ismob(user))
@@ -4,7 +4,7 @@
name = "Engineering Scanner Goggles"
desc = "Goggles used by engineers. The Meson Scanner mode lets you see basic structural and terrain layouts through walls, regardless of lighting condition. The T-ray Scanner mode lets you see underfloor objects such as cables and pipes."
icon_state = "trayson-meson"
action_button_name = "Change Scanning Mode"
actions_types = list(/datum/action/item_action/toggle_mode)
var/mode = 0 //0 - regular mesons mode 1 - t-ray mode
var/invis_objects = list()
@@ -33,8 +33,9 @@
H.update_sight()
update_icon()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/glasses/meson/engine/process()
if(!mode)
@@ -94,7 +95,6 @@
name = "Optical T-Ray Scanner"
desc = "Used by engineering staff to see underfloor objects such as cables and pipes."
icon_state = "trayson-tray_off"
action_button_name = "Toggle Scanner Power"
mode = 1
var/on = 0
@@ -127,8 +127,9 @@
invis_update()
update_icon()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/glasses/meson/engine/tray/t_ray_on()
return on && ..()
+4 -9
View File
@@ -50,16 +50,11 @@
item_state = "glasses"
origin_tech = "magnets=2;engineering=2"
scan_reagents = 1 //You can see reagents while wearing science goggles
actions_types = list(/datum/action/item_action/toggle_research_scanner)
/obj/item/clothing/glasses/science/equipped(mob/user, slot)
/obj/item/clothing/glasses/science/item_action_slot_check(slot)
if(slot == slot_glasses)
user.scanner.devices += 1
user.scanner.Grant(user)
..(user, slot)
/obj/item/clothing/glasses/science/dropped(mob/user)
user.scanner.devices = max(0, user.scanner.devices - 1)
..()
return 1
/obj/item/clothing/glasses/night
name = "Night Vision Goggles"
@@ -170,7 +165,7 @@
desc = "Protects the eyes from welders; approved by the mad scientist association."
icon_state = "welding-g"
item_state = "welding-g"
action_button_name = "Toggle Welding Goggles"
actions_types = list(/datum/action/item_action/toggle)
materials = list(MAT_METAL = 250)
flash_protect = 2
tint = 2
+1 -1
View File
@@ -114,7 +114,7 @@
/obj/item/clothing/glasses/hud/toggle
name = "Toggle Hud"
desc = "A hud with multiple functions."
action_button_name = "Switch HUD"
actions_types = list(/datum/action/item_action/switch_hud)
/obj/item/clothing/glasses/hud/toggle/attack_self(mob/user)
if(!ishuman(user))
+4 -3
View File
@@ -8,7 +8,7 @@
item_color = "yellow" //Determines used sprites: hardhat[on]_[item_color] and hardhat[on]_[item_color]2 (lying down sprite)
armor = list(melee = 15, bullet = 5, laser = 20,energy = 10, bomb = 20, bio = 10, rad = 20)
flags_inv = 0
action_button_name = "Toggle Helmet Light"
actions_types = list(/datum/action/item_action/toggle_helmet_light)
burn_state = FIRE_PROOF
/obj/item/clothing/head/hardhat/attack_self(mob/user)
@@ -24,8 +24,9 @@
turn_on(user)
else
turn_off(user)
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/head/hardhat/pickup(mob/user)
..()
+20 -24
View File
@@ -43,7 +43,7 @@
armor = list(melee = 41, bullet = 15, laser = 5,energy = 5, bomb = 5, bio = 2, rad = 0)
flags_inv = HIDEMASK|HIDEEARS|HIDEFACE
strip_delay = 80
action_button_name = "Toggle Helmet Visor"
actions_types = list(/datum/action/item_action/toggle)
visor_flags_inv = HIDEMASK|HIDEFACE
toggle_cooldown = 0
flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH
@@ -75,7 +75,7 @@
icon_state = "justice"
toggle_message = "You turn off the lights on"
alt_toggle_message = "You turn on the lights on"
action_button_name = "Toggle Justice Lights"
actions_types = list(/datum/action/item_action/toggle_helmet_light)
can_toggle = 1
toggle_cooldown = 20
active_sound = 'sound/items/WEEOO1.ogg'
@@ -86,7 +86,6 @@
icon_state = "justice2"
toggle_message = "You turn off the light on"
alt_toggle_message = "You turn on the light on"
action_button_name = "Toggle Alarm Lights"
/obj/item/clothing/head/helmet/swat
name = "\improper SWAT helmet"
@@ -210,35 +209,33 @@
return
/obj/item/clothing/head/helmet/ui_action_click()
toggle_helmlight()
..()
/obj/item/clothing/head/helmet/ui_action_click(mob/user, actiontype)
if(actiontype == /datum/action/item_action/toggle_helmet_flashlight)
toggle_helmlight()
else
..()
/obj/item/clothing/head/helmet/attackby(obj/item/A, mob/user, params)
if(istype(A, /obj/item/device/flashlight/seclite))
var/obj/item/device/flashlight/seclite/S = A
/obj/item/clothing/head/helmet/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/device/flashlight/seclite))
var/obj/item/device/flashlight/seclite/S = I
if(can_flashlight)
if(!F)
if(!user.unEquip(A))
if(!user.unEquip(S))
return
user << "<span class='notice'>You click [S] into place on [src].</span>"
if(S.on)
SetLuminosity(0)
F = S
A.loc = src
S.loc = src
update_icon()
update_helmlight(user)
verbs += /obj/item/clothing/head/helmet/proc/toggle_helmlight
action_button_name = "Toggle Helmetlight"
var/datum/action/A = new /datum/action/item_action/toggle_helmet_flashlight(src)
if(loc == user)
if(!action)
action = new
action.name = action_button_name
action.target = src
action.Grant(user)
A.Grant(user)
return
if(istype(A, /obj/item/weapon/screwdriver))
if(istype(I, /obj/item/weapon/screwdriver))
if(F)
for(var/obj/item/device/flashlight/seclite/S in src)
user << "<span class='notice'>You unscrew the seclite from [src].</span>"
@@ -249,9 +246,8 @@
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)
for(var/datum/action/item_action/toggle_helmet_flashlight/THL in actions)
qdel(THL)
return
..()
@@ -295,9 +291,9 @@
user.AddLuminosity(-5)
else if(isturf(loc))
SetLuminosity(0)
action_button_name = null
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/head/helmet/pickup(mob/user)
..()
+1 -4
View File
@@ -23,7 +23,7 @@
tint = 2
armor = list(melee = 10, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
action_button_name = "Toggle Welding Helmet"
actions_types = list(/datum/action/item_action/toggle)
visor_flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
burn_state = FIRE_PROOF
@@ -49,7 +49,6 @@
item_state = "hardhat0_cakehat"
item_color = "cakehat"
flags_inv = HIDEEARS|HIDEHAIR
action_button_name = "Toggle Candle"
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
brightness_on = 2 //luminosity when on
flags_cover = HEADCOVERSEYES
@@ -116,7 +115,6 @@
item_state = "hardhat0_pumpkin"
item_color = "pumpkin"
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR
action_button_name = "Toggle Pumpkin Light"
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
brightness_on = 2 //luminosity when on
flags_cover = HEADCOVERSEYES
@@ -147,6 +145,5 @@
item_state = "hardhat0_reindeer"
item_color = "reindeer"
flags_inv = 0
action_button_name = "Toggle Nose Light"
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
brightness_on = 1 //luminosity when on
+1 -2
View File
@@ -6,8 +6,7 @@
flags_inv = HIDEFACE|HIDEHAIR|HIDEFACIALHAIR
visor_flags_inv = HIDEFACE|HIDEFACIALHAIR
w_class = 2
action_button_name = "Adjust Balaclava"
ignore_maskadjust = 0
actions_types = list(/datum/action/item_action/adjust)
/obj/item/clothing/mask/balaclava/attack_self(mob/user)
adjustmask(user)
+1 -2
View File
@@ -9,8 +9,7 @@
w_class = 2
gas_transfer_coefficient = 0.10
permeability_coefficient = 0.50
action_button_name = "Adjust Breath Mask"
ignore_maskadjust = 0
actions_types = list(/datum/action/item_action/adjust)
flags_cover = MASKCOVERSMOUTH
burn_state = FIRE_PROOF
+3 -3
View File
@@ -22,7 +22,7 @@
tint = 2
armor = list(melee = 10, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
origin_tech = "materials=2;engineering=2"
action_button_name = "Toggle Welding Mask"
actions_types = list(/datum/action/item_action/toggle)
flags_inv = HIDEEARS|HIDEEYES|HIDEFACE
flags_cover = MASKCOVERSEYES
visor_flags_inv = HIDEEYES
@@ -60,7 +60,7 @@
var/voice = "Unknown"
var/vchange = 0//This didn't do anything before. It now checks if the mask has special functions/N
origin_tech = "syndicate=4"
action_button_name = "Toggle mask"
actions_types = list(/datum/action/item_action/toggle)
/obj/item/clothing/mask/gas/voice/attack_self(mob/user)
vchange = !vchange
@@ -109,7 +109,7 @@
item_state = "mime"
flags_cover = MASKCOVERSEYES
burn_state = FLAMMABLE
action_button_name = "Adjust Mask"
actions_types = list(/datum/action/item_action/adjust)
/obj/item/clothing/mask/gas/mime/attack_self(mob/user)
cycle_mask(usr)
+8 -13
View File
@@ -4,9 +4,8 @@
/obj/item/clothing/mask/gas/sechailer
name = "security gas mask"
desc = "A standard issue Security gas mask with integrated 'Compli-o-nator 3000' device. Plays over a dozen pre-recorded compliance phrases designed to get scumbags to stand still whilst you taze them. Do not tamper with the device."
action_button_name = "HALT!"
actions_types = list(/datum/action/item_action/halt, /datum/action/item_action/adjust)
icon_state = "sechailer"
ignore_maskadjust = 0
flags = BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS
flags_inv = HIDEFACIALHAIR|HIDEFACE
w_class = 2
@@ -21,10 +20,9 @@
/obj/item/clothing/mask/gas/sechailer/swat
name = "\improper SWAT mask"
desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000."
action_button_name = "HALT!"
actions_types = list(/datum/action/item_action/halt)
icon_state = "swat"
aggressiveness = 3
ignore_maskadjust = 1
flags_inv = HIDEFACIALHAIR|HIDEFACE|HIDEEYES|HIDEEARS
visor_flags_inv = 0
@@ -34,11 +32,7 @@
icon = 'icons/obj/device.dmi'
icon_state = "taperecorder_idle"
aggressiveness = 1 //Borgs are nicecurity!
ignore_maskadjust = 1
/obj/item/clothing/mask/gas/sechailer/cyborg/New()
..()
verbs -= /obj/item/clothing/mask/gas/sechailer/verb/adjust
actions_types = list(/datum/action/item_action/halt)
/obj/item/clothing/mask/gas/sechailer/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/screwdriver))
@@ -61,10 +55,11 @@
else
..()
/obj/item/clothing/mask/gas/sechailer/verb/adjust()
set category = "Object"
set name = "Adjust Mask"
adjustmask(usr)
/obj/item/clothing/mask/gas/sechailer/ui_action_click(mob/user, actiontype)
if(actiontype == /datum/action/item_action/halt)
halt()
else
adjustmask(user)
/obj/item/clothing/mask/gas/sechailer/attack_self()
halt()
+2 -4
View File
@@ -28,8 +28,7 @@
gas_transfer_coefficient = 0.90
permeability_coefficient = 0.01
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 25, rad = 0)
action_button_name = "Adjust Sterile Mask"
ignore_maskadjust = 0
actions_types = list(/datum/action/item_action/adjust)
/obj/item/clothing/mask/surgical/attack_self(mob/user)
adjustmask(user)
@@ -47,7 +46,7 @@
item_state = "pig"
flags_inv = HIDEFACE|HIDEHAIR|HIDEFACIALHAIR
w_class = 2
action_button_name = "Toggle Voice Box"
actions_types = list(/datum/action/item_action/toggle_voice_box)
var/voicechange = 0
/obj/item/clothing/mask/pig/attack_self(mob/user)
@@ -110,7 +109,6 @@
flags_inv = HIDEFACE|HIDEFACIALHAIR
visor_flags_inv = HIDEFACE|HIDEFACIALHAIR
slot_flags = SLOT_MASK
ignore_maskadjust = 0
adjusted_flags = SLOT_HEAD
icon_state = "bandbotany"
+7 -6
View File
@@ -6,7 +6,7 @@
icon_state = "clown_prototype_off"
var/on = 0
var/datum/material_container/bananium
action_button_name = "Toggle Shoes"
actions_types = list(/datum/action/item_action/toggle)
/obj/item/clothing/shoes/clown_shoes/banana_shoes/New()
..()
@@ -58,13 +58,13 @@
var/ban_amt = bananium.amount(MAT_BANANIUM)
user << "<span class='notice'>The shoes are [on ? "enabled" : "disabled"]. There is [ban_amt ? ban_amt : "no"] bananium left.</span>"
/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click()
/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click(mob/user)
if(bananium.amount(MAT_BANANIUM))
on = !on
update_icon()
loc << "<span class='notice'>You [on ? "activate" : "deactivate"] the prototype shoes.</span>"
user << "<span class='notice'>You [on ? "activate" : "deactivate"] the prototype shoes.</span>"
else
loc << "<span class='warning'>You need bananium to turn the prototype shoes on!</span>"
user << "<span class='warning'>You need bananium to turn the prototype shoes on!</span>"
/obj/item/clothing/shoes/clown_shoes/banana_shoes/update_icon()
if(on)
@@ -72,5 +72,6 @@
else
icon_state = "clown_prototype_off"
usr.update_inv_shoes()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
+1 -1
View File
@@ -5,7 +5,7 @@
var/magboot_state = "magboots"
var/magpulse = 0
var/slowdown_active = 2
action_button_name = "Toggle Magboots"
actions_types = list(/datum/action/item_action/toggle)
strip_delay = 70
put_on_delay = 70
burn_state = FIRE_PROOF
@@ -22,7 +22,7 @@
desc = "An advanced spacesuit equipped with teleportation and anti-compression technology"
icon_state = "chronosuit"
item_state = "chronosuit"
action_button_name = "Toggle Chronosuit"
actions_types = list(/datum/action/item_action/toggle)
armor = list(melee = 60, bullet = 60, laser = 60, energy = 60, bomb = 30, bio = 90, rad = 90)
var/list/chronosafe_items = list(/obj/item/weapon/chrono_eraser, /obj/item/weapon/gun/energy/chrono_gun)
var/hands_nodrop_states
@@ -93,8 +93,7 @@
if(camera)
camera.remove_target_ui()
camera.loc = user
if(teleport_now.button)
teleport_now.button.UpdateIcon()
teleport_now.UpdateButtonIcon()
/obj/item/clothing/suit/space/chronos/proc/chronowalk(atom/location)
var/mob/living/carbon/human/user = src.loc
@@ -108,8 +107,7 @@
if(camera)
camera.remove_target_ui()
if(teleport_now.button)
teleport_now.button.UpdateIcon()
teleport_now.UpdateButtonIcon()
var/list/nonsafe_slots = list(slot_belt, slot_back, slot_l_hand, slot_r_hand)
for(var/slot in nonsafe_slots)
+18 -13
View File
@@ -10,7 +10,7 @@
var/on = 0
var/obj/item/clothing/suit/space/hardsuit/suit
item_color = "engineering" //Determines used sprites: hardsuit[on]-[color] and hardsuit[on]-[color]2 (lying down sprite)
action_button_name = "Toggle Helmet Light"
actions_types = list(/datum/action/item_action/toggle_helmet_light)
/obj/item/clothing/head/helmet/space/hardsuit/attack_self(mob/user)
@@ -25,8 +25,9 @@
user.AddLuminosity(brightness_on)
else
user.AddLuminosity(-brightness_on)
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/head/helmet/space/hardsuit/pickup(mob/user)
@@ -78,7 +79,7 @@
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/internals,/obj/item/device/t_scanner, /obj/item/weapon/rcd, /obj/item/weapon/pipe_dispenser)
siemens_coefficient = 0
var/obj/item/clothing/head/helmet/space/hardsuit/helmet
action_button_name = "Toggle Helmet"
actions_types = list(/datum/action/item_action/toggle_helmet)
var/helmettype = /obj/item/clothing/head/helmet/space/hardsuit
var/obj/item/weapon/tank/jetpack/suit/jetpack = null
@@ -86,12 +87,16 @@
..()
if(jetpack)
if(slot == slot_wear_suit)
jetpack.cycle_action.Grant(user)
for(var/X in jetpack.actions)
var/datum/action/A = X
A.Grant(user)
/obj/item/clothing/suit/space/hardsuit/dropped(mob/user)
..()
if(jetpack)
jetpack.cycle_action.Remove(user)
for(var/X in jetpack.actions)
var/datum/action/A = X
A.Remove(user)
/obj/item/clothing/suit/space/hardsuit/item_action_slot_check(slot)
if(slot == slot_wear_suit) //we only give the mob the ability to toggle the helmet if he's wearing the hardsuit.
@@ -198,7 +203,7 @@
armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50)
on = 1
var/obj/item/clothing/suit/space/hardsuit/syndi/linkedsuit = null
action_button_name = "Toggle Helmet Mode"
actions_types = list(/datum/action/item_action/toggle_helmet_mode)
visor_flags_inv = HIDEMASK|HIDEEYES|HIDEFACE|HIDEFACIALHAIR
visor_flags = STOPSPRESSUREDMAGE
@@ -240,6 +245,9 @@
if(istype(user, /mob/living/carbon))
var/mob/living/carbon/C = user
C.head_update(src, forced = 1)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/head/helmet/space/hardsuit/syndi/proc/toggle_hardsuit_mode(mob/user) //Helmet Toggles Suit Mode
if(linkedsuit)
@@ -270,7 +278,6 @@
item_state = "syndie_hardsuit"
item_color = "syndi"
w_class = 3
action_button_name = "Toggle Helmet"
armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50)
allowed = list(/obj/item/weapon/gun,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/melee/energy/sword/saber,/obj/item/weapon/restraints/handcuffs,/obj/item/weapon/tank/internals)
helmettype = /obj/item/clothing/head/helmet/space/hardsuit/syndi
@@ -387,15 +394,14 @@
armor = list(melee = 30, bullet = 5, laser = 10, energy = 5, bomb = 100, bio = 100, rad = 60)
var/obj/machinery/doppler_array/integrated/bomb_radar
scan_reagents = 1
actions_types = list(/datum/action/item_action/toggle_helmet_light, /datum/action/item_action/toggle_research_scanner)
/obj/item/clothing/head/helmet/space/hardsuit/rd/New()
..()
bomb_radar = new /obj/machinery/doppler_array/integrated(src)
/obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/living/carbon/human/user, slot)
..(user, slot)
user.scanner.Grant(user)
user.scanner.devices += 1
..()
if(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic))
user << ("<span class='warning'>Your [user.glasses] prevents you using [src]'s diagnostic visor HUD.</span>")
else
@@ -404,8 +410,7 @@
DHUD.add_hud_to(user)
/obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/living/carbon/human/user)
..(user)
user.scanner.devices = max(0, user.scanner.devices - 1)
..()
if(onboard_hud_enabled && !(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic)))
var/datum/atom_hud/DHUD = huds[DATA_HUD_DIAGNOSTIC]
DHUD.remove_hud_from(user)
@@ -44,7 +44,7 @@ Contains:
strip_delay = 130
max_heat_protection_temperature = FIRE_IMMUNITY_HELM_MAX_TEMP_PROTECT
unacidable = 1
action_button_name = null
actions_types = list()
/obj/item/clothing/head/helmet/space/hardsuit/deathsquad/attack_self(mob/user)
return
@@ -262,7 +262,7 @@ Contains:
item_state = "syndicate"
armor = list(melee = -20, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 100, rad = 75) //As whimpy as a space carp
brightness_on = 0 //luminosity when on
action_button_name = ""
actions_types = list()
flags = STOPSPRESSUREDMAGE | THICKMATERIAL | NODROP
@@ -284,7 +284,7 @@ Contains:
item_state = "hardsuit0-prt"
item_color = "knight_grey"
max_heat_protection_temperature = FIRE_IMMUNITY_HELM_MAX_TEMP_PROTECT
action_button_name = null
actions_types = list()
/obj/item/clothing/suit/space/hardsuit/ert/paranormal
name = "paranormal response team suit"
+1 -1
View File
@@ -131,7 +131,7 @@
item_state = "reactiveoff"
blood_overlay_type = "armor"
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
action_button_name = "Toggle Armor"
actions_types = list(/datum/action/item_action/toggle)
unacidable = 1
hit_reaction_chance = 50
-1
View File
@@ -31,7 +31,6 @@
body_parts_covered = CHEST|GROIN|LEGS|ARMS
allowed = list(/obj/item/weapon/storage/book/bible, /obj/item/weapon/nullrod, /obj/item/weapon/reagent_containers/food/drinks/bottle/holywater, /obj/item/weapon/storage/fancy/candle_box, /obj/item/candle, /obj/item/weapon/tank/internals/emergency_oxygen)
hooded = 1
action_button_name = "Toggle Chaplain Hoodie"
hoodtype = /obj/item/clothing/head/chaplain_hood
/obj/item/clothing/head/chaplain_hood
+2 -5
View File
@@ -136,7 +136,7 @@
togglename = "wings"
body_parts_covered = ARMS|CHEST
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/reagent_containers/spray/pepper,/obj/item/weapon/gun/projectile,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/restraints/handcuffs,/obj/item/device/flashlight/seclite,/obj/item/weapon/melee/classic_baton/telescopic)
action_button_name = "Toggle Owl Wings"
actions_types = list(/datum/action/item_action/toggle_wings)
/obj/item/clothing/suit/toggle/owlwings/griffinwings
name = "griffon cloak"
@@ -215,7 +215,6 @@
min_cold_protection_temperature = FIRE_SUIT_MIN_TEMP_PROTECT //Space carp like space, so you should too
allowed = list(/obj/item/weapon/tank/internals/emergency_oxygen, /obj/item/weapon/gun/projectile/automatic/speargun)
hooded = 1
action_button_name = "Toggle Carp Hood"
hoodtype = /obj/item/clothing/head/carp_hood
/obj/item/clothing/head/carp_hood
@@ -238,7 +237,6 @@
//min_cold_protection_temperature = FIRE_SUIT_MIN_TEMP_PROTECT
allowed = list(,)
hooded = 1
action_button_name = "Toggle Ian Hood"
hoodtype = /obj/item/clothing/head/ian_hood
/obj/item/clothing/head/ian_hood
@@ -259,7 +257,7 @@
body_parts_covered = CHEST|GROIN|ARMS
allowed = list(,)
hooded = 1
action_button_name = "Toggle Human Head"
actions_types = list(/datum/action/item_action/toggle_human_head)
hoodtype = /obj/item/clothing/head/human_head
/obj/item/clothing/head/human_head
@@ -374,7 +372,6 @@
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 10, rad = 0)
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/internals/emergency_oxygen,/obj/item/toy,/obj/item/weapon/storage/fancy/cigarettes,/obj/item/weapon/lighter)
hooded = 1
action_button_name = "Toggle Winter Hood"
/obj/item/clothing/head/winterhood
name = "winter hood"
+9 -6
View File
@@ -37,8 +37,9 @@
H.unEquip(hood, 1)
H.update_inv_wear_suit()
hood.loc = src
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/suit/hooded/dropped()
..()
@@ -59,8 +60,9 @@
suittoggled = 1
src.icon_state = "[initial(icon_state)]_t"
H.update_inv_wear_suit()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
else
RemoveHood()
@@ -93,8 +95,9 @@
src.icon_state = "[initial(icon_state)]_t"
src.suittoggled = 1
usr.update_inv_wear_suit()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/suit/toggle/examine(mob/user)
..()
+1 -1
View File
@@ -5,7 +5,7 @@
item_state = "bl_suit"
item_color = "black"
desc = "It's a plain jumpsuit. It has a small dial on the wrist."
action_button_name = "Change"
actions_types = list(/datum/action/item_action/change)
origin_tech = "syndicate=3"
sensor_mode = 0 //Hey who's this guy on the Syndicate Shuttle??
random_sensor = 0
@@ -5,20 +5,6 @@ These are general powers. Specific powers are stored under the appropriate alien
/*Alien spit now works like a taser shot. It won't home in on the target but will act the same once it does hit.
Doesn't work on other aliens/AI.*/
/datum/action/spell_action/alien
/datum/action/spell_action/alien/IsAvailable()
if(!target)
return 0
var/obj/effect/proc_holder/alien/ab = target
if(usr)
return ab.cost_check(ab.check_turf,usr,1)
else
if(owner)
return ab.cost_check(ab.check_turf,owner,1)
return 1
/obj/effect/proc_holder/alien
name = "Alien Power"
@@ -32,6 +18,10 @@ Doesn't work on other aliens/AI.*/
var/action_icon_state = "spell_default"
var/action_background_icon_state = "bg_alien"
/obj/effect/proc_holder/alien/New()
..()
action = new(src)
/obj/effect/proc_holder/alien/Click()
if(!istype(usr,/mob/living/carbon))
return 1
@@ -307,9 +297,8 @@ Doesn't work on other aliens/AI.*/
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()
if(APH.has_action)
APH.action.UpdateButtonIcon()
return 1
/mob/living/carbon/alien/adjustPlasma(amount)
-7
View File
@@ -555,13 +555,6 @@ var/const/GALOSHES_DONT_HELP = 4
abilities.Add(A)
A.on_gain(src)
if(A.has_action)
if(!A.action)
A.action = new/datum/action/spell_action/alien
A.action.target = A
A.action.name = A.name
A.action.button_icon = A.action_icon
A.action.button_icon_state = A.action_icon_state
A.action.background_icon_state = A.action_background_icon_state
A.action.Grant(src)
sortInsert(abilities, /proc/cmp_abilities_cost, 0)
@@ -170,10 +170,10 @@
s_store = null
update_inv_s_store()
/mob/living/carbon/human/wear_mask_update(obj/item/clothing/C, unequip = 1)
/mob/living/carbon/human/wear_mask_update(obj/item/clothing/C, toggle_off = 1)
if((C.flags_inv & (HIDEHAIR|HIDEFACIALHAIR)) || (initial(C.flags_inv) & (HIDEHAIR|HIDEFACIALHAIR)))
update_hair()
if(unequip && internal)
if(toggle_off && internal)
update_internals_hud_icon(0)
internal = null
if(C.flags_inv & HIDEEYES)
+4 -4
View File
@@ -40,7 +40,7 @@
update_inv_back()
if(slot_wear_mask)
wear_mask = I
wear_mask_update(I, unequip=0)
wear_mask_update(I, toggle_off = 0)
if(slot_head)
head = I
head_update(I)
@@ -77,7 +77,7 @@
update_inv_back()
else if(I == wear_mask)
wear_mask = null
wear_mask_update(I, unequip=1)
wear_mask_update(I, toggle_off = 1)
else if(I == handcuffed)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
@@ -88,10 +88,10 @@
update_inv_legcuffed()
//handle stuff to update when a mob equips/unequips a mask.
/mob/living/proc/wear_mask_update(obj/item/clothing/C, unequip = 1)
/mob/living/proc/wear_mask_update(obj/item/clothing/C, toggle_off = 1)
update_inv_wear_mask()
/mob/living/carbon/wear_mask_update(obj/item/clothing/C, unequip = 1)
/mob/living/carbon/wear_mask_update(obj/item/clothing/C, toggle_off = 1)
if(C.tint || initial(C.tint))
update_tint()
update_inv_wear_mask()
+3 -7
View File
@@ -196,16 +196,12 @@
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(internal))
if(internal.loc != src)
internal = null
if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) )
internal = null
if(internal)
update_internals_hud_icon(0)
else
update_internals_hud_icon(1)
return internal.remove_air_volume(volume_needed)
else
update_internals_hud_icon(0)
return
/mob/living/carbon/proc/handle_changeling()
-43
View File
@@ -116,47 +116,4 @@
/mob/living/proc/update_damage_hud()
return
/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(reload_screen)
if(!hud_used || !client)
return
if(hud_used.hud_shown != HUD_STYLE_STANDARD)
return
var/button_number = 0
if(hud_used.action_buttons_hidden)
for(var/datum/action/A in actions)
A.button.screen_loc = null
if(reload_screen)
client.screen += A.button
else
for(var/datum/action/A in actions)
button_number++
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
if(!button_number)
hud_used.hide_actions_toggle.screen_loc = null
return
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
else
hud_used.hide_actions_toggle.screen_loc = hud_used.hide_actions_toggle.moved
if(reload_screen)
client.screen += hud_used.hide_actions_toggle
@@ -80,7 +80,6 @@
equip_to_slot_or_del(I, slot_head)
access_card.flags |= NODROP
scanner.Grant(src)
alert_drones(DRONE_NET_CONNECT)
@@ -9,6 +9,10 @@
M.regenerate_icons()
is_adult = 0
maxHealth = 150
for(var/datum/action/innate/slime/reproduce/R in actions)
R.Remove(src)
var/datum/action/innate/slime/evolve/E = new
E.Grant(src)
revive(full_heal = 1)
regenerate_icons()
number = rand(1, 1000)
+3 -12
View File
@@ -888,18 +888,9 @@ var/next_mob_id = 0
/mob/proc/setEarDamage()
return
/mob/proc/AddSpell(obj/effect/proc_holder/spell/spell)
mob_spell_list += spell
if(!spell.action)
spell.action = new/datum/action/spell_action
spell.action.target = spell
spell.action.name = spell.name
spell.action.button_icon = spell.action_icon
spell.action.button_icon_state = spell.action_icon_state
spell.action.background_icon_state = spell.action_background_icon_state
if(isliving(src))
spell.action.Grant(src)
return
/mob/proc/AddSpell(obj/effect/proc_holder/spell/S)
mob_spell_list += S
S.action.Grant(src)
//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation)
-1
View File
@@ -84,7 +84,6 @@
var/datum/hud/hud_used = null
var/research_scanner = 0 //For research scanner equipped mobs. Enable to show research data when examining.
var/datum/action/innate/scan_mode/scanner = new
var/list/grabbed_by = list( )
var/list/requests = list( )
+14 -20
View File
@@ -257,30 +257,26 @@ obj/item/weapon/gun/proc/newshot()
else
return
/obj/item/weapon/gun/attackby(obj/item/A, mob/user, params)
if(istype(A, /obj/item/device/flashlight/seclite))
var/obj/item/device/flashlight/seclite/S = A
/obj/item/weapon/gun/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/device/flashlight/seclite))
var/obj/item/device/flashlight/seclite/S = I
if(can_flashlight)
if(!F)
if(!user.unEquip(A))
if(!user.unEquip(I))
return
user << "<span class='notice'>You click [S] into place on [src].</span>"
if(S.on)
SetLuminosity(0)
F = S
A.loc = src
I.loc = src
update_icon()
update_gunlight(user)
verbs += /obj/item/weapon/gun/proc/toggle_gunlight
action_button_name = "Toggle Gunlight"
var/datum/action/A = new /datum/action/item_action/toggle_gunlight(src)
if(loc == user)
if(!action)
action = new
action.name = action_button_name
action.target = src
action.Grant(user)
A.Grant(user)
if(istype(A, /obj/item/weapon/screwdriver))
if(istype(I, /obj/item/weapon/screwdriver))
if(F)
for(var/obj/item/device/flashlight/seclite/S in src)
user << "<span class='notice'>You unscrew the seclite from [src].</span>"
@@ -290,16 +286,13 @@ 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)
for(var/datum/action/item_action/toggle_gunlight/TGL in actions)
qdel(TGL)
if(unique_rename)
if(istype(A, /obj/item/weapon/pen))
if(istype(I, /obj/item/weapon/pen))
rename_gun(user)
..()
return
/obj/item/weapon/gun/proc/toggle_gunlight()
set name = "Toggle Gunlight"
@@ -337,8 +330,9 @@ obj/item/weapon/gun/proc/newshot()
user.AddLuminosity(-5)
else if(isturf(loc))
SetLuminosity(0)
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/weapon/gun/pickup(mob/user)
@@ -6,7 +6,7 @@
can_suppress = 1
burst_size = 3
fire_delay = 2
action_button_name = "Toggle Firemode"
actions_types = list(/datum/action/item_action/toggle_firemode)
/obj/item/weapon/gun/projectile/automatic/proto
name = "\improper NanoTrasen Saber SMG"
@@ -67,8 +67,9 @@
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
update_icon()
if(action && action.button)
action.button.UpdateIcon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/weapon/gun/projectile/automatic/can_shoot()
return get_ammo()
@@ -119,7 +120,7 @@
fire_delay = 2
can_suppress = 0
burst_size = 0
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/wt550/update_icon()
..()
@@ -39,7 +39,7 @@
mag_type = /obj/item/ammo_box/magazine/m75
burst_size = 1
fire_delay = 0
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/gyropistol/process_chamber(eject_casing = 0, empty_chamber = 1)
..()
@@ -62,7 +62,7 @@
burst_size = 1
fire_delay = 0
select = 0
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/speargun/update_icon()
return
@@ -8,7 +8,7 @@
can_suppress = 1
burst_size = 1
fire_delay = 0
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/pistol/update_icon()
..()
@@ -55,4 +55,4 @@
can_suppress = 0
burst_size = 3
fire_delay = 2
action_button_name = "Toggle Firemode"
actions_types = list(/datum/action/item_action/toggle_firemode)
@@ -36,7 +36,7 @@
fire_delay = 2
can_suppress = 0
burst_size = 0
action_button_name = null
actions_types = list()
fire_sound = 'sound/weapons/Laser.ogg'
/obj/item/weapon/gun/projectile/automatic/laser/process_chamber(eject_casing = 0, empty_chamber = 1)
@@ -312,7 +312,7 @@
burst_size = 1
fire_delay = 0
pin = /obj/item/device/firing_pin/implant/pindicate
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/shotgun/bulldog/unrestricted
pin = /obj/item/device/firing_pin
@@ -29,7 +29,7 @@
can_suppress = 0
burst_size = 1
fire_delay = 0
action_button_name = null
actions_types = list()
/obj/item/weapon/gun/projectile/automatic/toy/pistol/update_icon()
..()
+5 -4
View File
@@ -156,6 +156,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
/obj/effect/proc_holder/spell/New()
..()
action = new(src)
still_recharging_msg = "<span class='notice'>[name] is still recharging.</span>"
charge_counter = charge_max
@@ -169,13 +170,13 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
return
/obj/effect/proc_holder/spell/proc/start_recharge()
if(action && action.button)
action.button.UpdateIcon()
if(action)
action.UpdateButtonIcon()
while(charge_counter < charge_max && isnull(gc_destroyed))
sleep(1)
charge_counter++
if(action && action.button)
action.button.UpdateIcon()
if(action)
action.UpdateButtonIcon()
/obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells
before_cast(targets)
@@ -47,7 +47,7 @@
implant_color = "#DE7E00"
slot = "brain_antidrop"
origin_tech = "materials=5;programming=4;biotech=4"
organ_action_name = "Toggle Anti-Drop"
actions_types = list(/datum/action/item_action/organ_action)
/obj/item/organ/internal/cyberimp/brain/anti_drop/ui_action_click()
active = !active
@@ -260,7 +260,7 @@
implant_color = "#007ACC"
slot = "shoulders"
origin_tech = "materials=5;biotech=4;powerstorage=4"
organ_action_name = "Toggle Arm Mod"
actions_types = list(/datum/action/item_action/organ_action)
var/obj/holder//is defined as the retractable item itself. ensure this is defined somewhere!
var/out = 0//determines if the item is in the owner's hand or not
var/overloaded = 0//is set to 1 when owner gets EMPed. if set to 1, implant doesn't work.
@@ -309,7 +309,7 @@
desc = "A variant of the arm cannon implant that fires electrodes and disabler shots. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_tase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4"
organ_action_name = "Toggle Arm Cannon Taser"
actions_types = list(/datum/action/item_action/organ_action)
/obj/item/organ/internal/cyberimp/chest/arm_mod/tase/New()//when the implant is created...
holder = new /obj/item/weapon/gun/energy/gun/advtaser/mounted(src)//assign a brand new item to it. (in this case, a gun)
@@ -319,7 +319,7 @@
desc = "A variant of the arm cannon implant that fires lethal laser beams. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_lase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4;syndicate=5"//this is kinda nutty and i might lower it
organ_action_name = "Toggle Arm Cannon Laser"
actions_types = list(/datum/action/item_action/organ_action)
/obj/item/organ/internal/cyberimp/chest/arm_mod/lase/New()
holder = new /obj/item/weapon/gun/energy/laser/mounted(src)
+9 -10
View File
@@ -6,7 +6,6 @@
var/zone = "chest"
var/slot
var/vital = 0
var/organ_action_name = null
/obj/item/organ/internal/proc/Insert(mob/living/carbon/M, special = 0)
if(!iscarbon(M) || owner == M)
@@ -19,12 +18,9 @@
owner = M
M.internal_organs |= src
loc = null
if(organ_action_name)
if(!action)
action = new/datum/action/item_action/organ_action
action.name = organ_action_name
action.target = src
action.Grant(src)
for(var/X in actions)
var/datum/action/A = X
A.Grant(src)
/obj/item/organ/internal/proc/Remove(mob/living/carbon/M, special = 0)
owner = null
@@ -32,9 +28,9 @@
M.internal_organs -= src
if(vital && !special)
M.death()
if(organ_action_name)
if(action)
action.Remove(M)
for(var/X in actions)
var/datum/action/A = X
A.Remove(M)
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return
@@ -79,6 +75,9 @@
else
..()
/obj/item/organ/internal/item_action_slot_check(slot,mob/user)
return //so we don't grant the organ's action to mobs who pick up the organ.
//Looking for brains?
//Try code/modules/mob/living/carbon/brain/brain_item.dm