mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-14 02:43:16 +00:00
Makes the code compatible with 515.1594+
Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword
And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.
@tgstation/commit-access Since the .proc/stuff is pretty big change.
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
189 lines
5.5 KiB
Plaintext
189 lines
5.5 KiB
Plaintext
/datum/action/item_action/mod
|
|
background_icon_state = "bg_mod"
|
|
icon_icon = 'icons/mob/actions/actions_mod.dmi'
|
|
check_flags = AB_CHECK_CONSCIOUS
|
|
/// Whether this action is intended for the AI. Stuff breaks a lot if this is done differently.
|
|
var/ai_action = FALSE
|
|
|
|
/datum/action/item_action/mod/New(Target)
|
|
..()
|
|
if(!istype(Target, /obj/item/mod/control))
|
|
qdel(src)
|
|
return
|
|
if(ai_action)
|
|
background_icon_state = ACTION_BUTTON_DEFAULT_BACKGROUND
|
|
|
|
/datum/action/item_action/mod/Grant(mob/user)
|
|
var/obj/item/mod/control/mod = target
|
|
if(ai_action && user != mod.ai)
|
|
return
|
|
else if(!ai_action && user == mod.ai)
|
|
return
|
|
return ..()
|
|
|
|
/datum/action/item_action/mod/Remove(mob/user)
|
|
var/obj/item/mod/control/mod = target
|
|
if(ai_action && user != mod.ai)
|
|
return
|
|
else if(!ai_action && user == mod.ai)
|
|
return
|
|
return ..()
|
|
|
|
/datum/action/item_action/mod/Trigger(trigger_flags)
|
|
if(!IsAvailable(feedback = TRUE))
|
|
return FALSE
|
|
var/obj/item/mod/control/mod = target
|
|
if(mod.malfunctioning && prob(75))
|
|
mod.balloon_alert(usr, "button malfunctions!")
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/datum/action/item_action/mod/deploy
|
|
name = "Deploy MODsuit"
|
|
desc = "LMB: Deploy/Undeploy part. RMB: Deploy/Undeploy full suit."
|
|
button_icon_state = "deploy"
|
|
|
|
/datum/action/item_action/mod/deploy/Trigger(trigger_flags)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
var/obj/item/mod/control/mod = target
|
|
if(trigger_flags & TRIGGER_SECONDARY_ACTION)
|
|
mod.quick_deploy(usr)
|
|
else
|
|
mod.choose_deploy(usr)
|
|
|
|
/datum/action/item_action/mod/deploy/ai
|
|
ai_action = TRUE
|
|
|
|
/datum/action/item_action/mod/activate
|
|
name = "Activate MODsuit"
|
|
desc = "LMB: Activate/Deactivate suit with prompt. RMB: Activate/Deactivate suit skipping prompt."
|
|
button_icon_state = "activate"
|
|
/// First time clicking this will set it to TRUE, second time will activate it.
|
|
var/ready = FALSE
|
|
|
|
/datum/action/item_action/mod/activate/Trigger(trigger_flags)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
if(!(trigger_flags & TRIGGER_SECONDARY_ACTION) && !ready)
|
|
ready = TRUE
|
|
button_icon_state = "activate-ready"
|
|
UpdateButtons()
|
|
addtimer(CALLBACK(src, PROC_REF(reset_ready)), 3 SECONDS)
|
|
return
|
|
var/obj/item/mod/control/mod = target
|
|
reset_ready()
|
|
mod.toggle_activate(usr)
|
|
|
|
/// Resets the state requiring to be doubleclicked again.
|
|
/datum/action/item_action/mod/activate/proc/reset_ready()
|
|
ready = FALSE
|
|
button_icon_state = initial(button_icon_state)
|
|
UpdateButtons()
|
|
|
|
/datum/action/item_action/mod/activate/ai
|
|
ai_action = TRUE
|
|
|
|
/datum/action/item_action/mod/module
|
|
name = "Toggle Module"
|
|
desc = "Toggle a MODsuit module."
|
|
button_icon_state = "module"
|
|
|
|
/datum/action/item_action/mod/module/Trigger(trigger_flags)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
var/obj/item/mod/control/mod = target
|
|
mod.quick_module(usr)
|
|
|
|
/datum/action/item_action/mod/module/ai
|
|
ai_action = TRUE
|
|
|
|
/datum/action/item_action/mod/panel
|
|
name = "MODsuit Panel"
|
|
desc = "Open the MODsuit's panel."
|
|
button_icon_state = "panel"
|
|
|
|
/datum/action/item_action/mod/panel/Trigger(trigger_flags)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
var/obj/item/mod/control/mod = target
|
|
mod.ui_interact(usr)
|
|
|
|
/datum/action/item_action/mod/panel/ai
|
|
ai_action = TRUE
|
|
|
|
/datum/action/item_action/mod/pinned_module
|
|
desc = "Activate the module."
|
|
/// Overrides the icon applications.
|
|
var/override = FALSE
|
|
/// Module we are linked to.
|
|
var/obj/item/mod/module/module
|
|
/// A ref to the mob we are pinned to.
|
|
var/pinner_ref
|
|
|
|
/datum/action/item_action/mod/pinned_module/New(Target, obj/item/mod/module/linked_module, mob/user)
|
|
if(isAI(user))
|
|
ai_action = TRUE
|
|
..()
|
|
module = linked_module
|
|
name = "Activate [capitalize(linked_module.name)]"
|
|
desc = "Quickly activate [linked_module]."
|
|
icon_icon = linked_module.icon
|
|
button_icon_state = linked_module.icon_state
|
|
RegisterSignal(linked_module, COMSIG_MODULE_ACTIVATED, PROC_REF(on_module_activate))
|
|
RegisterSignal(linked_module, COMSIG_MODULE_DEACTIVATED, PROC_REF(on_module_deactivate))
|
|
RegisterSignal(linked_module, COMSIG_MODULE_USED, PROC_REF(on_module_use))
|
|
|
|
/datum/action/item_action/mod/pinned_module/Destroy()
|
|
module.pinned_to -= pinner_ref
|
|
module = null
|
|
return ..()
|
|
|
|
/datum/action/item_action/mod/pinned_module/Grant(mob/user)
|
|
var/user_ref = REF(user)
|
|
if(!pinner_ref)
|
|
pinner_ref = user_ref
|
|
module.pinned_to[pinner_ref] = src
|
|
else if(pinner_ref != user_ref)
|
|
return
|
|
return ..()
|
|
|
|
/datum/action/item_action/mod/pinned_module/Trigger(trigger_flags)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
module.on_select()
|
|
|
|
/datum/action/item_action/mod/pinned_module/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force)
|
|
. = ..(current_button, force = TRUE)
|
|
if(override)
|
|
return
|
|
var/obj/item/mod/control/mod = target
|
|
if(module == mod.selected_module)
|
|
current_button.add_overlay(image(icon = 'icons/hud/radial.dmi', icon_state = "module_selected", layer = FLOAT_LAYER-0.1))
|
|
else if(module.active)
|
|
current_button.add_overlay(image(icon = 'icons/hud/radial.dmi', icon_state = "module_active", layer = FLOAT_LAYER-0.1))
|
|
if(!COOLDOWN_FINISHED(module, cooldown_timer))
|
|
var/image/cooldown_image = image(icon = 'icons/hud/radial.dmi', icon_state = "module_cooldown")
|
|
current_button.add_overlay(cooldown_image)
|
|
addtimer(CALLBACK(current_button, TYPE_PROC_REF(/image, cut_overlay), cooldown_image), COOLDOWN_TIMELEFT(module, cooldown_timer))
|
|
|
|
/datum/action/item_action/mod/pinned_module/proc/on_module_activate(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
UpdateButtons()
|
|
|
|
/datum/action/item_action/mod/pinned_module/proc/on_module_deactivate(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
UpdateButtons()
|
|
|
|
/datum/action/item_action/mod/pinned_module/proc/on_module_use(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
UpdateButtons()
|