Skip to content

Commit

Permalink
Merge branch 'master' into lt_Prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndroBetel committed Sep 4, 2024
2 parents b15e3ee + 3bd0948 commit 215c50b
Show file tree
Hide file tree
Showing 215 changed files with 3,494 additions and 2,474 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"
30 changes: 30 additions & 0 deletions code/__DEFINES/strippable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// All of these must be matched in StripMenu.js.
#define STRIPPABLE_ITEM_HEAD "head"
#define STRIPPABLE_ITEM_BACK "back"
#define STRIPPABLE_ITEM_MASK "wear_mask"
#define STRIPPABLE_ITEM_EYES "glasses"
#define STRIPPABLE_ITEM_L_EAR "wear_l_ear"
#define STRIPPABLE_ITEM_R_EAR "wear_r_ear"
#define STRIPPABLE_ITEM_JUMPSUIT "w_uniform"
#define STRIPPABLE_ITEM_SUIT "wear_suit"
#define STRIPPABLE_ITEM_GLOVES "gloves"
#define STRIPPABLE_ITEM_FEET "shoes"
#define STRIPPABLE_ITEM_SUIT_STORAGE "j_store"
#define STRIPPABLE_ITEM_ID "id"
#define STRIPPABLE_ITEM_BELT "belt"
#define STRIPPABLE_ITEM_LPOCKET "l_store"
#define STRIPPABLE_ITEM_RPOCKET "r_store"
#define STRIPPABLE_ITEM_LHAND "l_hand"
#define STRIPPABLE_ITEM_RHAND "r_hand"
#define STRIPPABLE_ITEM_HANDCUFFS "handcuffs"
#define STRIPPABLE_ITEM_LEGCUFFS "legcuffs"


/// This slot is not obscured.
#define STRIPPABLE_OBSCURING_NONE 0

/// This slot is completely obscured, and cannot be accessed.
#define STRIPPABLE_OBSCURING_COMPLETELY 1

/// This slot can't be seen, but can be accessed.
#define STRIPPABLE_OBSCURING_HIDDEN 2
37 changes: 37 additions & 0 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,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
5 changes: 5 additions & 0 deletions code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
#define LAZYREMOVEASSOC(L, K, V) if(L) { if(L[K]) { L[K] -= V; if(!length(L[K])) L -= K; } if(!length(L)) L = null; }
///Accesses an associative list, returns null if nothing is found
#define LAZYACCESSASSOC(L, I, K) L ? L[I] ? L[I][K] ? L[I][K] : null : null : null
///Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made.
#define LAZYORASSOCLIST(lazy_list, key, value) \
LAZYINITLIST(lazy_list); \
LAZYINITLIST(lazy_list[key]); \
lazy_list[key] |= value;

// Insert an object A into a sorted list using cmp_proc (/code/_helpers/cmp.dm) for comparison.
#define ADD_SORTED(list, A, cmp_proc) if(!list.len) {list.Add(A)} else {list.Insert(FindElementIndex(A, list, cmp_proc), A)}
Expand Down
5 changes: 2 additions & 3 deletions code/_onclick/click_hold.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@

/client/MouseDrop(datum/over_object, datum/src_location, over_location, src_control, over_control, params)
. = ..()
if(over_object)
SEND_SIGNAL(over_object, COMSIG_ATOM_DROP_ON, src_location, src)

if(src_location)
SEND_SIGNAL(src_location, COMSIG_ATOM_DROPPED_ON, over_object, src)

if(over_object)
SEND_SIGNAL(over_object, COMSIG_ATOM_DROP_ON, src_location, src)
1 change: 1 addition & 0 deletions code/_onclick/drag_drop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
/atom/MouseDrop(atom/over)
if(!usr || !over) return

if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows

spawn(0)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/item_cleanup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var/global/list/item_cleanup_list = list()
SUBSYSTEM_DEF(item_cleanup)
name = "Item Cleanup"
wait = 10 MINUTES //should be adjusted for WO
var/start_processing_time = 35 MINUTES //should be adjusted for WO
var/start_processing_time = INFINITY //should be adjusted for WO
var/percentage_of_garbage_to_delete = 0.5 //should be adjusted for WO
//We keep a separate, private list
//So we don't get instant deletions of items
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
Loading

0 comments on commit 215c50b

Please sign in to comment.