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

tweak: blob update #6113

Draft
wants to merge 15 commits into
base: master220
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions code/__DEFINES/MC.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
/datum/controller/subsystem/processing/##X/fire() {..() /*just so it shows up on the profiler*/} \
/datum/controller/subsystem/processing/##X

#define FLUID_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/fluids/##X);\
/datum/controller/subsystem/fluids/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/fluids/##X/fire() {..() /*just so it shows up on the profiler*/} \
/datum/controller/subsystem/fluids/##X

#define TIMER_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/timer/##X);\
/datum/controller/subsystem/timer/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
Expand Down
139 changes: 138 additions & 1 deletion code/__DEFINES/blob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define THIRD_STAGE_COEF 0.75
#define FIRST_STAGE_THRESHOLD 300
#define SECOND_STAGE_THRESHOLD 400
#define THIRD_STAGE_DELTA_THRESHOLD 250
#define BLOB_STAGE_NONE -1
#define BLOB_STAGE_ZERO 0
#define BLOB_STAGE_FIRST 1
Expand Down Expand Up @@ -48,9 +49,145 @@
#define FIRST_STAGE_WARN span_userdanger("Вы чувствуете усталость и раздутость.")
#define SECOND_STAGE_WARN span_userdanger("Вы чувствуете, что вот-вот лопнете.")

#define isblobbernaut(M) istype((M), /mob/living/simple_animal/hostile/blob/blobbernaut)
#define isblobbernaut(M) istype((M), /mob/living/simple_animal/hostile/blob_minion/blobbernaut)

#define TOTAL_BLOB_MASS SSticker?.mode?.legit_blobs?.len
#define NEEDED_BLOB_MASS SSticker?.mode?.blob_win_count

//Few global vars to track the blob
GLOBAL_LIST_EMPTY(blobs)
GLOBAL_LIST_EMPTY(blob_cores)
GLOBAL_LIST_EMPTY(blob_nodes)

// Overmind defines

#define OVERMIND_MAX_POINTS_DEFAULT 100 // Max point storage
#define OVERMIND_STARTING_POINTS 60 // Points granted upon start
#define OVERMIND_STARTING_REROLLS 1 // Free strain rerolls at the start
#define OVERMIND_MAX_CAMERA_STRAY "3x3" // How far the overmind camera is allowed to stray from blob tiles. 3x3 is 1 tile away, 5x5 2 tiles etc


// Generic blob defines

#define BLOB_BASE_POINT_RATE 2 // Base amount of points per process()
#define BLOB_EXPAND_COST 4 // Price to expand onto a new tile
#define BLOB_ZOMBIFICATION_COST 5
#define BLOB_ATTACK_REFUND 2 // Points 'refunded' when the expand attempt actually attacks something instead
#define BLOB_BRUTE_RESIST 0.5 // Brute damage taken gets multiplied by this value
#define BLOB_FIRE_RESIST 1 // Burn damage taken gets multiplied by this value
#define BLOB_EXPAND_CHANCE_MULTIPLIER 1 // Increase this value to make blobs naturally expand faster
#define BLOB_REINFORCE_CHANCE 2.5 // The seconds_per_tick chance for cores/nodes to reinforce their surroundings
#define BLOB_REAGENTATK_VOL 25 // Amount of strain-reagents that get injected when the blob attacks: main source of blob damage
#define BLOB_REAGENSPORE_VOL 10
#define BLOB_BONUS_POINTS 60
#define BLOB_REAGENTS_METABOLISM 1


// Structure properties

#define BLOB_CORE_MAX_HP 400
#define BLOB_CORE_HP_REGEN 2 // Bases health regeneration rate every process(), can be added on by strains
#define BLOB_CORE_CLAIM_RANGE 12 // Range in which blob tiles are 'claimed' (converted from dead to alive, rarely useful)
#define BLOB_CORE_PULSE_RANGE 4 // The radius up to which the core activates structures, and up to which structures can be built
#define BLOB_CORE_EXPAND_RANGE 3 // Radius of automatic expansion
#define BLOB_CORE_STRONG_REINFORCE_RANGE 1 // The radius of tiles surrounding the core that get upgraded
#define BLOB_CORE_REFLECTOR_REINFORCE_RANGE 0
#define BLOB_CORE_FIRE_RESIST 2
#define BLOB_CORE_POINT_RATE 2

#define BLOB_NODE_MAX_HP 200
#define BLOB_NODE_HP_REGEN 3
#define BLOB_NODE_MIN_DISTANCE 5 // Minimum distance between nodes
#define BLOB_NODE_CLAIM_RANGE 10
#define BLOB_NODE_PULSE_RANGE 3 // The radius up to which the core activates structures, and up to which structures can be built
#define BLOB_NODE_EXPAND_RANGE 2 // Radius of automatic expansion
#define BLOB_NODE_STRONG_REINFORCE_RANGE 0 // The radius of tiles surrounding the node that get upgraded
#define BLOB_NODE_REFLECTOR_REINFORCE_RANGE 0

#define BLOB_FACTORY_MAX_HP 200
#define BLOB_FACTORY_HP_REGEN 1
#define BLOB_FACTORY_MIN_DISTANCE 7 // Minimum distance between factories
#define BLOB_FACTORY_MAX_SPORES 3

#define BLOB_RESOURCE_MAX_HP 60
#define BLOB_RESOURCE_HP_REGEN 15
#define BLOB_RESOURCE_MIN_DISTANCE 4 // Minimum distance between resource blobs
#define BLOB_RESOURCE_GATHER_DELAY (4 SECONDS) // Gather points when pulsed outside this interval
#define BLOB_RESOURCE_GATHER_ADDED_DELAY (0.25 SECONDS) // Every additional resource blob adds this amount to the gather delay
#define BLOB_RESOURCE_POINT_RATE 1

#define BLOB_REGULAR_MAX_HP 25
#define BLOB_REGULAR_HP_INIT 21 // The starting HP of a normal blob tile
#define BLOB_REGULAR_HP_REGEN 1 // Health regenerated when pulsed by a node/core

#define BLOB_STRONG_MAX_HP 150
#define BLOB_STRONG_HP_REGEN 2
#define BLOB_STRONG_BRUTE_RESIST 0.25 // Brute damage taken gets multiplied by this value

#define BLOB_CAP_NUKE_MAX_HP 100
#define BLOB_CAP_NUKE_HP_REGEN 1

#define BLOB_REFLECTOR_MAX_HP 150
#define BLOB_REFLECTOR_HP_REGEN 2

#define BLOB_STORAGE_MAX_HP 30
#define BLOB_STORAGE_MAX_POINTS_BONUS 50
#define BLOB_STORAGE_MIN_DISTANCE 3
#define BLOB_STORAGE_FIRE_RESIST 2


// Structure purchasing

#define BLOB_UPGRADE_STRONG_COST 15 // Upgrade and build costs here
#define BLOB_UPGRADE_REFLECTOR_COST 15
#define BLOB_STRUCTURE_RESOURCE_COST 40
#define BLOB_STRUCTURE_STORAGE_COST 40
#define BLOB_STRUCTURE_FACTORY_COST 60
#define BLOB_STRUCTURE_NODE_COST 50
#define BLOB_CORE_SPLIT_COST 100

#define BLOB_REFUND_STRONG_COST 4 // Points refunded when destroying the structure
#define BLOB_REFUND_REFLECTOR_COST 4
#define BLOB_REFUND_RESOURCE_COST 15
#define BLOB_REFUND_FACTORY_COST 25
#define BLOB_REFUND_NODE_COST 25
#define BLOB_REFUND_STORAGE_COST 12
#define BLOB_REFUND_CORE_COST -1
#define BLOB_REFUND_CAP_NUKE_COST 0

// Blob power properties

#define BLOB_POWER_RELOCATE_COST 80 // Resource cost to move your core to a different node
#define BLOB_POWER_REROLL_COST 40 // Strain reroll
#define BLOB_POWER_REROLL_FREE_TIME (4 MINUTES) // Gain a free strain reroll every x minutes
#define BLOB_POWER_REROLL_CHOICES 6 // Possibilities to choose from; keep in mind increasing this might fuck with the radial menu


// Mob defines

#define BLOBMOB_HEALING_MULTIPLIER 0.0125 // Multiplies by -maxHealth and heals the blob by this amount every blob_act
#define BLOBMOB_SPORE_HEALTH 30 // Base spore health
#define BLOBMOB_SPORE_SPAWN_COOLDOWN (8 SECONDS)
#define BLOBMOB_SPORE_DMG_LOWER 3
#define BLOBMOB_SPORE_DMG_UPPER 7
#define BLOBMOB_SPORE_OBJ_DMG 20
#define BLOBMOB_SPORE_SPEED_MOD -1.5
#define BLOBMOB_ZOMBIE_HEALTH 70 // Base spore health
#define BLOBMOB_ZOMBIE_DMG_LOWER 10
#define BLOBMOB_ZOMBIE_DMG_UPPER 15
#define BLOBMOB_ZOMBIE_OBJ_DMG 20
#define BLOBMOB_ZOMBIE_SPEED_MOD -1
#define BLOBMOB_BLOBBERNAUT_RESOURCE_COST 40 // Purchase price for making a blobbernaut
#define BLOBMOB_BLOBBERNAUT_HEALTH 200 // Base blobbernaut health
#define BLOBMOB_BLOBBERNAUT_DMG_SOLO_LOWER 20 // Damage without active overmind (core dead or xenobio mob)
#define BLOBMOB_BLOBBERNAUT_DMG_SOLO_UPPER 20
#define BLOBMOB_BLOBBERNAUT_DMG_LOWER 4 // Damage dealt with active overmind (most damage comes from strain chems)
#define BLOBMOB_BLOBBERNAUT_DMG_UPPER 4
#define BLOBMOB_BLOBBERNAUT_REAGENTATK_VOL 20 // Amounts of strain reagents applied on attack -- basically the main damage stat
#define BLOBMOB_BLOBBERNAUT_DMG_OBJ 60 // Damage dealth to objects/machines
#define BLOBMOB_BLOBBERNAUT_HEALING_CORE 0.05 // Percentage multiplier HP restored on Life() when within 2 tiles of the blob core
#define BLOBMOB_BLOBBERNAUT_HEALING_NODE 0.025 // Same, but for a nearby node
#define BLOBMOB_BLOBBERNAUT_HEALING_TILE 0.0125 // Same, but for a nearby blob tile
#define BLOBMOB_BLOBBERNAUT_HEALTH_DECAY 0.0125 // Percentage multiplier HP lost when not near blob tiles or without factory

#define BLOB_ACT_PROTECTION_TIME 2 SECONDS
34 changes: 33 additions & 1 deletion code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@
#define COMSIG_ATOM_BULLET_ACT "atom_bullet_act"
///from base of atom/blob_act(): (/obj/structure/blob)
#define COMSIG_ATOM_BLOB_ACT "atom_blob_act"
/// if returned, forces nothing to happen when the atom is attacked by a blob
#define COMPONENT_CANCEL_BLOB_ACT (1<<0)
///from base of atom/acid_act(): (acidpwr, acid_volume)
#define COMSIG_ATOM_ACID_ACT "atom_acid_act"
///from base of atom/emag_act(): (/mob/user)
Expand Down Expand Up @@ -387,6 +389,8 @@
#define COMSIG_MOB_LOGIN "mob_login"
///from base of /mob/Logout(): ()
#define COMSIG_MOB_LOGOUT "mob_logout"
///from base of /mob/mind_initialize
#define COMSIG_MOB_MIND_INITIALIZED "mob_mind_inited"
///from base of mob/death(): (gibbed)
#define COMSIG_MOB_DEATH "mob_death"
///from base of mob/ghostize(): (mob/dead/observer/ghost)
Expand Down Expand Up @@ -470,6 +474,9 @@
////from mob/living/adjust_fire_stacks()
#define COMSIG_MOB_ADJUST_FIRE "mob_adjust_fire"

////from mob/living/adjust_wet_stacks()
#define COMSIG_MOB_ADJUST_WET "mob_adjust_wet"

///from base of /mob/living/toggle_move_intent(): (old_move_intent)
#define COMSIG_MOB_MOVE_INTENT_TOGGLE "mob_move_intent_toggle"
#define COMPONENT_BLOCK_INTENT_TOGGLE (1<<0)
Expand Down Expand Up @@ -508,6 +515,9 @@
/// Performed after the hands are swapped.
#define COMSIG_MOB_SWAP_HANDS "mob_swap_hands"

/// from mob/get_status_tab_items(): (list/items)
#define COMSIG_MOB_GET_STATUS_TAB_ITEMS "mob_get_status_tab_items"

///From base of mob/update_movespeed():area
#define COMSIG_MOB_MOVESPEED_UPDATED "mob_update_movespeed"

Expand All @@ -520,13 +530,17 @@
#define COMSIG_CLIENT_SET_EYE "client_set_eye"
// from /client/proc/change_view() : (new_size)
#define COMSIG_VIEW_SET "view_set"
/// from /mob/proc/change_mob_type() : ()
#define COMSIG_MOB_CHANGED_TYPE "mob_changed_type"

// /mob/living signals

///from base of mob/living/resist() (/mob/living)
#define COMSIG_LIVING_RESIST "living_resist"
///from base of mob/living/IgniteMob() (/mob/living)
#define COMSIG_LIVING_IGNITED "living_ignite"
///from base of mob/living/WetMob() (/mob/living)
#define COMSIG_LIVING_WET "living_weted"
///from base of mob/living/ExtinguishMob() (/mob/living)
#define COMSIG_LIVING_EXTINGUISHED "living_extinguished"
///from base of mob/living/electrocute_act(): (shock_damage, source, siemens_coeff, flags)
Expand Down Expand Up @@ -559,6 +573,8 @@
#define COMSIG_BORG_SAFE_DECONSTRUCT "borg_safe_decon"
///sent from living mobs every tick of fire
#define COMSIG_LIVING_FIRE_TICK "living_fire_tick"
///sent from living mobs every tick of wet
#define COMSIG_LIVING_WET_TICK "living_wet_tick"
//sent from living mobs when they are ahealed
#define COMSIG_LIVING_AHEAL "living_aheal"
///From living/Life(). (deltatime, times_fired)
Expand All @@ -579,6 +595,10 @@
#define COMSIG_LIVING_RESTING "living_resting"
///from base of mob/update_transform()
#define COMSIG_LIVING_POST_UPDATE_TRANSFORM "living_post_update_transform"
/// From mob/living/try_speak(): (message)
#define COMSIG_MOB_TRY_SPEECH "living_vocal_speech"
/// Return if the mob cannot speak.
#define COMPONENT_CANNOT_SPEAK (1<<0)

///called on /living when someone starts pulling (atom/movable/pulled, state, force)
#define COMSIG_LIVING_START_PULL "living_start_pull"
Expand All @@ -593,6 +613,8 @@
/// Called from /mob/living/PushAM -- Called when this mob is about to push a movable, but before it moves
/// (aotm/movable/being_pushed)
#define COMSIG_LIVING_PUSHING_MOVABLE "living_pushing_movable"
///from base of /mob/living/examine(): (mob/user, list/.)
#define COMSIG_LIVING_EXAMINE "living_examine"

///from base of mob/living/Stun() (amount, ignore_canstun)
#define COMSIG_LIVING_STATUS_STUN "living_stun"
Expand Down Expand Up @@ -678,7 +700,10 @@
#define COMSIG_CARBON_APPLY_OVERLAY "carbon_apply_overlay"
///Called from remove_overlay(cache_index, overlay)
#define COMSIG_CARBON_REMOVE_OVERLAY "carbon_remove_overlay"

#define COMSIG_CARBON_UPDATING_HEALTH_HUD "carbon_health_hud_update"
#define COMSIG_HUMAN_UPDATING_HEALTH_HUD "human_health_hud_update"
/// Return if you override the carbon's or human's health hud with something else
#define COMPONENT_OVERRIDE_HEALTH_HUD (1<<0)
// /mob/living/simple_animal signals
///from /mob/living/attack_animal(): (mob/living/simple_animal/M)
#define COMSIG_SIMPLE_ANIMAL_ATTACKEDBY "simple_animal_attackedby"
Expand All @@ -688,6 +713,9 @@
#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget"
#define COMPONENT_HOSTILE_NO_ATTACK (1<<0)

///after attackingtarget has happened, source is the attacker and target is the attacked, extra argument for if the attackingtarget was successful
#define COMSIG_HOSTILE_POST_ATTACKINGTARGET "hostile_post_attackingtarget"

/// Called when a /mob/living/simple_animal/hostile fines a new target: (atom/source, give_target)
#define COMSIG_HOSTILE_FOUND_TARGET "comsig_hostile_found_target"

Expand Down Expand Up @@ -1200,3 +1228,7 @@
/// Source: /mob/living/simple_animal/borer, listening in datum/antagonist/borer
#define COMSIG_BORER_ENTERED_HOST "borer_on_enter" // when borer entered host
#define COMSIG_BORER_LEFT_HOST "borer_on_leave" // when borer left host
///from /datum/spawners_menu/ui_act(): (mob/user)
#define COMSIG_IS_GHOST_CONTROLABLE "is_ghost_controllable"
/// Return this to signal that the mob can be controlled by ghosts
#define COMPONENT_GHOST_CONTROLABLE (1<<0)
9 changes: 9 additions & 0 deletions code/__DEFINES/dcs/signals_blob.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Signal sent when a blob overmind picked a new strain (/mob/camera/blob/overmind, /datum/blobstrain/new_strain)
#define COMSIG_BLOB_SELECTED_STRAIN "blob_selected_strain"
/// Signal sent by a blob spore when it creates a zombie (/mob/living/basic/blob_minion/spore/spore, //mob/living/basic/blob_minion/zombie/zombie)
#define COMSIG_BLOB_ZOMBIFIED "blob_zombified"

/// Signal sent by a blob when it try expand
#define COMSIG_TRY_CONSUME_TURF "try_consume_turf"
/// Component blocks consuming
#define COMPONENT_CANT_CONSUME (1<<0)
4 changes: 3 additions & 1 deletion code/__DEFINES/dcs/signals_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
/// Return to prevent the default behavior (attack_selfing) from ocurring.
#define COMPONENT_ITEM_ACTION_SLOT_INVALID (1<<0)

/// from base of /obj/item/slimepotion/speed/interact_with_atom(): (obj/target, /obj/src, mob/user)
#define COMSIG_SPEED_POTION_APPLIED "speed_potion"
#define SPEED_POTION_STOP (1<<0)

///from base of [/obj/proc/update_integrity]: (old_value, new_value)
#define COMSIG_OBJ_INTEGRITY_CHANGED "obj_integrity_changed"

9 changes: 8 additions & 1 deletion code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
/// Update the atom's icon
#define UPDATE_ICON (UPDATE_ICON_STATE|UPDATE_OVERLAYS)

/// If the thing can reflect light (lasers/energy)
#define RICOCHET_SHINY (1<<0)
/// If the thing can reflect matter (bullets/bomb shrapnel)
#define RICOCHET_HARD (1<<1)

//Reagent flags
#define REAGENT_NOREACT 1
Expand Down Expand Up @@ -186,7 +190,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define MOBILITY_FLAGS_REST_CAPABLE_DEFAULT (MOBILITY_MOVE|MOBILITY_STAND|MOBILITY_PICKUP|MOBILITY_USE|MOBILITY_UI|MOBILITY_STORAGE|MOBILITY_PULL|MOBILITY_REST|MOBILITY_LIEDOWN)


//MINING AREA FLAGS
//AREA FLAGS
/// If mining tunnel generation is allowed in this area
#define CAVES_ALLOWED (1<<1)
/// If flora are allowed to spawn in this area randomly through tunnel generation
Expand All @@ -195,6 +199,9 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define MOB_SPAWN_ALLOWED (1<<3)
/// If megafauna can be spawned by natural random generation
#define MEGAFAUNA_SPAWN_ALLOWED (1<<4)
/// If blobs can spawn there and if it counts towards their score.
#define BLOBS_ALLOWED (1<<5)



// timed_action_flags parameter for [/proc/do_after()]
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/gamemode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define SPECIAL_ROLE_ABDUCTOR_SCIENTIST "Abductor Scientist"
#define SPECIAL_ROLE_BLOB "Blob"
#define SPECIAL_ROLE_BLOB_OVERMIND "Blob Overmind"
#define SPECIAL_ROLE_BLOB_MINION "Blob Minion"
#define SPECIAL_ROLE_BORER "Borer"
#define SPECIAL_ROLE_CARP "Space Carp"
#define SPECIAL_ROLE_CHANGELING "Changeling"
Expand Down
12 changes: 12 additions & 0 deletions code/__DEFINES/generators.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//generator types
#define GEN_NUM "num"
#define GEN_VECTOR "vector"
#define GEN_BOX "box"
#define GEN_CIRCLE "circle"
#define GEN_SPHERE "sphere"

///particle editor var modifiers
#define P_DATA_GENERATOR "generator"
#define P_DATA_ICON_ADD "icon_add"
#define P_DATA_ICON_REMOVE "icon_remove"
#define P_DATA_ICON_WEIGHT "icon_edit"
3 changes: 3 additions & 0 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@
#define PLANE_GROUP_MAIN "main"
/// A secondary group, used when a client views a generic window
#define PLANE_GROUP_POPUP_WINDOW(screen) "popup-[screen.UID()]"

//Blobbernauts
#define ui_blobbernaut_overmind_health "EAST-1:28,CENTER+0:19"
6 changes: 6 additions & 0 deletions code/__DEFINES/math.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive
#define WRAP(val, min, max) clamp(( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ),min,max)

/// Increments a value and wraps it if it exceeds some value. Can be used to circularly iterate through a list through `idx = WRAP_UP(idx, length_of_list)`.
#define WRAP_UP(val, max) (((val) % (max)) + 1)

// Real modulus that handles decimals
#define MODULUS(x, y) ( (x) - FLOOR(x, y))

Expand Down Expand Up @@ -119,3 +122,6 @@
/// Like SPT_PROB_RATE but easier to use, simply put `if(SPT_PROB(10, 5))`
#define SPT_PROB(prob_per_second_percent, seconds_per_tick) (prob(100*SPT_PROB_RATE((prob_per_second_percent)/100, (seconds_per_tick))))
// )

/// The number of cells in a taxicab circle (rasterized diamond) of radius X.
#define DIAMOND_AREA(X) (1 + 2*(X)*((X)+1))
9 changes: 9 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), CENTER.z \
)

#define RANGE_TURFS_MULTIZ(RADIUS, CENTER, Z_MIN, Z_MAX) \
RECT_TURFS_MULTIZ(RADIUS, RADIUS, Z_MIN, Z_MAX, CENTER)

#define RECT_TURFS_MULTIZ(H_RADIUS, V_RADIUS, Z_MIN, Z_MAX, CENTER) \
block( \
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), Z_MIN, \
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), Z_MAX \
)

/// Returns the turfs on the edge of a square with CENTER in the middle and with the given RADIUS. If used near the edge of the map, will still work fine.
// order of the additions: top edge + bottom edge + left edge + right edge
#define RANGE_EDGE_TURFS(RADIUS, CENTER)\
Expand Down
Loading