Merge pull request #5095 from tigercat2000/ACTION_BUTTONS

Action Button Update
This commit is contained in:
Fox McCloud
2016-07-19 23:40:51 -04:00
committed by GitHub
97 changed files with 1237 additions and 1022 deletions
+1
View File
@@ -20,6 +20,7 @@ var/global/list/boo_phrases=list(
school = "transmutation"
charge_max = 600
clothes_req = 0
stat_allowed = 1
invocation = ""
invocation_type = "none"
range = 1 // Or maybe 3?
@@ -54,8 +54,12 @@
if(in_contents_of(/obj/mecha))
canmove = 1
use_me = 1 //If it can move, let it emote
else if(istype(loc, /obj/item/device/mmi)) canmove = 1 //mmi won't move anyways so whatever
else canmove = 0
else if(istype(loc, /obj/item/device/mmi))
canmove = 1 //mmi won't move anyways so whatever
else
canmove = 0
update_action_buttons_icon()
return canmove
/mob/living/carbon/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up.
+16 -5
View File
@@ -644,8 +644,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(do_mob(usr, src, POCKET_STRIP_DELAY))
if(internal)
internal = null
if(internals)
internals.icon_state = "internal0"
update_internals_hud_icon(0)
else
var/no_mask2
if(!(wear_mask && wear_mask.flags & AIRTIGHT))
@@ -655,8 +654,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
to_chat(usr, "<span class='warning'>[src] is not wearing a suitable mask or helmet!</span>")
return
internal = ITEM
if(internals)
internals.icon_state = "internal1"
update_internals_hud_icon(1)
visible_message("<span class='danger'>[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].</span>", \
"<span class='userdanger'>[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].</span>")
@@ -858,7 +856,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
else
clear_alert("handcuffed")
update_action_buttons() //some of our action buttons might be unusable when we're handcuffed.
update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed.
update_inv_handcuffed()
update_hud_handcuffed()
@@ -1031,3 +1029,16 @@ so that different stomachs can handle things in different ways VB*/
var/obj/item/LH = get_inactive_hand()
if(LH)
. |= LH.GetAccess()
/mob/living/carbon/proc/can_breathe_gas()
if(!wear_mask)
return TRUE
if(!(wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT) && internal == null)
return TRUE
return FALSE
/mob/living/carbon/proc/update_internals_hud_icon(internal_state = 0)
if(hud_used && hud_used.internals)
hud_used.internals.icon_state = "internal[internal_state]"
@@ -79,7 +79,7 @@
break
if(thrust)
if((movement_dir || thrust.stabilization_on) && thrust.allow_thrust(0.01, src))
if((movement_dir || thrust.stabilizers) && thrust.allow_thrust(0.01, src))
return 1
return 0
@@ -164,9 +164,8 @@
update_fhair()
update_head_accessory()
if(internal)
if(internals)
internals.icon_state = "internal0"
internal = null
update_internals_hud_icon(0)
sec_hud_set_ID()
update_inv_wear_mask()
else if(I == wear_id)
+2 -5
View File
@@ -328,7 +328,6 @@
/mob/living/carbon/human/get_breath_from_internal(volume_needed) //making this call the parent would be far too complicated
if(internal)
var/null_internals = 0 //internals are invalid, therefore turn them off
var/skip_contents_check = 0 //rigsuit snowflake, oxygen tanks aren't stored inside the mob, so the 'contents.Find' check has to be skipped.
@@ -353,12 +352,10 @@
if(internal) //check for hud updates every time this is called
if(internals)
internals.icon_state = "internal1"
update_internals_hud_icon(1)
return internal.remove_air_volume(volume_needed) //returns the valid air
else
if(internals)
internals.icon_state = "internal0"
update_internals_hud_icon(0)
return null
@@ -125,8 +125,7 @@
H.equip_or_collect(new/obj/item/weapon/tank/plasma/plasmaman(H), tank_slot) // Bigger plasma tank from Raggy.
to_chat(H, "<span class='notice'>You are now running on plasma internals from the [H.s_store] in your [tank_slot_name]. You must breathe plasma in order to survive, and are extremely flammable.</span>")
H.internal = H.get_item_by_slot(tank_slot)
if(H.internals)
H.internals.icon_state = "internal1"
H.update_internals_hud_icon(1)
// Plasmamen are so fucking different that they need their own proc.
/datum/species/plasmaman/handle_breath(var/datum/gas_mixture/breath, var/mob/living/carbon/human/H)
@@ -364,8 +364,7 @@
H.equip_or_collect(new /obj/item/weapon/tank/emergency_oxygen/vox(H), slot_l_hand)
to_chat(H, "<span class='notice'>You are now running on nitrogen internals from the [H.l_hand] in your hand. Your species finds oxygen toxic, so you must breathe nitrogen only.</span>")
H.internal = H.l_hand
if(H.internals)
H.internals.icon_state = "internal1"
H.update_internals_hud_icon(1)
/datum/species/vox/handle_post_spawn(var/mob/living/carbon/human/H)
updatespeciescolor(H)
+3 -11
View File
@@ -181,19 +181,17 @@
/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 & AIRTIGHT)) //not wearing mask or non-breath mask
if(!head || !(head.flags & AIRTIGHT)) //not wearing helmet or non-breath helmet
internal = null //turn off internals
if(internal)
if(internals)
internals.icon_state = "internal1"
update_internals_hud_icon(1)
return internal.remove_air_volume(volume_needed)
else
if(internals)
internals.icon_state = "internal0"
update_internals_hud_icon(0)
return
@@ -437,12 +435,6 @@
see_invisible = see_override
/mob/living/carbon/handle_actions()
..()
for(var/obj/item/I in internal_organs)
give_action_button(I, 1)
/mob/living/carbon/handle_hud_icons()
return
@@ -243,6 +243,7 @@
else if(nutrition >= get_grow_nutrition() && amount_grown < 10)
nutrition -= 20
amount_grown++
update_action_buttons_icon()
if(amount_grown >= 10 && !Victim && !Target && !ckey)
if(is_adult)
+1
View File
@@ -2,4 +2,5 @@
blinded = max(blinded, 1)
clear_fullscreens()
update_action_buttons_icon()
..(gibbed)
-81
View File
@@ -49,8 +49,6 @@
handle_disabilities() // eye, ear, brain damages
handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc
handle_actions()
update_canmove()
if(client)
@@ -197,7 +195,6 @@
handle_vision()
handle_hud_icons()
update_action_buttons()
return 1
@@ -247,84 +244,6 @@
/mob/living/proc/handle_hud_icons_health()
return
/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(I.action_button_custom_type)
I.action = new I.action_button_custom_type
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/update_action_buttons()
if(!hud_used) return
if(!client) return
if(!hud_used.hud_shown)
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
/mob/living/proc/process_nations()
if(client)
var/client/C = client
@@ -49,7 +49,6 @@
var/list/icon/pipes_shown = list()
var/last_played_vent
var/list/datum/action/actions = list()
var/step_count = 0
var/list/butcher_results = null
@@ -234,6 +234,7 @@
else
canmove = 1
update_transform()
update_action_buttons_icon()
return canmove
//Robots on fire
@@ -88,6 +88,8 @@ var/list/robot_verbs_default = list(
var/obj/item/borg/sight/hud/sec/sechud = null
var/obj/item/borg/sight/hud/med/healthhud = null
var/datum/action/item_action/toggle_research_scanner/scanner = null
/mob/living/silicon/robot/New(loc,var/syndie = 0,var/unfinished = 0, var/alien = 0)
spark_system = new /datum/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
@@ -144,6 +146,7 @@ var/list/robot_verbs_default = list(
cell_component.installed = 1
diag_hud_set_borgcell()
scanner = new(src)
scanner.Grant(src)
/mob/living/silicon/robot/proc/init(var/alien=0)
@@ -627,6 +627,7 @@
else
canmove = 1
update_transform()
update_action_buttons_icon()
return canmove
/mob/living/simple_animal/update_transform()
+2 -10
View File
@@ -1052,6 +1052,7 @@ var/list/slot_equipment_priority = list( \
layer = initial(layer)
update_transform()
update_action_buttons_icon()
return canmove
/mob/proc/fall(var/forced)
@@ -1367,16 +1368,7 @@ mob/proc/yank_out_object()
/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
spell.action.Grant(src)
//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation)
+3 -3
View File
@@ -13,7 +13,6 @@
var/obj/screen/hands = null
var/obj/screen/pullin = null
var/obj/screen/internals = null
var/obj/screen/i_select = null
var/obj/screen/m_select = null
var/obj/screen/healths = null
@@ -123,7 +122,6 @@
hud_possible = list(SPECIALROLE_HUD)
var/research_scanner = 0 //For research scanner equipped mobs. Enable to show research data when examining.
var/datum/action/scan_mode/scanner = new
var/list/grabbed_by = list( )
var/list/requests = list( )
@@ -233,4 +231,6 @@
var/datum/vision_override/vision_type = null //Vision override datum.
var/list/permanent_huds = list()
var/list/permanent_huds = list()
var/list/actions = list()