Skip to content

Commit

Permalink
xdd
Browse files Browse the repository at this point in the history
  • Loading branch information
Git-Nivrak committed Jan 11, 2025
1 parent b8c15ec commit 5fb0f49
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 82 deletions.
31 changes: 31 additions & 0 deletions code/datums/components/tackle_counter.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/datum/component/tackle_counter
var/tackles = 0
var/reset_timer

/datum/component/tackle_counter/Initialize()
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE

reset_timer = addtimer(CALLBACK(src, PROC_REF(reset_tackle)), 4 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
RegisterSignal(parent, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(tackle_handle_lying_changed))

/datum/component/tackle_counter/proc/tackle_handle_lying_changed(mob/living/target, body_position)
SIGNAL_HANDLER
if(body_position != LYING_DOWN)
return

// Infected mobs do not have their tackle counter reset if
// they get knocked down or get up from a knockdown
if(target.status_flags & XENO_HOST)
return

reset_tackle()

/datum/component/tackle_counter/proc/reset_tackle()
UnregisterSignal(parent, COMSIG_LIVING_SET_BODY_POSITION)
qdel(src)

/datum/component/tackle_counter/proc/tackle()
tackles++
deltimer(reset_timer)
reset_timer = addtimer(CALLBACK(src, PROC_REF(reset_tackle)), 4 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
45 changes: 13 additions & 32 deletions code/modules/mob/living/carbon/xenomorph/XenoProcs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -554,42 +554,23 @@
if(pipe)
handle_ventcrawl(pipe)

/mob/living/carbon/xenomorph/proc/attempt_tackle(mob/M, tackle_mult = 1, tackle_min_offset = 0, tackle_max_offset = 0, tackle_bonus = 0)
var/datum/tackle_counter/TC = LAZYACCESS(tackle_counter, M)
if(!TC)
TC = new(tackle_min + tackle_min_offset, tackle_max + tackle_max_offset, tackle_chance*tackle_mult)
LAZYSET(tackle_counter, M, TC)
RegisterSignal(M, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(tackle_handle_lying_changed))

if (TC.tackle_reset_id)
deltimer(TC.tackle_reset_id)
TC.tackle_reset_id = null

. = TC.attempt_tackle(tackle_bonus)
if (!. || (M.status_flags & XENO_HOST))
TC.tackle_reset_id = addtimer(CALLBACK(src, PROC_REF(reset_tackle), M), 4 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
else
reset_tackle(M)

/mob/living/carbon/xenomorph/proc/tackle_handle_lying_changed(mob/living/M, body_position)
SIGNAL_HANDLER
if(body_position != LYING_DOWN)
return
/mob/living/carbon/xenomorph/proc/attempt_tackle(mob/target, tackle_mult = 1, tackle_min_offset = 0, tackle_max_offset = 0, tackle_bonus = 0)
var/datum/component/tackle_counter/tackle_counter = target.GetComponent(/datum/component/tackle_counter)

// Infected mobs do not have their tackle counter reset if
// they get knocked down or get up from a knockdown
if(M.status_flags & XENO_HOST)
return
if(!tackle_counter)
tackle_counter = target.AddComponent(/datum/component/tackle_counter)

reset_tackle(M)
tackle_counter.tackle()

/mob/living/carbon/xenomorph/proc/reset_tackle(mob/M)
var/datum/tackle_counter/TC = LAZYACCESS(tackle_counter, M)
if (TC)
qdel(TC)
LAZYREMOVE(tackle_counter, M)
UnregisterSignal(M, COMSIG_LIVING_SET_BODY_POSITION)
if(tackle_counter.tackles >= tackle_max + tackle_max_offset)
. = TRUE
else if (tackle_counter.tackles < tackle_min + tackle_min_offset)
. = FALSE
else if (prob(tackle_chance * tackle_mult))
. = TRUE

if(.)
tackle_counter.reset_tackle()

/mob/living/carbon/xenomorph/burn_skin(burn_amount)
if(HAS_TRAIT(src, TRAIT_ABILITY_BURROWED))
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
// 3x fire damage
fire_vulnerability_mult = FIRE_MULTIPLIER_DEADLY

tackle_min = 2
tackle_max = 6
tackle_min = 3
tackle_max = 7
tackle_chance = 25
tacklestrength_min = 3
tacklestrength_max = 4
tacklestrength_min = 2
tacklestrength_max = 3

minimum_evolve_time = 15 MINUTES

Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Burrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

behavior_delegate_type = /datum/behavior_delegate/burrower_base

tackle_min = 3
tackle_max = 5
tackle_min = 4
tackle_max = 6
tackle_chance = 40
tacklestrength_min = 4
tacklestrength_max = 5
tacklestrength_min = 3
tacklestrength_max = 4

burrow_cooldown = 20
tunnel_cooldown = 70
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Carrier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
huggers_max = 16
eggs_max = 8

tackle_min = 2
tackle_max = 4
tackle_min = 4
tackle_max = 6
tackle_chance = 50
tacklestrength_min = 4
tacklestrength_max = 5
tacklestrength_min = 2
tacklestrength_max = 2

aura_strength = 2
hugger_delay = 20
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Crusher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

minimum_evolve_time = 15 MINUTES

tackle_min = 2
tackle_max = 6
tackle_min = 3
tackle_max = 7
tacklestrength_min = 1
tacklestrength_max = 2
tackle_chance = 25

evolution_allowed = FALSE
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Defender.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
available_strains = list(/datum/xeno_strain/steel_crest)
behavior_delegate_type = /datum/behavior_delegate/defender_base

tackle_min = 2
tackle_max = 4
tackle_min = 3
tackle_max = 5
tacklestrength_min = 1
tacklestrength_max = 2

minimum_evolve_time = 4 MINUTES

Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
weed_level = WEED_LEVEL_STANDARD
max_build_dist = 1

tackle_min = 2
tackle_max = 4
tacklestrength_min = 3
tacklestrength_max = 4
tackle_min = 4
tackle_max = 6
tacklestrength_min = 2
tacklestrength_max = 2

aura_strength = 2

Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Hivelord.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
behavior_delegate_type = /datum/behavior_delegate/hivelord_base
max_build_dist = 1

tackle_min = 2
tackle_max = 4
tackle_min = 4
tackle_max = 6
tackle_chance = 45
tacklestrength_min = 4
tacklestrength_max = 5
tacklestrength_min = 2
tacklestrength_max = 2

aura_strength = 2.5

Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
caste_desc = "A fast, powerful backline combatant."
evolves_to = list(XENO_CASTE_RAVAGER)

tackle_min = 3
tackle_max = 7
tacklestrength_min = 1
tacklestrength_max = 2

heal_resting = 1.5

minimum_evolve_time = 9 MINUTES
Expand Down
7 changes: 5 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Praetorian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
aura_strength = 3
spit_delay = 20

tackle_min = 2
tackle_max = 5
tackle_min = 3
tackle_max = 6

tacklestrength_min = 1
tacklestrength_max = 2
tackle_chance = 45

available_strains = list(
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@

spit_delay = 25

tackle_min = 2
tackle_max = 6
tackle_min = 3
tackle_max = 7
tackle_chance = 55

aura_strength = 4
tacklestrength_min = 5
tacklestrength_max = 6
tacklestrength_min = 4
tacklestrength_max = 5

minimum_xeno_playtime = 9 HOURS
minimum_evolve_time = 0
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Ravager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
speed = XENO_SPEED_TIER_3
heal_standing = 0.66

tackle_min = 2
tackle_max = 5
tackle_min = 3
tackle_max = 6
tackle_chance = 35
tacklestrength_min = 4
tacklestrength_max = 5
tacklestrength_min = 3
tacklestrength_max = 4

evolution_allowed = FALSE
deevolves_to = list(XENO_CASTE_LURKER)
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Runner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
evolves_to = list(XENO_CASTE_LURKER)
deevolves_to = list(XENO_CASTE_LARVA)

tackle_min = 4
tackle_max = 5
tackle_min = 8
tackle_max = 10
tackle_chance = 40
tacklestrength_min = 4
tacklestrength_max = 4
tacklestrength_min = 2
tacklestrength_max = 2

heal_resting = 1.75

Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Sentinel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
deevolves_to = list(XENO_CASTE_LARVA)
acid_level = 1

tackle_min = 4
tackle_max = 4
tackle_min = 6
tackle_max = 6
tackle_chance = 50
tacklestrength_min = 4
tacklestrength_max = 4
tacklestrength_min = 3
tacklestrength_max = 3

behavior_delegate_type = /datum/behavior_delegate/sentinel_base
minimap_icon = "sentinel"
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Spitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

spit_delay = 2.5 SECONDS

tackle_min = 2
tackle_max = 6
tackle_min = 3
tackle_max = 7
tackle_chance = 45
tacklestrength_min = 4
tacklestrength_max = 5
tacklestrength_min = 3
tacklestrength_max = 4

minimum_evolve_time = 9 MINUTES

Expand Down
7 changes: 5 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
caste_desc = "A powerful front line combatant."
can_vent_crawl = 0

tackle_min = 2
tackle_max = 4
tackle_min = 3
tackle_max = 5

tacklestrength_min = 1
tacklestrength_max = 2

agility_speed_increase = -0.9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
weed_level = WEED_LEVEL_STANDARD
max_build_dist = 1

tackle_min = 4
tackle_max = 5
tackle_min = 7
tackle_max = 8

aura_strength = 1

Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
#include "code\datums\components\shimmy_around.dm"
#include "code\datums\components\speed_modifier.dm"
#include "code\datums\components\status_effect_component.dm"
#include "code\datums\components\tackle_counter.dm"
#include "code\datums\components\temporary_mute.dm"
#include "code\datums\components\toxin_buildup.dm"
#include "code\datums\components\tutorial_status.dm"
Expand Down

0 comments on commit 5fb0f49

Please sign in to comment.