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>
This commit is contained in:
Daylight
2024-05-17 11:44:17 +00:00
committed by GitHub
co-authored by DGamerL
parent 131e631cc4
commit 74ad8c1463
2 changed files with 18 additions and 7 deletions
@@ -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)
@@ -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