Action Button Update

- Refactors action button backend
   - Action buttons are no longer checked on Life(), items are responsible
     for adding/removing/updating them.
   - Item action buttons are no longer a static action_button_name define,
     items define actions_types, which is a list of paths.
   - Items can now have multiple action buttons.
     - This is handled by new arguments to ui_action_click, the first
       parameter is the user, the second is the path of the action datum
       that was invoked.
 - Refactored how internals function
   - You may now directly switch internals without breaking anything.
   - The internals icon has been updated to be more consistent.
 - Added action buttons for jetpacks
 - Added action buttons for oxygen tanks
 - Uses-based implants now qdel() themselves when they run out of uses.
   This is somewhat a buff to traitor implants, but it's such a minor
   change. The actual reasoning is so that the action buttons are properly
   removed.
 - Fixed a bug with the "Boo" spell which resulted in IsAvailable failing
   for certain ghosts.
 - You can now shift-click on movable HUD elements to reset them to the
   proper position (thank fucking christ)
This commit is contained in:
Tigercat2000
2016-07-18 13:23:01 -07:00
parent 00558bd109
commit 56a09db739
97 changed files with 1230 additions and 1022 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
name = "Activate Pill"
/datum/action/item_action/hands_free/activate_pill/Trigger()
if(!Checks())
if(!..())
return
to_chat(owner, "<span class='caution'>You grit your teeth and burst the implanted [target]!</span>")
add_logs(owner, null, "swallowed an implanted pill", target)
@@ -49,7 +49,7 @@
implant_color = "#DE7E00"
slot = "brain_antidrop"
origin_tech = "materials=5;programming=4;biotech=4"
organ_action_name = "Toggle Anti-Drop"
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/brain/anti_drop/ui_action_click()
active = !active
@@ -263,7 +263,7 @@
implant_color = "#007ACC"
slot = "shoulders"
origin_tech = "materials=5;biotech=4;powerstorage=4"
organ_action_name = "Toggle Arm Mod"
actions_types = list(/datum/action/item_action/organ_action/toggle)
var/obj/holder//is defined as the retractable item itself. ensure this is defined somewhere!
var/out = 0//determines if the item is in the owner's hand or not
var/overloaded = 0//is set to 1 when owner gets EMPed. if set to 1, implant doesn't work.
@@ -319,7 +319,7 @@
desc = "A variant of the arm cannon implant that fires electrodes and disabler shots. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_tase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4"
organ_action_name = "Toggle Arm Cannon Taser"
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/tase/New()//when the implant is created...
holder = new /obj/item/weapon/gun/energy/gun/advtaser/mounted(src)//assign a brand new item to it. (in this case, a gun)
@@ -329,7 +329,7 @@
desc = "A variant of the arm cannon implant that fires lethal laser beams. The cannon emerges from the subject's arms and remains in the shoulders when not in use."
icon_state = "armcannon_lase_implant"
origin_tech = "materials=5;combat=5;biotech=4;powerstorage=4;syndicate=5"//this is kinda nutty and i might lower it
organ_action_name = "Toggle Arm Cannon Laser"
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/lase/New()
holder = new /obj/item/weapon/gun/energy/laser/mounted(src)
+33 -22
View File
@@ -8,9 +8,7 @@
var/zone = "chest"
var/slot
vital = 0
var/organ_action_name = null
var/non_primary = 0
action_button_custom_type = /datum/action/item_action/organ_action
/obj/item/organ/internal/New(var/mob/living/carbon/holder)
if(istype(holder))
@@ -41,8 +39,9 @@
parent.internal_organs |= src
//M.internal_organs_by_name[src] |= src(H,1)
loc = null
if(organ_action_name)
action_button_name = organ_action_name
for(var/X in actions)
var/datum/action/A = X
A.Grant(M)
/obj/item/organ/internal/remove(mob/living/carbon/M, special = 0)
@@ -61,14 +60,18 @@
else
parent.internal_organs -= src
if(organ_action_name)
action_button_name = null
for(var/X in actions)
var/datum/action/A = X
A.Remove(M)
/obj/item/organ/internal/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
insert(target)
..()
/obj/item/organ/internal/item_action_slot_check(slot, mob/user)
return
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return
@@ -197,7 +200,7 @@
icon_state = "cursedheart-off"
icon_base = "cursedheart"
origin_tech = "biotech=5"
organ_action_name = "pump your blood"
actions_types = list(/datum/action/item_action/organ_action/cursed_heart)
var/last_pump = 0
var/pump_delay = 30 //you can pump 1 second early, for lag, but no more (otherwise you could spam heal)
var/blood_loss = 100 //600 blood is human default, so 5 failures (below 122 blood is where humans die because reasons?)
@@ -235,25 +238,33 @@
if(owner)
to_chat(owner, "<span class='userdanger'>Your heart has been replaced with a cursed one, you have to pump this one manually otherwise you'll die!</span>")
/datum/action/item_action/organ_action/cursed_heart
name = "pump your blood"
//You are now brea- pumping blood manually
/obj/item/organ/internal/heart/cursed/ui_action_click()
if(world.time < (last_pump + (pump_delay-10))) //no spam
to_chat(owner, "<span class='userdanger'>Too soon!</span>")
return
/datum/action/item_action/organ_action/cursed_heart/Trigger()
. = ..()
if(. && istype(target,/obj/item/organ/internal/heart/cursed))
var/obj/item/organ/internal/heart/cursed/cursed_heart = target
last_pump = world.time
playsound(owner, 'sound/effects/singlebeat.ogg', 40, 1)
to_chat(owner, "<span class='notice'>Your heart beats.</span>")
if(world.time < (cursed_heart.last_pump + (cursed_heart.pump_delay-10))) //no spam
to_chat(owner, "<span class='userdanger'>Too soon!</span>")
return
var/mob/living/carbon/human/H = owner
if(istype(H))
H.vessel.add_reagent("blood", (blood_loss*0.5))//gain half the blood back from a failure
if(owner.client)
owner.client.color = ""
cursed_heart.last_pump = world.time
playsound(owner,'sound/effects/singlebeat.ogg',40,1)
to_chat(owner, "<span class = 'notice'>Your heart beats.</span>")
H.adjustBruteLoss(-heal_brute)
H.adjustFireLoss(-heal_burn)
H.adjustOxyLoss(-heal_oxy)
var/mob/living/carbon/human/H = owner
if(istype(H))
H.vessel.add_reagent("blood", (cursed_heart.blood_loss*0.5))//gain half the blood back from a failure
if(owner.client)
owner.client.color = ""
H.adjustBruteLoss(-cursed_heart.heal_brute)
H.adjustFireLoss(-cursed_heart.heal_burn)
H.adjustOxyLoss(-cursed_heart.heal_oxy)
/obj/item/organ/internal/lungs
name = "lungs"