/
githubmirror
/
vgstation13
Обзор
Документация
Войти
/
githubmirror
/
vgstation13
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Bleeding-Edge
code/game/objects/effects/step_triggers.dm
187 строк
5 KB
west3436
Odyssey Fixes (#39238)
07 май 2026, 14:31
Не верифицирован
07 май 2026, 14:31
5bb25a4
Код
Авторство
О чём код?
/* Simple object type, calls a proc when "stepped" on by something */ /obj/effect/step_trigger var/affect_ghosts = 0 var/stopper = 1 // stops throwers invisibility = 101 // nope cant see this shit anchored = 1 w_type=NOT_RECYCLABLE /obj/effect/step_trigger/proc/Trigger(var/atom/movable/A) return 0 /obj/effect/step_trigger/Crossed(H as mob|obj) ..() if(!H) return if(istype(H, /mob/dead/observer) && !affect_ghosts) return if(istype(H, /obj/effect/beam))//those things aren't meant to get moved return Trigger(H) /* Tosses things in a certain direction */ /obj/effect/step_trigger/thrower icon = 'icons/effects/effects.dmi' icon_state = "arrows" var/direction = SOUTH // the direction of throw var/tiles = 3 // if 0: forever until atom hits a stopper var/immobilize = 1 // if nonzero: prevents mobs from moving while they're being flung var/speed = 1 // delay of movement var/facedir = 0 // if 1: atom faces the direction of movement var/nostop = 0 // if 1: will only be stopped by teleporters var/list/affecting = list() /obj/effect/step_trigger/thrower/Trigger(var/atom/A) if(!A || !istype(A, /atom/movable) || isobserver(A)) return var/atom/movable/AM = A var/curtiles = 0 var/stopthrow = 0 if(AM.locked_to) return for(var/obj/effect/step_trigger/thrower/T in orange(2, src)) if(AM in T.affecting) return if(ismob(AM)) var/mob/M = AM if(immobilize) M.canmove = 0 affecting.Add(AM) while(AM && !stopthrow) if(tiles) if(curtiles >= tiles) break if(AM.z != src.z) break curtiles++ sleep(speed) // Calculate if we should stop the process if(!nostop) for(var/obj/effect/step_trigger/T in get_step(AM, direction)) if(T.stopper && T != src) stopthrow = 1 else for(var/obj/effect/step_trigger/teleporter/T in get_step(AM, direction)) if(T.stopper) stopthrow = 1 if(AM) var/predir = AM.dir step(AM, direction) if(!facedir) AM.dir = predir affecting.Remove(AM) if(ismob(AM)) var/mob/M = AM if(immobilize) M.canmove = 1 /obj/effect/step_trigger/thrower/north dir = NORTH /obj/effect/step_trigger/thrower/east dir = EAST /obj/effect/step_trigger/thrower/west dir = WEST /obj/effect/step_trigger/thrower/New() ..() direction = dir /* Stops things thrown by a thrower, doesn't do anything */ /obj/effect/step_trigger/stopper /* Instant teleporter */ /obj/effect/step_trigger/teleporter var/teleport_x = 0 // teleportation coordinates (if one is null, then no teleport!) var/teleport_y = 0 var/teleport_z = 0 /obj/effect/step_trigger/teleporter/Trigger(var/atom/movable/A) if(teleport_x && teleport_y && teleport_z) A.x = teleport_x A.y = teleport_y A.z = teleport_z /* Random teleporter, teleports atoms to locations ranging from teleport_x - teleport_x_offset, etc */ /obj/effect/step_trigger/teleporter/random var/teleport_x_offset = 0 var/teleport_y_offset = 0 var/teleport_z_offset = 0 /obj/effect/step_trigger/teleporter/random/Trigger(var/atom/movable/A) if(!istype(A) || isobserver(A)) return if(istype(A,/obj/item/projectile/fire_breath/shuttle_exhaust)) qdel(A) return if(teleport_x && teleport_y && teleport_z) if(teleport_x_offset && teleport_y_offset && teleport_z_offset) A.x = rand(teleport_x, teleport_x_offset) A.y = rand(teleport_y, teleport_y_offset) A.z = rand(teleport_z, teleport_z_offset) /obj/effect/step_trigger/teleporter/random/shuttle_transit teleport_x = 25 teleport_y = 25 teleport_z = 6 //x and y offsets depend on the map size teleport_z_offset = 6 /obj/effect/step_trigger/teleporter/random/shuttle_transit/New() ..() teleport_x_offset = world.maxx - 25 teleport_y_offset = world.maxy - 25 // Picks a random VZ_SPACE / VZ_PARKING vlevel and drops the atom inside it instead of teleporting to hardcoded world coordinates - the latter lands on border turfs or in the wrong vlevel on packed dynamic z-levels. /obj/effect/step_trigger/teleporter/random/shuttle_transit/Trigger(var/atom/movable/A) if(!istype(A) || isobserver(A)) return if(istype(A,/obj/item/projectile/fire_breath/shuttle_exhaust)) return var/list/datum/virtual_z/destinations = list() for(var/datum/virtual_z/vz in map.vLevels) if((vz.level_type == VZ_PARKING || vz.level_type == VZ_SPACE) && !vz.movementJammed) destinations += vz if(!destinations.len) return ..() var/datum/virtual_z/dest = pick(destinations) for(var/i = 1 to 50) var/tx = rand(dest.x_min + TRANSITIONEDGE, dest.x_max - TRANSITIONEDGE) var/ty = rand(dest.y_min + TRANSITIONEDGE, dest.y_max - TRANSITIONEDGE) var/turf/T = locate(tx, ty, dest.z()) if(istype(T, /turf/space) && !istype(T, /turf/space/transit) && !istype(T, /turf/unsimulated/border)) var/turf/old_T = get_turf(A) var/datum/virtual_z/old_v = old_T?.v if(ismob(A)) var/mob/M = A if(old_v) old_v.mob_exited(M) A.forceMove(T) dest.mob_entered(M) else A.forceMove(T) return