mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
Ported action button system from Paradise/tg
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
//Status updates, death etc.
|
||||
handle_regular_status_updates()
|
||||
handle_actions()
|
||||
update_canmove()
|
||||
update_icons()
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
//Status updates, death etc.
|
||||
handle_regular_status_updates()
|
||||
update_canmove()
|
||||
handle_actions()
|
||||
|
||||
if(client)
|
||||
handle_regular_hud_updates()
|
||||
|
||||
@@ -315,7 +315,7 @@ This saves us from having to call add_fingerprint() any time something is put in
|
||||
|
||||
W.layer = 20
|
||||
|
||||
if(W.icon_action_button)
|
||||
if(W.action_button_name)
|
||||
update_action_buttons()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
|
||||
//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
|
||||
@@ -242,7 +243,7 @@
|
||||
src << "<span class='danger'>Your hand won't respond properly, you drop what you're holding!</span>"
|
||||
drop_item()
|
||||
if(getBrainLoss() >= 45)
|
||||
if(10 <= rn && rn <= 12)
|
||||
if(10 <= rn && rn <= 12)
|
||||
if(prob(50))
|
||||
src << "<span class='danger'>You suddenly black out!</span>"
|
||||
Paralyse(10)
|
||||
@@ -1035,12 +1036,12 @@
|
||||
blinded = 1
|
||||
|
||||
// Check everything else.
|
||||
|
||||
|
||||
//Vision
|
||||
var/obj/item/organ/vision
|
||||
if(species.vision_organ)
|
||||
vision = internal_organs_by_name[species.vision_organ]
|
||||
|
||||
|
||||
if(!vision) // Presumably if a species has no vision organs, they see via some other means.
|
||||
eye_blind = 0
|
||||
blinded = 0
|
||||
@@ -1049,7 +1050,7 @@
|
||||
eye_blind = 1
|
||||
blinded = 1
|
||||
eye_blurry = 1
|
||||
else
|
||||
else
|
||||
//blindness
|
||||
if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own
|
||||
blinded = 1
|
||||
@@ -1059,7 +1060,7 @@
|
||||
else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster
|
||||
eye_blurry = max(eye_blurry-3, 0)
|
||||
blinded = 1
|
||||
|
||||
|
||||
//blurry sight
|
||||
if(vision.is_bruised()) // Vision organs impaired? Permablurry.
|
||||
eye_blurry = 1
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
handle_environment(environment) // Handle temperature/pressure differences between body and environment
|
||||
|
||||
handle_regular_status_updates() // Status updates, death etc.
|
||||
handle_actions()
|
||||
|
||||
/mob/living/carbon/slime/proc/handle_environment(datum/gas_mixture/environment)
|
||||
if(!environment)
|
||||
|
||||
@@ -247,6 +247,81 @@
|
||||
//Scale quadratically so that single digit numbers of fire stacks don't burn ridiculously hot.
|
||||
return round(FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE*(fire_stacks/FIRE_MAX_FIRESUIT_STACKS)**2)
|
||||
|
||||
/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
|
||||
|
||||
|
||||
//If simple_animals are ever moved under carbon, then this can probably be moved to carbon as well
|
||||
/mob/living/proc/attack_throat(obj/item/W, obj/item/weapon/grab/G, mob/user)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
var/mob_always_swap = 0
|
||||
|
||||
var/mob/living/cameraFollow = null
|
||||
var/list/datum/action/actions = list()
|
||||
|
||||
var/tod = null // Time of death
|
||||
var/update_slimes = 1
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
//Status updates, death etc.
|
||||
clamp_values()
|
||||
handle_regular_status_updates()
|
||||
handle_actions()
|
||||
|
||||
if(client)
|
||||
handle_regular_hud_updates()
|
||||
|
||||
Reference in New Issue
Block a user