Generic Action\Action Button System

This commit ports the GAABS from -tg-station13. The GAABS allows for
generic, movable, hud elements for spells, powers, and items.
This commit is contained in:
AnturK
2015-05-11 09:32:08 -07:00
committed by Tigercat2000
parent f6a88fa251
commit 568d289a67
74 changed files with 662 additions and 335 deletions
+7 -3
View File
@@ -145,7 +145,9 @@ var/list/admin_verbs_debug = list(
/client/proc/qdel_toggle, // /vg/
/client/proc/gc_dump_hdl,
/client/proc/debugNatureMapGenerator,
/client/proc/check_bomb_impacts
/client/proc/check_bomb_impacts,
/client/proc/test_movable_UI,
/client/proc/test_snap_UI
)
var/list/admin_verbs_possess = list(
/proc/possess,
@@ -401,8 +403,10 @@ var/list/admin_verbs_mentor = list(
set desc = "Gives a spell to a mob."
var/obj/effect/proc_holder/spell/wizard/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spells
if(!S) return
T.spell_list += new S
T.update_power_buttons()
if(T.mind)
T.mind.AddSpell(new S)
else
T.AddSpell(new S)
feedback_add_details("admin_verb","GS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
log_admin("[key_name(usr)] gave [key_name(T)] the spell [S].")
message_admins("\blue [key_name_admin(usr)] gave [key_name(T)] the spell [S].", 1)
+2 -2
View File
@@ -162,7 +162,7 @@
desc = "Protects the eyes from welders, approved by the mad scientist association."
icon_state = "welding-g"
item_state = "welding-g"
icon_action_button = "action_welding_g"
action_button_name = "Flip welding goggles"
var/up = 0
flash_protect = 2
tint = 2
@@ -210,7 +210,7 @@
item_state = "rwelding-g"
flash_protect = 2
tint = 0
icon_action_button = "action_welding_g"
action_button_name = "Flip welding goggles"
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
+1 -1
View File
@@ -9,7 +9,7 @@
_color = "yellow" //Determines used sprites: hardhat[on]_[color] and hardhat[on]_[color]2 (lying down sprite)
armor = list(melee = 30, bullet = 5, laser = 20,energy = 10, bomb = 20, bio = 10, rad = 20)
flags_inv = 0
icon_action_button = "action_hardhat"
action_button_name = "Toggle Helmet Light"
siemens_coefficient = 0.9
loose = 4
-1
View File
@@ -350,7 +350,6 @@
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
var/cooldown = 0
action_button_name = "Caw"
icon_action_button = "action_griffin"
/obj/item/clothing/head/griffin/attack_self()
caw()
+1 -1
View File
@@ -24,7 +24,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)
icon_action_button = "action_welding"
action_button_name = "flip welding helmet"
siemens_coefficient = 0.9
loose = 4
species_fit = list("Vox")
+3 -4
View File
@@ -6,17 +6,16 @@
flags = BLOCKHAIR
flags_inv = HIDEFACE
w_class = 2
icon_action_button = "action_balaclava"
action_button_name = "Adjust Balaclava"
ignore_maskadjust = 0
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/mask.dmi'
)
/obj/item/clothing/mask/balaclava/attack_self(var/mob/user)
adjustmask(user)
adjustmask(user)
/obj/item/clothing/mask/luchador
name = "Luchador Mask"
desc = "Worn by robust fighters, flying high to defeat their foes!"
-2
View File
@@ -8,7 +8,6 @@
gas_transfer_coefficient = 0.10
permeability_coefficient = 0.50
species_fit = list("Vox")
icon_action_button = "action_breath"
action_button_name = "Adjust Breath Mask"
ignore_maskadjust = 0
species_fit = list("Vox", "Vox Armalis")
@@ -35,6 +34,5 @@
item_state = "voxmask"
permeability_coefficient = 0.01
species_restricted = list("Vox")
icon_action_button = null
action_button_name = null
ignore_maskadjust = 1
-2
View File
@@ -138,7 +138,6 @@
flags = MASKCOVERSMOUTH | MASKCOVERSEYES | BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS | NODROP
var/cooldown = 0
action_button_name = "Hoot"
icon_action_button = "action_owlman"
/obj/item/clothing/mask/gas/owl_mask/attack_self()
hoot()
@@ -170,7 +169,6 @@
ignore_maskadjust = 0
species_fit = list()
action_button_name = "HALT!"
icon_action_button = "action_sechailer"
/obj/item/clothing/mask/gas/sechailer/swat
name = "\improper SWAT mask"
@@ -36,7 +36,6 @@
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"
icon_action_button = "action_sterile"
ignore_maskadjust = 0
species_fit = list("Vox")
sprite_sheets = list(
@@ -176,7 +175,6 @@
ignore_maskadjust = 0
adjusted_flags = SLOT_HEAD
icon_state = "bandbotany"
icon_action_button = "action_bandbotany"
action_button_name = "Adjust Bandana"
/obj/item/clothing/mask/bandana/attack_self(var/mob/user)
-1
View File
@@ -6,7 +6,6 @@
var/magpulse = 0
var/slowdown_active = 2
action_button_name = "Toggle Magboots"
icon_action_button = "action_magboots"
species_restricted = null
/obj/item/clothing/shoes/magboots/attack_self(mob/user)
@@ -23,7 +23,6 @@
icon_state = "chronosuit"
item_state = "chronosuit"
action_button_name = "Toggle Chronosuit"
icon_action_button = "action_chronosuit"
slowdown = 2
armor = list(melee = 60, bullet = 60, laser = 60, energy = 60, bomb = 30, bio = 90, rad = 90)
var/obj/item/clothing/head/helmet/space/chronos/helmet = null
+1 -3
View File
@@ -10,7 +10,7 @@
var/brightness_on = 4 //luminosity when on
var/on = 0
_color = "engineering" //Determines used sprites: rig[on]-[color] and rig[on]-[color]2 (lying down sprite)
icon_action_button = "action_hardhat"
action_button_name = "Toggle Helmet Light"
//Species-specific stuff.
species_restricted = list("exclude","Unathi","Tajaran","Skrell","Diona","Vox")
@@ -374,7 +374,6 @@
on = 1
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | STOPSPRESSUREDMAGE | THICKMATERIAL
action_button_name = "Toggle Helmet Mode"
icon_action_button = "Action_hardsuit1-syndi"
species_restricted = null
sprite_sheets = null
@@ -417,7 +416,6 @@
w_class = 3
var/on = 1
action_button_name = "Toggle Hardsuit Mode"
icon_action_button = "Action_hardsuit1-syndi"
armor = list(melee = 60, 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,/obj/item/weapon/restraints/handcuffs,/obj/item/weapon/tank)
species_restricted = null
+1 -1
View File
@@ -165,7 +165,7 @@
icon_state = "reactiveoff"
item_state = "reactiveoff"
blood_overlay_type = "armor"
icon_action_button = "reactiveoff"
action_button_name = "Toggle Reactive Armor"
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
/obj/item/clothing/suit/armor/reactive/IsShield()
@@ -474,7 +474,6 @@
armor = list(melee = 5, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/reagent_containers/spray/pepper,/obj/item/weapon/gun/projectile,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/restraints/handcuffs,/obj/item/device/flashlight/seclite)
action_button_name = "Toggle Owl Wings"
icon_action_button = "action_wings"
flags = NODROP
/obj/item/clothing/suit/toggle/owlwings/griffinwings
@@ -6,7 +6,7 @@
slot = "utility"
var/holster_allow = /obj/item/weapon/gun
var/obj/item/weapon/gun/holstered = null
icon_action_button = "action_holster"
action_button_name = "Holster"
w_class = 3.0 // so it doesn't fit in pockets
//subtypes can override this to specify what can be holstered
@@ -6,7 +6,7 @@
slot = "utility"
var/slots = 3
var/obj/item/weapon/storage/internal/hold
icon_action_button = "action_storage"
action_button_name = "View Storage"
w_class = 3.0 // so it doesn't fit in pockets
/obj/item/clothing/accessory/storage/New()
+1 -1
View File
@@ -37,7 +37,7 @@ var/list/image/ghost_darkness_images = list() //this is a list of images for thi
verbs += /mob/dead/observer/proc/dead_tele
// Our new boo spell.
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/boo(src)
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/boo(src))
can_reenter_corpse = flags & GHOST_CAN_REENTER
started_as_observer = flags & GHOST_IS_OBSERVER
@@ -58,6 +58,9 @@
//Status updates, death etc.
handle_regular_status_updates()
handle_actions()
update_canmove()
update_icons()
@@ -197,8 +197,6 @@
update_inv_l_hand()
update_action_buttons()
//This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible()
+5 -4
View File
@@ -138,6 +138,9 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
//Status updates, death etc.
handle_regular_status_updates() //Optimized a bit
handle_actions()
update_canmove()
//Update our name based on whether our face is obscured/disfigured
@@ -1044,20 +1047,19 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
if(hud_updateflag)
handle_hud_list()
if(!client) return 0
if(hud_updateflag)
handle_hud_list()
update_action_buttons()
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
client.images.Remove(hud)
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask,/* global_hud.nvg*/)
update_action_buttons()
if(damageoverlay.overlays)
damageoverlay.overlays = list()
@@ -1796,7 +1798,6 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
holder.icon_state = "hudscientopia"
hud_list[NATIONS_HUD] = holder
update_power_buttons()
hud_updateflag = 0
/mob/living/carbon/human/proc/process_nations()
@@ -42,6 +42,8 @@
handle_regular_status_updates() // Status updates, death etc.
handle_actions()
handle_wetness()
/mob/living/carbon/slime/proc/AIprocess() // the master AI process
@@ -67,6 +67,9 @@
//Status updates, death etc.
handle_regular_status_updates()
handle_actions()
update_canmove()
if(client)
@@ -34,8 +34,7 @@
for(var/spell in default_spells)
var/obj/effect/proc_holder/spell/wizard/S = spell
if(!S) return
H.spell_list += new S
H.update_power_buttons()
H.AddSpell(new S)
/datum/superheroes/proc/assign_id(var/mob/living/carbon/human/H)
var/obj/item/weapon/card/id/syndicate/W = new(H)
@@ -147,7 +146,7 @@
charge_max = 450
clothes_req = 0
range = 1 //Adjacent to user
icon_power_button = "spell_greytide"
action_icon_state = "spell_greytide"
var/recruiting = 0
/obj/effect/proc_holder/spell/wizard/targeted/recruit/cast(list/targets)
+74
View File
@@ -242,6 +242,80 @@
if(volume >= 20) fire_stacks -= 0.5
if(volume >= 50) fire_stacks -= 1
/mob/living/regular_hud_updates()
..()
update_action_buttons()
/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)
if(I.action_button_name)
if(!I.action)
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)
return
/mob/living/update_action_buttons()
if(!hud_used) return
if(!client) return
if(hud_used.hud_shown != 1) //Hud toggled to minimal
return
client.screen -= hud_used.hide_actions_toggle
for(var/datum/action/A in actions)
if(A.button)
client.screen -= A.button
if(hud_used.action_buttons_hidden)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.UpdateIcon()
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1)
client.screen += hud_used.hide_actions_toggle
return
var/button_number = 0
for(var/datum/action/A in actions)
button_number++
if(A.button == null)
var/obj/screen/movable/action_button/N = new(hud_used)
N.owner = A
A.button = N
var/obj/screen/movable/action_button/B = A.button
B.UpdateIcon()
B.name = A.UpdateName()
client.screen += B
if(!B.moved)
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
//hud_used.SetButtonCoords(B,button_number)
if(button_number > 0)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.InitialiseIcon(src)
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1)
client.screen += hud_used.hide_actions_toggle
//This is called when the mob is thrown into a dense turf
/mob/living/proc/turf_collision(var/turf/T, var/speed)
src.take_organ_damage(speed*5)
+3 -1
View File
@@ -48,4 +48,6 @@
var/nightvision = 0
var/list/icon/pipes_shown = list()
var/last_played_vent
var/last_played_vent
var/list/datum/action/actions = list()
@@ -18,6 +18,7 @@
silence_time = null
src << "<font color=green>Communication circuit reinitialized. Speech and messaging functionality restored.</font>"
handle_statuses()
handle_actions()
/mob/living/silicon/pai/updatehealth()
if(status_flags & GODMODE)
@@ -11,6 +11,8 @@
clamp_values()
handle_regular_status_updates()
handle_actions()
if(client)
handle_regular_hud_updates()
update_items()
@@ -31,7 +31,7 @@
name = text("[initial(name)] ([rand(1, 1000)])")
real_name = name
for(var/spell in construct_spells)
spell_list += new spell(src)
AddSpell(new spell(src))
/mob/living/simple_animal/construct/Die()
..()
@@ -56,9 +56,9 @@
/mob/living/simple_animal/hostile/statue/New(loc, var/mob/living/creator)
..()
// Give spells
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/flicker_lights(src)
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/blindness(src)
spell_list += new /obj/effect/proc_holder/spell/wizard/targeted/night_vision(src)
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/flicker_lights(src))
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/blindness(src))
AddSpell(new /obj/effect/proc_holder/spell/wizard/targeted/night_vision(src))
// Give nightvision
see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING
@@ -108,6 +108,8 @@
handle_weakened()
handle_paralysed()
handle_actions()
//Movement
if(!client && !stop_automated_movement && wander && (ckey == null))
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
+14 -1
View File
@@ -1455,4 +1455,17 @@ mob/proc/yank_out_object()
else
src.visible_message("<span class='warning'>[src] pukes all over \himself!</span>","<span class='warning'>You puke all over yourself!</span>")
location.add_vomit_floor(src, 1)
playsound(location, 'sound/effects/splat.ogg', 50, 1)
playsound(location, 'sound/effects/splat.ogg', 50, 1)
/mob/proc/AddSpell(var/obj/effect/proc_holder/spell/spell)
spell_list += spell
if(!spell.action)
spell.action = new/datum/action/spell_action
spell.action.target = spell
spell.action.name = spell.name
spell.action.button_icon = spell.action_icon
spell.action.button_icon_state = spell.action_icon_state
spell.action.background_icon_state = spell.action_background_icon_state
if(isliving(src))
spell.action.Grant(src)
return
+3 -3
View File
@@ -4,9 +4,9 @@
/mob/spirit/mask/New()
..()
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/conjure/create_talisman(src)
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/blood_speech(src)
spell_list += new /obj/effect/proc_holder/spell/wizard/aoe_turf/shatter_lights(src)
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/conjure/create_talisman(src))
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/blood_speech(src))
AddSpell(new /obj/effect/proc_holder/spell/wizard/aoe_turf/shatter_lights(src))
/mob/spirit/mask/verb/go_to_follower()
@@ -155,7 +155,6 @@
mag_type = "/obj/item/ammo_box/magazine/m545"
fire_sound = 'sound/weapons/Gunshot_smg.ogg'
action_button_name = "Toggle Grenade Launcher"
icon_action_button = "Action_c90gl"
can_suppress = 0
var/select = 1 //1 for boolets, 0 for explosions.
var/obj/item/weapon/gun/projectile/revolver/grenadelauncher/underbarrel
@@ -74,7 +74,7 @@
return
for (var/obj/effect/proc_holder/spell/wizard/S in M.spell_list)
new_mob.spell_list += new S.type
new_mob.AddSpell(new S.type)
new_mob.a_intent = "harm"
if(M.mind)
+1 -1
View File
@@ -219,7 +219,7 @@ proc/wabbajack(mob/living/M)
return
for (var/obj/effect/proc_holder/spell/wizard/S in M.spell_list)
new_mob.spell_list += new S.type
new_mob.AddSpell(new S.type)
new_mob.attack_log = M.attack_log
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>[M.real_name] ([M.ckey]) became [new_mob.real_name].</font>")