mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 08:31:57 +00:00
* Base work for the unathi robot subspecies. * Adds metabolism species, kidney vars, and the robot unathi organs. * Moves some action buttons to organs, pretty much a bay port right now. Todo: the unathi and alien stuff should also go here. * First autakh implant power. * Fixes the organs action button this time. * Finishes more implants, and interactions with flashs and vaurca. * Prepare for great changes. * Drops the real bomb, boss. * He who fights with monsters. * Far more work into augments and limb removing powers. * Limb verbs should be good now. * A LOT of work into the assited organ, allowing it to bleed and etc, as well adding a new chem that will stop bleeding in their case. * Probably the last work on implants. * Some extra touches. * Some tweaks to the species. * More fixes and adds kyre's sprites. * More runtime fixes. * Fixes the species name too. * Fixes travis. * Updates this file too to work with the new tools procs. * Adds changelog * Fixed changelog. * Unathi hair and lore description. * Some tweaks to this too. * Locks away them for now, they will be released after we got all the events and etc done. * Changes this chemical. * Fixes an airlock runtime. * Adds the non scan flag to the autakh, mostly due to some bizzare interactions with changelings and cloning. * Organs removal changes; can't take out the organ if it is too damage. * Restricts them back again. * Robotic organs now have the proper icons and names. * Adds sprites for their organs and some extra tweaks. * Fixes this missing icon. * emp should also now hurt assited organs. * Tweaks more organ related things. * Fixes the head not being properly set as well. * Fixes their flags. * fixes the flag for real this time. * Poze's review. * Changes the au'takh organ buttons to don't be animated. * Helps with adminbus or something. * Fowl's requested changes. * Fixes a typo. * Robotic limb's brute and burn mods are now controlled by the limb model. * Fowl's changes once more. * Stops some spam. * More grammar. * No eal. * Skull's review.
237 lines
5.5 KiB
Plaintext
237 lines
5.5 KiB
Plaintext
#define AB_ITEM 1
|
|
#define AB_SPELL 2
|
|
#define AB_INNATE 3
|
|
#define AB_GENERIC 4
|
|
#define AB_ITEM_USE_ICON 5
|
|
|
|
#define AB_CHECK_RESTRAINED 1
|
|
#define AB_CHECK_STUNNED 2
|
|
#define AB_CHECK_LYING 4
|
|
#define AB_CHECK_ALIVE 8
|
|
#define AB_CHECK_INSIDE 16
|
|
|
|
|
|
/datum/action
|
|
var/name = "Generic Action"
|
|
var/action_type = AB_ITEM
|
|
var/procname = null
|
|
var/atom/movable/target = null
|
|
var/check_flags = 0
|
|
var/processing = 0
|
|
var/active = 0
|
|
var/obj/screen/movable/action_button/button = null
|
|
var/button_icon = 'icons/obj/action_buttons/actions.dmi'
|
|
var/button_icon_state = "default"
|
|
var/background_icon_state = "bg_default"
|
|
var/mob/living/owner
|
|
|
|
/datum/action/New(var/Target)
|
|
target = Target
|
|
|
|
/datum/action/Destroy()
|
|
if(owner)
|
|
Remove(owner)
|
|
return ..()
|
|
|
|
/datum/action/proc/SetTarget(var/atom/Target)
|
|
target = Target
|
|
|
|
/datum/action/proc/Grant(mob/living/T)
|
|
if(owner)
|
|
if(owner == T)
|
|
return
|
|
Remove(owner)
|
|
owner = T
|
|
owner.actions.Add(src)
|
|
owner.update_action_buttons()
|
|
return
|
|
|
|
/datum/action/proc/Remove(mob/living/T)
|
|
if(button)
|
|
if(T.client)
|
|
T.client.screen -= button
|
|
qdel(button)
|
|
button = null
|
|
T.actions.Remove(src)
|
|
T.update_action_buttons()
|
|
owner = null
|
|
return
|
|
|
|
/datum/action/proc/Trigger()
|
|
if(!Checks())
|
|
return
|
|
switch(action_type)
|
|
if(AB_ITEM, AB_ITEM_USE_ICON)
|
|
if(target)
|
|
var/obj/item/item = target
|
|
item.ui_action_click()
|
|
//if(AB_SPELL)
|
|
// if(target)
|
|
// var/obj/effect/proc_holder/spell = target
|
|
// spell.Click()
|
|
if(AB_INNATE)
|
|
if(!active)
|
|
Activate()
|
|
else
|
|
Deactivate()
|
|
if(AB_GENERIC)
|
|
if(target && procname)
|
|
call(target,procname)(usr)
|
|
return
|
|
|
|
/datum/action/proc/Activate()
|
|
return
|
|
|
|
/datum/action/proc/Deactivate()
|
|
return
|
|
|
|
/datum/action/proc/Process()
|
|
return
|
|
|
|
/datum/action/proc/CheckRemoval(mob/living/user) // 1 if action is no longer valid for this mob and should be removed
|
|
return 0
|
|
|
|
/datum/action/proc/IsAvailable()
|
|
return Checks()
|
|
|
|
/datum/action/proc/Checks()// returns 1 if all checks pass
|
|
if(!owner)
|
|
return 0
|
|
if(check_flags & AB_CHECK_RESTRAINED)
|
|
if(owner.restrained())
|
|
return 0
|
|
if(check_flags & AB_CHECK_STUNNED)
|
|
if(owner.stunned)
|
|
return 0
|
|
if(check_flags & AB_CHECK_LYING)
|
|
if(owner.lying)
|
|
return 0
|
|
if(check_flags & AB_CHECK_ALIVE)
|
|
if(owner.stat)
|
|
return 0
|
|
if(check_flags & AB_CHECK_INSIDE)
|
|
if(!(target in owner))
|
|
return 0
|
|
return 1
|
|
|
|
/datum/action/proc/UpdateName()
|
|
return name
|
|
|
|
/obj/screen/movable/action_button
|
|
var/datum/action/owner
|
|
screen_loc = "WEST,NORTH"
|
|
|
|
/obj/screen/movable/action_button/Click(location,control,params)
|
|
var/list/modifiers = params2list(params)
|
|
if(modifiers["shift"])
|
|
moved = 0
|
|
return 1
|
|
if(usr.next_move >= world.time) // Is this needed ?
|
|
return
|
|
owner.Trigger()
|
|
return 1
|
|
|
|
/obj/screen/movable/action_button/proc/UpdateIcon()
|
|
if(!owner)
|
|
return
|
|
icon = owner.button_icon
|
|
icon_state = owner.background_icon_state
|
|
|
|
cut_overlays()
|
|
var/image/img
|
|
if(owner.action_type == AB_ITEM && owner.target)
|
|
var/obj/item/I = owner.target
|
|
img = image(I.icon, src , I.icon_state)
|
|
else if(owner.button_icon && owner.button_icon_state)
|
|
img = image(owner.button_icon,src,owner.button_icon_state)
|
|
img.pixel_x = 0
|
|
img.pixel_y = 0
|
|
add_overlay(img)
|
|
|
|
if(!owner.IsAvailable())
|
|
color = rgb(128,0,0,128)
|
|
else
|
|
color = rgb(255,255,255,255)
|
|
|
|
//Hide/Show Action Buttons ... Button
|
|
/obj/screen/movable/action_button/hide_toggle
|
|
name = "Hide Buttons"
|
|
icon = 'icons/obj/action_buttons/actions.dmi'
|
|
icon_state = "bg_default"
|
|
var/hidden = 0
|
|
|
|
/obj/screen/movable/action_button/hide_toggle/Click()
|
|
usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden
|
|
|
|
hidden = usr.hud_used.action_buttons_hidden
|
|
if(hidden)
|
|
name = "Show Buttons"
|
|
else
|
|
name = "Hide Buttons"
|
|
UpdateIcon()
|
|
usr.update_action_buttons()
|
|
|
|
|
|
/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(var/mob/living/user)
|
|
if(isalien(user))
|
|
icon_state = "bg_alien"
|
|
else
|
|
icon_state = "bg_default"
|
|
UpdateIcon()
|
|
return
|
|
|
|
/obj/screen/movable/action_button/hide_toggle/UpdateIcon()
|
|
cut_overlays()
|
|
add_overlay(hidden ? "show" : "hide")
|
|
|
|
//This is the proc used to update all the action buttons. Properly defined in /mob/living/
|
|
/mob/proc/update_action_buttons()
|
|
return
|
|
|
|
#define AB_WEST_OFFSET 4
|
|
#define AB_NORTH_OFFSET 26
|
|
#define AB_MAX_COLUMNS 10
|
|
|
|
/datum/hud/proc/ButtonNumberToScreenCoords(var/number) // TODO : Make this zero-indexed for readabilty
|
|
var/row = round((number-1)/AB_MAX_COLUMNS)
|
|
var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
|
|
var/coord_col = "+[col-1]"
|
|
var/coord_col_offset = AB_WEST_OFFSET+2*col
|
|
var/coord_row = "[-1 - row]"
|
|
var/coord_row_offset = AB_NORTH_OFFSET
|
|
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:[coord_row_offset]"
|
|
|
|
/datum/hud/proc/SetButtonCoords(var/obj/screen/button,var/number)
|
|
var/row = round((number-1)/AB_MAX_COLUMNS)
|
|
var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
|
|
var/x_offset = 32*(col-1) + AB_WEST_OFFSET + 2*col
|
|
var/y_offset = -32*(row+1) + AB_NORTH_OFFSET
|
|
|
|
var/matrix/M = matrix()
|
|
M.Translate(x_offset,y_offset)
|
|
button.transform = M
|
|
|
|
//Presets for item actions
|
|
/datum/action/item_action
|
|
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_ALIVE|AB_CHECK_INSIDE
|
|
|
|
/datum/action/item_action/CheckRemoval(mob/living/user)
|
|
return !(target in user)
|
|
|
|
/datum/action/item_action/hands_free
|
|
check_flags = AB_CHECK_ALIVE|AB_CHECK_INSIDE
|
|
|
|
/datum/action/item_action/organ
|
|
action_type = AB_ITEM_USE_ICON
|
|
button_icon = 'icons/obj/action_buttons/organs.dmi'
|
|
|
|
/datum/action/item_action/organ/SetTarget(var/atom/Target)
|
|
. = ..()
|
|
var/obj/item/organ/O = target
|
|
if(istype(O))
|
|
O.refresh_action_button()
|
|
|
|
#undef AB_WEST_OFFSET
|
|
#undef AB_NORTH_OFFSET
|
|
#undef AB_MAX_COLUMNS
|