Files
VOREStation/code/game/objects/effects/prop/snake.dm
T
Selis f4bf017921 Unit Test rework & Master/Ticker update (#17912)
* Unit Test rework & Master/Ticker update

* Fixes and working unit testing

* Fixes

* Test fixes and FA update

* Fixed runtimes

* Radio subsystem

* move that glob wherever later

* ident

* CIBUILDING compile option

* Fixed runtimes

* Some changes to the workflow

* CI Split

* More split

* Pathing

* Linters and Annotators

* ci dir fix

* Missing undef fixed

* Enable grep checks

* More test conversions

* More split

* Correct file

* Removes unneeded inputs

* oop

* More dependency changes

* More conversions

* Conversion fixes

* Fixes

* Some assert fixes

* Corrects start gate

* Converted some README.dms to README.mds

* Removes duplicate proc

* Removes unused defines

* Example configs

* fix dll access viol by double calling

* Post-rebase fixes

* Cleans up names global list

* Undef restart counter

* More code/game/ cleanup

* Statpanel update

* Skybox

* add

* Fix ticker

* Roundend fix

* Persistence dependency update

* Reordering

* Reordering

* Reordering

* Initstage fix

* .

* .

* Reorder

* Reorder

* Circle

* Mobs

* Air

* Test fix

* CI Script Fix

* Configs

* More ticker stuff

* This is now in 'reboot world'

* Restart world announcements

* no glob in PreInit

* to define

* Update

* Removed old include

* Make this file normal again

* moved

* test

* shared unit testing objects

* Updates batched_spritesheets and universal_icon

* .

* job data debug

* rm that

* init order

* show us

* .

* i wonder

* .

* .

* urg

* do we not have a job ID?

* .

* rm sleep for now

* updated rust-g linux binaries

* binaries update 2

* binaries update 3

* testing something

* change that

* test something

* .

* .

* .

* locavar

* test

* move that

* .

* debug

* don't run this test

* strack trace it

* cleaner

* .

* .

* cras again

* also comment this out

* return to official rust g

* Update robot_icons.dm

* monitor the generation

* .

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-08-10 01:37:23 +02:00

125 lines
3.1 KiB
Plaintext

/obj/effect/temporary_effect/pulse/snake
name = "snake head"
pulses_remaining = 20
pulse_delay = 0.5 SECONDS
icon_state = "arrow_omni"
invisibility = INVISIBILITY_MAXIMUM
// The atom which created this.
var/atom/movable/creator
// Will the snake ever intentionally move onto its creator's turf?
var/safe = FALSE
var/ignore_density = FALSE
// The turfs this snake has already crossed.
var/list/iterated_turfs = list()
// How many turfs this snake should remember.
var/total_turf_memory = 5
// Is the snake hunting a specific atom? (Will always try to meander toward this target.)
var/atom/hunting
/obj/effect/temporary_effect/pulse/snake/Initialize(mapload, var/atom/hunt_target, var/atom/Creator)
. = ..()
if(hunt_target)
hunting = hunt_target
if(Creator)
creator = Creator
/obj/effect/temporary_effect/pulse/snake/pulse_loop() // Override needed unfortunately to handle the possibility of not finding a target turf.
set waitfor = FALSE
while(pulses_remaining)
sleep(pulse_delay)
if(on_pulse())
pulses_remaining--
else
break
qdel(src)
/obj/effect/temporary_effect/pulse/snake/on_pulse()
var/list/possible_turfs = list()
if(LAZYLEN(iterated_turfs) && iterated_turfs.len > total_turf_memory)
iterated_turfs.Cut(total_turf_memory + 1)
for(var/direction in GLOB.alldirs - turn(src.dir,180))
var/turf/T = get_step(src, direction)
if(T in iterated_turfs)
continue
if(!ignore_density && T.density)
continue
if(safe && creator && get_dir(src, T) == get_dir(src,creator))
continue
if(hunting && get_dist(T, hunting) > get_dist(src, hunting))
continue
possible_turfs |= T
if(T == get_step(src, dir))
possible_turfs[T] = 4
else
possible_turfs[T] = 1
var/turf/Target
if(LAZYLEN(possible_turfs)) // Pick from our remaining possible turfs.
Target = pickweight(possible_turfs)
else // IF we have none left, just pick a random one.
for(var/turf/T in oview(1, src))
possible_turfs |= T
Target = pick(possible_turfs)
if(Target)
iterated_turfs.Insert(1, Target)
on_leave_turf(get_turf(src))
dir = get_dir(src, Target)
forceMove(Target)
on_enter_turf(Target)
return TRUE
else
on_leave_turf(get_turf(src))
return FALSE
/obj/effect/temporary_effect/pulse/snake/proc/on_leave_turf(var/turf/T)
/obj/effect/temporary_effect/pulse/snake/proc/on_enter_turf(var/turf/T)
/obj/effect/temporary_effect/pulse/snake/testing/on_leave_turf(var/turf/T)
if(T)
new /obj/effect/temporary_effect/eruption/testing(T, 3 SECONDS, "#ff0000")
/obj/effect/temporary_effect/pulse/snake/testing/on_enter_turf(var/turf/T)
if(T)
T.color = "#00ff00"
spawn(3 SECONDS)
T.color = initial(T.color)
/obj/effect/temporary_effect/pulse/snake/testing/hunter/pulse_loop()
hunting = locate(/mob/living) in range(7, src)
..()
/*
* Subtypes
*/
/obj/effect/temporary_effect/pulse/snake/flamestrike
name = "fiery shockwave"
total_turf_memory = 8
pulses_remaining = 8
pulse_delay = 0.2 SECONDS
/obj/effect/temporary_effect/pulse/snake/flamestrike/on_leave_turf(var/turf/T)
if(T)
new /obj/effect/temporary_effect/eruption/flamestrike(T, 1.2 SECONDS, "#f75000")