Skip to content

Commit

Permalink
Merge branch 'tg-effects-part2-poc' into tg-effects-part3a-daze
Browse files Browse the repository at this point in the history
  • Loading branch information
fira committed Nov 7, 2023
2 parents 6d6d82b + d84fab8 commit 4bbf589
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
37 changes: 25 additions & 12 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@

var/list/filter_data //For handling persistent filters

// Base transform matrix
var/matrix/base_transform = null
/// Base transform matrix, edited by admin tooling and such
var/matrix/base_transform
/// Last transform used before being compound with base_transform
/// This allows us to re-create transform if only base_transform changes
var/matrix/raw_transform

///Chemistry.
var/datum/reagents/reagents = null
Expand Down Expand Up @@ -149,21 +152,28 @@ directive is properly returned.
return loc.return_gas()

// Updates the atom's transform
/atom/proc/apply_transform(matrix/M, time = 0, easing = (EASE_IN|EASE_OUT))
if(!base_transform)
transform = M
return
/atom/proc/apply_transform(matrix/new_transform, time = 0, easing = (EASE_IN|EASE_OUT))
var/matrix/base_copy
if(base_transform)
base_copy = matrix(base_transform)
else
base_copy = matrix()
raw_transform = matrix(new_transform) // Keep a copy to replay if needed

var/matrix/base_copy = matrix(base_transform)
// Compose the base and applied transform in that order
var/matrix/complete = base_copy.Multiply(M)
var/matrix/complete = base_copy.Multiply(raw_transform)

if(!time)
transform = complete
return

animate(src, transform = complete, time = time, easing = easing)

/// Upates the base_transform which will be compounded with other transforms
/atom/proc/update_base_transform(matrix/new_transform, time = 0)
base_transform = matrix(new_transform)
apply_transform(raw_transform, time)

/atom/proc/on_reagent_change()
return

Expand Down Expand Up @@ -715,7 +725,7 @@ Parameters are passed from New.
var/result = tgui_input_list(usr, "Choose the transformation to apply","Transform Mod", list("Scale","Translate","Rotate"))
if(!result)
return
var/matrix/M = transform
var/matrix/M = base_transform
if(!result)
return
switch(result)
Expand All @@ -724,18 +734,21 @@ Parameters are passed from New.
var/y = tgui_input_real_number(usr, "Choose y mod","Transform Mod")
if(isnull(x) || isnull(y))
return
transform = M.Scale(x,y)
var/matrix/base_matrix = matrix(base_transform)
update_base_transform(base_matrix.Scale(x,y))
if("Translate")
var/x = tgui_input_real_number(usr, "Choose x mod (negative = left, positive = right)","Transform Mod")
var/y = tgui_input_real_number(usr, "Choose y mod (negative = down, positive = up)","Transform Mod")
if(isnull(x) || isnull(y))
return
transform = M.Translate(x,y)
var/matrix/base_matrix = matrix(base_transform)
update_base_transform(base_matrix.Translate(x,y))
if("Rotate")
var/angle = tgui_input_real_number(usr, "Choose angle to rotate","Transform Mod")
if(isnull(angle))
return
transform = M.Turn(angle)
var/matrix/base_matrix = matrix(base_transform)
update_base_transform(base_matrix.Turn(angle))

SEND_SIGNAL(src, COMSIG_ATOM_VV_MODIFY_TRANSFORM)

Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
var/knockout_value = damage * 0.1
var/knockout_minus_armor = min(knockout_value * bomb_armor_mult * 0.5, 0.5 SECONDS) // the KO time is halved from the knockdown timer. basically same stun time, you just spend less time KO'd.
apply_effect(round(knockout_minus_armor), PARALYZE)
apply_effect(round(knockout_minus_armor), STUN) // Remove this to let people crawl after an explosion. Funny but perhaps not desirable.
apply_effect(round(knockout_minus_armor) * 2, DAZE)
explosion_throw(severity, direction)

Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/xenomorph/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
powerfactor_value = min(powerfactor_value,20)
if(powerfactor_value > 0 && small_explosives_stun)
KnockDown(powerfactor_value/5)
Stun(powerfactor_value/5) // Due to legacy knockdown being considered an impairement
if(mob_size < MOB_SIZE_BIG)
Slow(powerfactor_value)
Superslow(powerfactor_value/2)
Expand Down

0 comments on commit 4bbf589

Please sign in to comment.