Skip to content

Commit

Permalink
Rewrites the ability system.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 10, 2025
1 parent 299e0b6 commit 530a9dd
Show file tree
Hide file tree
Showing 73 changed files with 1,424 additions and 1,486 deletions.
25 changes: 0 additions & 25 deletions code/__defines/gamemode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,6 @@
#define DEFAULT_TELECRYSTAL_AMOUNT 130
#define IMPLANT_TELECRYSTAL_AMOUNT(x) (round(x * 0.49)) // If this cost is ever greater than half of DEFAULT_TELECRYSTAL_AMOUNT then it is possible to buy more TC than you spend

// SPELL FLAGS
#define Z2NOCAST BITFLAG(0) //if this is added, the spell can't be cast at centcomm
#define INCLUDEUSER BITFLAG(1) //does the spell include the caster in its target selection?
#define IGNOREDENSE BITFLAG(2) //are dense turfs ignored in selection?

//End split flags
#define CONSTRUCT_CHECK BITFLAG(12) //used by construct spells - checks for nullrods
#define NO_BUTTON BITFLAG(13) //spell won't show up in the HUD with this

//invocation
#define SpI_SHOUT "shout"
#define SpI_WHISPER "whisper"
#define SpI_EMOTE "emote"
#define SpI_NONE "none"

//upgrading
#define Sp_SPEED "speed"
#define Sp_POWER "power"
#define Sp_TOTAL "total"

//casting costs
#define Sp_RECHARGE "recharge"
#define Sp_CHARGES "charges"
#define Sp_HOLDVAR "holdervar"

//Voting-related
#define VOTE_PROCESS_ABORT 1
#define VOTE_PROCESS_COMPLETE 2
Expand Down
29 changes: 29 additions & 0 deletions code/_helpers/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,35 @@ var/global/next_duration_update = 0
var/global/last_round_duration = 0
var/global/round_start_time = 0

/proc/ticks2shortreadable(tick_time, separator = ":")
var/hours = round(tick_time / (1 HOUR))
var/minutes = round((tick_time % (1 HOUR)) / (1 MINUTE))
var/seconds = round((tick_time % (1 MINUTE)) / (1 SECOND))
var/out = list()

if(hours > 0)
out += "[hours]"

if(minutes > 0)
if(minutes < 10 && hours > 0)
out += "0[minutes]"
else
out += "[minutes]"
else if(hours > 0)
out += "00"

if(seconds > 0)
if(seconds < 10 && (minutes > 0 || hours > 0))
out += "0[seconds]"
else
out += "[seconds]"
else if(minutes > 0 || hours > 0)
out += "00"

if(length(out))
return jointext(out, separator)
return null

/proc/ticks2readable(tick_time)
var/hours = round(tick_time / (1 HOUR))
var/minutes = round((tick_time % (1 HOUR)) / (1 MINUTE))
Expand Down
288 changes: 0 additions & 288 deletions code/_onclick/hud/screen/screen_abilities.dm

This file was deleted.

11 changes: 8 additions & 3 deletions code/datums/extensions/abilities/abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@

/// Clicking a grab on the currently grabbed mob.
/datum/extension/abilities/proc/do_grabbed_invocation(atom/target)
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers))
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers) && !istype(target, /obj/screen))
for(var/datum/ability_handler/handler in ability_handlers)
if(handler.can_do_grabbed_invocation(holder, target) && handler.do_grabbed_invocation(holder, target))
return TRUE
return FALSE

/// Clicking an adjacent target (UnarmedAttack())
/datum/extension/abilities/proc/do_melee_invocation(atom/target)
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers))
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers) && !istype(target, /obj/screen))
for(var/datum/ability_handler/handler in ability_handlers)
if(handler.can_do_melee_invocation(holder, target) && handler.do_melee_invocation(holder, target))
return TRUE
return FALSE

/// Clicking a distant target (RangedAttack())
/datum/extension/abilities/proc/do_ranged_invocation(atom/target)
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers))
if(isliving(holder) && istype(target) && LAZYLEN(ability_handlers) && !istype(target, /obj/screen))
for(var/datum/ability_handler/handler in ability_handlers)
if(handler.can_do_ranged_invocation(holder, target) && handler.do_ranged_invocation(holder, target))
return TRUE
Expand All @@ -54,3 +54,8 @@
for(var/datum/ability_handler/handler in ability_handlers)
handler.refresh_login()

/datum/extension/abilities/proc/refresh_element_positioning()
var/row = 0
for(var/datum/ability_handler/handler in ability_handlers)
if(length(handler.screen_elements))
row += handler.refresh_element_positioning(row)
Loading

0 comments on commit 530a9dd

Please sign in to comment.