mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Movable Overmap Events (#15551)
This commit is contained in:
@@ -176,10 +176,61 @@
|
||||
var/list/victims //basically cached events on which Z level
|
||||
var/can_be_destroyed = TRUE //Can this event be destroyed by ship guns?
|
||||
|
||||
// Vars that determine movability, current moving direction, and moving speed //
|
||||
/// Whether this event can move or not
|
||||
var/movable_event = FALSE
|
||||
/// The percentage chance that this event will turn itself into a mobile version
|
||||
var/movable_event_chance = 0
|
||||
/// In which direction this event is currently planning on moving, will select a random dir if null
|
||||
var/moving_dir = null
|
||||
/// How many times the event has to process before moving (2 seconds per)
|
||||
var/movable_speed = 60
|
||||
/// Ticks up each process until move speed is matched, at which point the event will move
|
||||
var/move_counter = 0
|
||||
/// Percentage chance that the event changes direction
|
||||
var/dir_change_chance = 25
|
||||
/// How long to delay the next move counter if there's a ship in our loc, this gives bad events some time to happen
|
||||
var/ship_delay_time = 2
|
||||
/// Ticks up each process until move speed is matched, at which point the event will move
|
||||
var/ship_delay_counter = 0
|
||||
|
||||
/obj/effect/overmap/event/Initialize()
|
||||
. = ..()
|
||||
icon_state = pick(event_icon_states)
|
||||
overmap_event_handler.update_hazards(loc)
|
||||
if(movable_event)
|
||||
start_moving()
|
||||
else if(prob(movable_event_chance))
|
||||
make_movable()
|
||||
|
||||
/obj/effect/overmap/event/proc/make_movable()
|
||||
movable_event = TRUE
|
||||
start_moving()
|
||||
|
||||
/obj/effect/overmap/event/proc/start_moving()
|
||||
if(!moving_dir) moving_dir = pick(alldirs)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/effect/overmap/event/process()
|
||||
if(locate(/obj/effect/overmap/visitable/ship) in loc)
|
||||
ship_delay_counter++
|
||||
if(ship_delay_counter < ship_delay_time)
|
||||
return
|
||||
ship_delay_counter = 0
|
||||
move_counter++
|
||||
if(move_counter >= movable_speed)
|
||||
handle_move()
|
||||
move_counter = 0
|
||||
|
||||
/obj/effect/overmap/event/proc/handle_move()
|
||||
Move(get_step(src, moving_dir))
|
||||
if(prob(dir_change_chance))
|
||||
moving_dir = turn(moving_dir, pick(45, -45))
|
||||
|
||||
/obj/effect/overmap/event/Bump(var/atom/A)
|
||||
if(istype(A,/turf/unsimulated/map/edge))
|
||||
handle_wraparound()
|
||||
..()
|
||||
|
||||
/obj/effect/overmap/event/Move()
|
||||
var/turf/old_loc = loc
|
||||
@@ -196,6 +247,8 @@
|
||||
overmap_event_handler.update_hazards(loc)
|
||||
|
||||
/obj/effect/overmap/event/Destroy()//takes a look at this one as well, make sure everything is A-OK
|
||||
if(movable_event)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
var/turf/T = loc
|
||||
. = ..()
|
||||
overmap_event_handler.update_hazards(T)
|
||||
@@ -234,6 +287,7 @@
|
||||
opacity = 0
|
||||
difficulty = EVENT_LEVEL_MODERATE
|
||||
event_icon_states = list("carp")
|
||||
movable_event_chance = 5
|
||||
|
||||
/obj/effect/overmap/event/carp/major
|
||||
name = "carp school"
|
||||
@@ -300,4 +354,4 @@
|
||||
count = 12
|
||||
radius = 4
|
||||
opacity = 0
|
||||
hazards = /obj/effect/overmap/event/gravity
|
||||
hazards = /obj/effect/overmap/event/gravity
|
||||
|
||||
Reference in New Issue
Block a user