From 74ad8c1463d2dcc61d37299c46dd358fbfcaef64 Mon Sep 17 00:00:00 2001 From: Daylight <18598676+Daylight2@users.noreply.github.com> Date: Fri, 17 May 2024 14:44:17 +0300 Subject: [PATCH] Gives singularity engines a slight nudge towards the station (#25420) * Makes the singolo target * Spelling * Update code/modules/power/engines/singularity/singularity.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Daylight <18598676+Daylight2@users.noreply.github.com> * Fancy comments --------- Signed-off-by: Daylight <18598676+Daylight2@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --- .../power/engines/singularity/singularity.dm | 23 +++++++++++++++---- .../power/engines/tesla/energy_ball.dm | 2 -- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/code/modules/power/engines/singularity/singularity.dm b/code/modules/power/engines/singularity/singularity.dm index b00a030a16e..de8de552f88 100644 --- a/code/modules/power/engines/singularity/singularity.dm +++ b/code/modules/power/engines/singularity/singularity.dm @@ -21,15 +21,20 @@ move_resist = INFINITY //no, you don't get to push the singulo. Not even you OP wizard gateway statues var/consume_range = 0 //How many tiles out do we eat var/event_chance = 15 //Prob for event each tick - var/target = null //its target. moves towards the target if it has one var/last_failed_movement = 0//Will not move in the same dir if it couldnt before, will help with the getting stuck on fields thing var/last_warning var/consumedSupermatter = FALSE //If the singularity has eaten a supermatter shard and can go to stage six var/warps_projectiles = TRUE var/obj/effect/warp_effect/supermatter/warp resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + /// The target of the singularity. It will wander slowly towards this, and pick another target once it reaches it. + var/target = null + /// If there is a syndicate beacon, the singularity will move quickly towards it. + var/beacon_target = null /// Whether or not we've pinged ghosts var/isnt_shutting_down = FALSE + /// Init list that has all the areas that we can possibly move to, to reduce processing impact + var/list/all_possible_areas = list() /obj/singularity/Initialize(mapload, starting_energy = 50) . = ..() @@ -45,8 +50,9 @@ GLOB.singularities += src for(var/obj/machinery/power/singularity_beacon/singubeacon in GLOB.machines) if(singubeacon.active) - target = singubeacon + beacon_target = singubeacon break + all_possible_areas = findUnrestrictedEventArea() /obj/singularity/Destroy() STOP_PROCESSING(SSobj, src) @@ -323,6 +329,10 @@ return +/obj/singularity/proc/assign_target() + var/area/where_to_move = pick(all_possible_areas) // Grabs a random area that isn't restricted + var/turf/target_area_turfs = get_area_turfs(where_to_move) // Grabs the turfs from said area + target = pick(target_area_turfs) // Grabs a single turf from the entire list /obj/singularity/proc/move(force_move = 0) if(!move_self) @@ -330,11 +340,14 @@ var/movement_dir = pick(GLOB.alldirs - last_failed_movement) + if(get_turf(src) == target || !target) + assign_target() if(force_move) movement_dir = force_move - - if(target && prob(60)) - movement_dir = get_dir(src,target) //moves to a singulo beacon, if there is one + if(target && prob(20)) + movement_dir = get_dir(src, target) //moves to a random spot on the map + if(beacon_target && prob(60)) + movement_dir = get_dir(src, target) //moves to a singulo beacon, if there is one step(src, movement_dir) diff --git a/code/modules/power/engines/tesla/energy_ball.dm b/code/modules/power/engines/tesla/energy_ball.dm index 79274c66915..7e526501faf 100644 --- a/code/modules/power/engines/tesla/energy_ball.dm +++ b/code/modules/power/engines/tesla/energy_ball.dm @@ -39,8 +39,6 @@ var/movement_dir /// Variable that defines whether it has a field generator close enough var/has_close_field = FALSE - /// Init list that has all the areas that we can possibly move to, to reduce processing impact - var/list/all_possible_areas = list() /// How many tiles do we move per movement step? var/steps_per_move = 8