Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream-merge-8-25
Browse files Browse the repository at this point in the history
  • Loading branch information
Doubleumc committed Aug 28, 2024
1 parent 5b4d485 commit 037d5c8
Show file tree
Hide file tree
Showing 132 changed files with 39,118 additions and 30,378 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#define FACEHUG_TIER_3 100
#define FACEHUG_TIER_4 1000

/// Consecutive rounds this player has readied up and failed to get a slot.
#define PLAYER_STAT_UNASSIGNED_ROUND_STREAK "unassigned_round_streak"

// Stat Categories
#define STAT_CATEGORY_MARINE "marine"
#define STAT_CATEGORY_XENO "xeno"
#define STAT_CATEGORY_YAUTJA "yautja"
#define STAT_CATEGORY_MISC "misc"
37 changes: 37 additions & 0 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,43 @@

return null

/**
* Shuffles a provided list based on the weight of each element.
*
* Higher weight elements have a higher probability of being picked and tend to appear earlier in the list.
* Unweighted elements are never picked and are discarded.
*
* Arguments:
* * list_to_pick - assoc list in the form of: element = weight
*
* Returns list of shuffled weighted elements
*/
/proc/shuffle_weight(list/list_to_pick)
list_to_pick = list_to_pick.Copy() //not inplace

var/total_weight = 0
for(var/item in list_to_pick)
if(list_to_pick[item])
total_weight += list_to_pick[item]
else
list_to_pick -= item //discard unweighted

var/list_to_return = list()

while(length(list_to_pick))
var/target_weight = rand(1, total_weight)
for(var/item in list_to_pick)
var/item_weight = list_to_pick[item]
target_weight -= item_weight

if(target_weight <= 0)
list_to_return += item
list_to_pick -= item
total_weight -= item_weight
break

return list_to_return

/**
* Removes any null entries from the list
* Returns TRUE if the list had nulls, FALSE otherwise
Expand Down
41 changes: 41 additions & 0 deletions code/controllers/subsystem/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,43 @@ SUBSYSTEM_DEF(xeno_ai)

var/ai_kill = FALSE

//currently the only caste that has an actual targeting difference is facehugger
/// Assoc list of valid targets by hive & caste, in the form of: hive = (/caste = targets)
var/list/target_cache = list()

/datum/controller/subsystem/xeno_ai/proc/get_valid_targets(mob/living/carbon/xenomorph/xeno)
var/datum/hive_status/hive = xeno.hive
LAZYINITLIST(target_cache[hive])

var/caste = xeno.type
if(target_cache[hive][caste])
return target_cache[hive][caste]

var/list/valid_targets = list()
target_cache[hive][caste] = valid_targets

for(var/mob/living/carbon/potential_target in GLOB.alive_mob_list)
if(!potential_target.ai_can_target(xeno))
continue

valid_targets += potential_target

for(var/obj/vehicle/multitile/potential_vehicle_target as anything in GLOB.all_multi_vehicles)
if(potential_vehicle_target.health <= 0)
continue

if(hive.faction_is_ally(potential_vehicle_target.vehicle_faction))
continue

if(!length(valid_targets & potential_vehicle_target.interior.get_passengers()))
continue

valid_targets += potential_vehicle_target

valid_targets += GLOB.all_active_defenses

return valid_targets

/datum/controller/subsystem/xeno_ai/stat_entry(msg)
msg = "P:[length(ai_mobs)]"
return ..()
Expand All @@ -26,6 +63,10 @@ SUBSYSTEM_DEF(xeno_ai)
message_admins("[key_name_admin(usr)] [SSxeno_ai.ai_kill? "killed" : "revived"] all xeno AI.")

/datum/controller/subsystem/xeno_ai/fire(resumed = FALSE)
for(var/datum/hive_status/hive as anything in target_cache)
for(var/caste as anything in target_cache[hive])
target_cache[hive][caste] = null

if(ai_kill)
return

Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/bullet/pistol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
headshot_state = HEADSHOT_OVERLAY_MEDIUM
accuracy = HIT_ACCURACY_TIER_3
accuracy_var_low = PROJECTILE_VARIANCE_TIER_6
damage = 55
damage = 45
penetration = ARMOR_PENETRATION_TIER_3
shrapnel_chance = SHRAPNEL_CHANCE_TIER_2

Expand Down
154 changes: 107 additions & 47 deletions code/datums/ammo/bullet/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,30 @@
name = "shotgun slug"
handful_state = "slug_shell"

accurate_range = 6
max_range = 8
damage = 70
penetration = ARMOR_PENETRATION_TIER_4
accurate_range = 7
max_range = 14
damage = 90
penetration = ARMOR_PENETRATION_TIER_6
damage_var_low = PROJECTILE_VARIANCE_TIER_10
damage_var_high = PROJECTILE_VARIANCE_TIER_1
damage_armor_punch = 2
handful_state = "slug_shell"

/datum/ammo/bullet/shotgun/slug/on_hit_mob(mob/M,obj/projectile/P)
knockback(M, P, 6)
knockback(M, P, 8)

/datum/ammo/bullet/shotgun/slug/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(0.5) // If you ask me the KD should be left out, but players like their visual cues
target.Stun(0.5)
target.apply_effect(1, SUPERSLOW)
target.apply_effect(3, SLOW)
target.KnockDown(3.5)
target.Stun(3.5)
target.Slow(5)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.apply_effect(1, SUPERSLOW)
living_mob.apply_effect(2, SLOW)
living_mob.KnockDown(2)
living_mob.Stun(2)
living_mob.Superslow(5)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

Expand All @@ -42,11 +44,9 @@
handful_state = "beanbag_slug"
icon_state = "beanbag"
flags_ammo_behavior = AMMO_BALLISTIC|AMMO_IGNORE_RESIST
sound_override = 'sound/weapons/gun_shotgun_riot.ogg'

max_range = 12
shrapnel_chance = 0
damage = 0
damage = 20
stamina_damage = 45
accuracy = HIT_ACCURACY_TIER_3
shell_speed = AMMO_SPEED_TIER_3
Expand Down Expand Up @@ -127,19 +127,36 @@

accuracy_var_low = PROJECTILE_VARIANCE_TIER_5
accuracy_var_high = PROJECTILE_VARIANCE_TIER_5
accurate_range = 4
max_range = 4
damage = 65
damage_var_low = PROJECTILE_VARIANCE_TIER_8
damage_var_high = PROJECTILE_VARIANCE_TIER_8
accurate_range = 7
max_range = 9
damage = 50
damage_var_low = PROJECTILE_VARIANCE_TIER_10
damage_var_high = PROJECTILE_VARIANCE_TIER_1
penetration = ARMOR_PENETRATION_TIER_1
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_3
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_7
shell_speed = AMMO_SPEED_TIER_2
damage_armor_punch = 0
pen_armor_punch = 0
handful_state = "buckshot_shell"
multiple_handful_name = TRUE

/datum/ammo/bullet/shotgun/buckshot/on_hit_mob(mob/M,obj/projectile/P)
knockback(M, P, 4)
/datum/ammo/bullet/shotgun/buckshot/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(2.5)
target.Stun(2.5)
target.Slow(4)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.KnockDown(3)
living_mob.Stun(3)
living_mob.Slow(5)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

/datum/ammo/bullet/shotgun/buckshot/incendiary
name = "incendiary buckshot shell"
handful_state = "incen_buckshot"
Expand Down Expand Up @@ -178,8 +195,8 @@
accuracy_var_low = PROJECTILE_VARIANCE_TIER_6
accuracy_var_high = PROJECTILE_VARIANCE_TIER_6
accurate_range = 4
max_range = 4
damage = 65
max_range = 6
damage = 50
damage_var_low = PROJECTILE_VARIANCE_TIER_8
damage_var_high = PROJECTILE_VARIANCE_TIER_8
penetration = ARMOR_PENETRATION_TIER_1
Expand All @@ -191,6 +208,23 @@
/datum/ammo/bullet/shotgun/spread/masterkey
damage = 20

/datum/ammo/bullet/shotgun/spread/on_hit_mob(mob/M,obj/projectile/P)
knockback(M, P, 4)
/datum/ammo/bullet/shotgun/spread/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(2.5)
target.Stun(2.5)
target.Slow(4)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.KnockDown(3)
living_mob.Stun(3)
living_mob.Slow(5)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

/datum/ammo/bullet/shotgun/spread/special
name = "additional buckshot, USCM special type"

Expand All @@ -209,24 +243,53 @@
handful_state = "heavy_buckshot"
multiple_handful_name = TRUE
bonus_projectiles_type = /datum/ammo/bullet/shotgun/heavy/buckshot/spread
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_3
accurate_range = 3
max_range = 3
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_8
accurate_range = 8
max_range = 10
damage = 75
penetration = 0
penetration = ARMOR_PENETRATION_TIER_2
shell_speed = AMMO_SPEED_TIER_2
damage_armor_punch = 0
pen_armor_punch = 0

/datum/ammo/bullet/shotgun/heavy/buckshot/on_hit_mob(mob/M,obj/projectile/P)
knockback(M,P)
knockback(M,P,5)
/datum/ammo/bullet/shotgun/heavy/buckshot/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(5)
target.Stun(5)
target.Slow(8)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.KnockDown(2)
living_mob.Stun(2)
living_mob.Slow(6)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

/datum/ammo/bullet/shotgun/heavy/buckshot/spread
name = "additional heavy buckshot"
max_range = 4
max_range = 7
scatter = SCATTER_AMOUNT_TIER_1
bonus_projectiles_amount = 0

/datum/ammo/bullet/shotgun/heavy/buckshot/spread/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(5)
target.Stun(5)
target.Slow(8)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.KnockDown(2)
living_mob.Stun(2)
living_mob.Slow(6)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

/datum/ammo/bullet/shotgun/heavy/buckshot/special
bonus_projectiles_type = /datum/ammo/bullet/shotgun/heavy/buckshot/spread/special
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_8
Expand All @@ -251,8 +314,8 @@
multiple_handful_name = TRUE
damage_type = BURN
damage = 60
accurate_range = 3
max_range = 4
accurate_range = 4
max_range = 6
bonus_projectiles_type = /datum/ammo/bullet/shotgun/heavy/buckshot/dragonsbreath/spread

/datum/ammo/bullet/shotgun/heavy/buckshot/dragonsbreath/set_bullet_traits()
Expand All @@ -264,36 +327,34 @@
/datum/ammo/bullet/shotgun/heavy/buckshot/dragonsbreath/spread
name = "additional dragon's breath"
bonus_projectiles_amount = 0
accurate_range = 4
max_range = 5 //make use of the ablaze property
shell_speed = AMMO_SPEED_TIER_4 // so they hit before the main shell stuns
shell_speed = AMMO_SPEED_TIER_4


/datum/ammo/bullet/shotgun/heavy/slug
name = "heavy shotgun slug"
handful_state = "heavy_slug"

accurate_range = 7
max_range = 8
damage = 90 //ouch.
penetration = ARMOR_PENETRATION_TIER_6
max_range = 17
damage = 120 //ouch.
penetration = ARMOR_PENETRATION_TIER_9
damage_armor_punch = 2

/datum/ammo/bullet/shotgun/heavy/slug/on_hit_mob(mob/M,obj/projectile/P)
knockback(M, P, 7)
knockback(M, P, 8)

/datum/ammo/bullet/shotgun/heavy/slug/knockback_effects(mob/living/living_mob, obj/projectile/fired_projectile)
if(iscarbonsizexeno(living_mob))
var/mob/living/carbon/xenomorph/target = living_mob
to_chat(target, SPAN_XENODANGER("You are shaken and slowed by the sudden impact!"))
target.KnockDown(0.5) // If you ask me the KD should be left out, but players like their visual cues
target.Stun(0.5)
target.apply_effect(2, SUPERSLOW)
target.apply_effect(5, SLOW)
target.KnockDown(7)
target.Stun(7)
target.Slow(10)
else
if(!isyautja(living_mob)) //Not predators.
living_mob.apply_effect(1, SUPERSLOW)
living_mob.apply_effect(2, SLOW)
living_mob.KnockDown(8)
living_mob.Stun(8)
living_mob.Superslow(15)
to_chat(living_mob, SPAN_HIGHDANGER("The impact knocks you off-balance!"))
living_mob.apply_stamina_damage(fired_projectile.ammo.damage, fired_projectile.def_zone, ARMOR_BULLET)

Expand All @@ -303,14 +364,13 @@
headshot_state = HEADSHOT_OVERLAY_MEDIUM
handful_state = "heavy_beanbag"
flags_ammo_behavior = AMMO_BALLISTIC|AMMO_IGNORE_RESIST
sound_override = 'sound/weapons/gun_shotgun_riot.ogg'

max_range = 7
shrapnel_chance = 0
damage = 0
damage = 25
stamina_damage = 100
accuracy = HIT_ACCURACY_TIER_2
shell_speed = AMMO_SPEED_TIER_2
accuracy = HIT_ACCURACY_TIER_6
shell_speed = 3

/datum/ammo/bullet/shotgun/heavy/beanbag/on_hit_mob(mob/M, obj/projectile/P)
if(!M || M == P.firer)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ammo/bullet/sniper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@

/datum/ammo/bullet/sniper/anti_materiel/vulture
damage = 400 // Fully intended to vaporize anything smaller than a mini cooper
accurate_range_min = 10
accurate_range_min = 0
handful_state = "vulture_bullet"
sound_hit = 'sound/bullets/bullet_vulture_impact.ogg'
flags_ammo_behavior = AMMO_BALLISTIC|AMMO_SNIPER|AMMO_IGNORE_COVER|AMMO_ANTIVEHICLE
Expand Down
Loading

0 comments on commit 037d5c8

Please sign in to comment.