Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xeno_defines.dm reorganisation #5146

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,50 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
xeno_prefix = "XX"
if(!xeno_postfix || xeno_name_ban)
xeno_postfix = ""

/// playtime for all castes
/client/proc/get_total_xeno_playtime(skip_cache = FALSE)
if(cached_xeno_playtime && !skip_cache)
return cached_xeno_playtime

var/total_xeno_playtime = 0

for(var/caste in GLOB.RoleAuthority.castes_by_name)
total_xeno_playtime += get_job_playtime(src, caste)

total_xeno_playtime += get_job_playtime(src, JOB_XENOMORPH)

if(player_entity)
var/past_xeno_playtime = player_entity.get_playtime(STATISTIC_XENO)
if(past_xeno_playtime)
total_xeno_playtime += past_xeno_playtime


cached_xeno_playtime = total_xeno_playtime

return total_xeno_playtime

/// playtime for drone and drone evolution castes
/client/proc/get_total_drone_playtime()
var/total_drone_playtime = 0

var/list/drone_evo_castes = list(XENO_CASTE_DRONE, XENO_CASTE_CARRIER, XENO_CASTE_BURROWER, XENO_CASTE_HIVELORD, XENO_CASTE_QUEEN)

for(var/caste in GLOB.RoleAuthority.castes_by_name)
if(!(caste in drone_evo_castes))
continue
total_drone_playtime += get_job_playtime(src, caste)

return total_drone_playtime

/// playtime for t3 castes and queen
/client/proc/get_total_t3_playtime()
var/total_t3_playtime = 0
var/datum/caste_datum/caste
for(var/caste_name in GLOB.RoleAuthority.castes_by_name)
caste = GLOB.RoleAuthority.castes_by_name[caste_name]
if(caste.tier < 3)
continue
total_t3_playtime += get_job_playtime(src, caste_name)

return total_t3_playtime
185 changes: 185 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/castes/caste_datum.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
// Actual caste datum basedef
/datum/caste_datum
var/caste_type = ""
var/display_name = ""
var/tier = 0
var/dead_icon = "Drone Dead"
var/language = LANGUAGE_XENOMORPH
var/melee_damage_lower = 10
var/melee_damage_upper = 20
///allows fine tuning melee damage to vehicles per caste.
var/melee_vehicle_damage = 10
var/evasion = XENO_EVASION_NONE

var/speed = XENO_SPEED_TIER_10

var/plasma_max = 10
var/plasma_gain = 5

var/crystal_max = 0

var/max_health = XENO_UNIVERSAL_HPMULT * 100
///Are they allowed to evolve (and have their evolution progress group)
var/evolution_allowed = 1
///Threshold to next evolution
var/evolution_threshold = 0
/// whether they can get evo points without needing an ovi queen
var/evolve_without_queen = FALSE
///This is where you add castes to evolve into. "Separated", "by", "commas"
var/list/evolves_to = list()
/// what caste or castes to de-evolve to.
var/list/deevolves_to = list()
///If they can use consoles, etc. Set on Queen
var/is_intelligent = 0
var/caste_desc = null

// Tackles
var/tackle_min = 2
var/tackle_max = 6
var/tackle_chance = 35
var/tacklestrength_min = 2
var/tacklestrength_max = 3

///Chance of deflecting projectiles.
var/armor_deflection = 0
var/fire_immunity = FIRE_IMMUNITY_NONE
var/fire_intensity_resistance = 0

///Delay timer for spitting
var/spit_delay = 60

/// Windup for spits
var/spit_windup = FALSE

///The strength of our aura. Zero means we can't emit one
var/aura_strength = 0

///"Evolving" removed for the time being
var/aura_allowed = list("frenzy", "warding", "recovery")

///Adjust pixel size. 0.x is smaller, 1.x is bigger, percentage based.
var/adjust_size_x = 1
var/adjust_size_y = 1

///list of datum projectile types the xeno can use.
var/list/spit_types

var/attack_delay = 0 //Bonus or pen to time in between attacks. + makes slashes slower.

var/agility_speed_increase = 0 // this opens up possibilities for balancing

// The type of mutator delegate to instantiate on the base caste. Will
// be replaced when the Xeno chooses a strain.
var/behavior_delegate_type = /datum/behavior_delegate

// Resin building-related vars
/// Default build time and build distance
var/build_time_mult = BUILD_TIME_MULT_XENO
var/max_build_dist = 0

// Carrier vars //

/// if a hugger is held in hand, won't attempt to leap and kill itself
var/hugger_nurturing = FALSE
var/huggers_max = 0
var/throwspeed = 0
var/hugger_delay = 0
var/eggs_max = 0
var/egg_cooldown = 30
///Armor but for explosions
var/xeno_explosion_resistance = 0

//Queen vars
var/can_hold_facehuggers = 0
var/can_hold_eggs = CANNOT_HOLD_EGGS

var/can_be_queen_healed = TRUE
var/can_be_revived = TRUE

var/can_vent_crawl = 1

var/caste_luminosity = 0

/// if fire_immunity is set to be vulnerable, how much will fire damage be multiplied. Defines in xeno.dm
var/fire_vulnerability_mult = 0

var/burrow_cooldown = 5 SECONDS
var/tunnel_cooldown = 100
var/widen_cooldown = 10 SECONDS
///Big strong ability, big cooldown.
var/tremor_cooldown = 30 SECONDS
///whether the xeno heals even outside weeds.
var/innate_healing = FALSE

var/acid_level = 0
var/weed_level = WEED_LEVEL_STANDARD
///Time it takes between acid splash retaliate procs. Variable per caste, for if we want future castes that are acid bombs
var/acid_splash_cooldown = 3 SECONDS

// regen vars

var/heal_delay_time = 0 SECONDS
var/heal_resting = 1
var/heal_standing = 0.4
var/heal_knocked_out = 0.33

var/list/resin_build_order
var/minimum_xeno_playtime = 0

// cannot evolve to this caste until the round has been going on for this amount of time
// IMPORTANT: this is ROUND_TIME, not world.time
var/minimum_evolve_time = 1 MINUTES
/// Iconstate for the xeno on the minimap
var/minimap_icon = "xeno"
///The iconstate for leadered xenos on the minimap, added as overlay
var/minimap_leadered_overlay = "xenoleader"

var/royal_caste = FALSE


/datum/caste_datum/can_vv_modify()
return FALSE

/datum/caste_datum/New()
. = ..()

//Initialise evolution and upgrade thresholds in one place, once and for all
evolution_threshold = 0
if(evolution_allowed)
switch(tier)
if(0)
evolution_threshold = 60
if(1)
evolution_threshold = 200
if(2)
evolution_threshold = 500
//Other tiers (T3, Queen, etc.) can't evolve anyway

resin_build_order = GLOB.resin_build_order_drone

/client/var/cached_xeno_playtime

/datum/caste_datum/proc/can_play_caste(client/client)
if(!CONFIG_GET(flag/use_timelocks))
return TRUE

var/total_xeno_playtime = client.get_total_xeno_playtime()

if(minimum_xeno_playtime && total_xeno_playtime < minimum_xeno_playtime)
return FALSE

return TRUE

/datum/caste_datum/proc/get_caste_requirement(client/client)
return minimum_xeno_playtime - client.get_total_xeno_playtime()

/datum/caste_datum/proc/get_minimap_icon()
var/image/background = mutable_appearance('icons/ui_icons/map_blips.dmi', "background")
background.color = MINIMAP_ICON_BACKGROUND_XENO

var/iconstate = minimap_icon ? minimap_icon : "unknown"
var/mutable_appearance/icon = image('icons/ui_icons/map_blips.dmi', icon_state = iconstate)
icon.appearance_flags = RESET_COLOR
background.overlays += icon

return background
Loading