Files
Paradise/code/game/objects/effects/step_triggers.dm
S34N 3f95392c82 Lets go rebind things (#18166)
* SSinput Rewrite, Custom Keybindings

* hmm yes, safety

* azerty begone

* address AA and SteelSlayer

* Address the old man

* what

* CI dbconfig too

* Address TM issues

Unicode support
Better numpad support
Fix no perms message
Fix modifier screwing movement

* pre-TM tweak, nitfix

* pre TM change 2

* Display others

* MERGE ME

* unduplicates your rows

* reverts some changes, makes this work for now (not TM safe)

* fixes direction facing, removes hotkey help item

* weird keys

* TM commit revert later

* fixed asay/msay keybind

* adds ALL the emotes

* flip and spin

* makes old people happy

* and fixes admins not being able to msay

* lets borgs stow modules

* saves prefs when someone changes a keybind

* reverts skin changes and manually applies
HEAVEN HELP YOU IF YOU USE THE DM SKIN EDITOR IT BREAKS EVERYTHING

* tidies menu, unduplicates rest

* sql file pls come back

* Update SQL/updates/40-41.sql

* why did you not throw an error?!

* inits keybinds if your prefs somehow fail, i guess

* restores these spaces, i guess

* fixes local testing, i guess

* emote cooldown returns (oops)

* movement lock improvements

* Pageup does Swap Hands

* LOOC

* whisper for living mobs

* oops

* fix dsay

* fix IPC silicon emote hotkeys

* category name

* backspace only clears if input is focused

* Makes TAB and BACKSPACE rebindable

* charlie review

* define move

* yeet

* Lewcc review

* brings back legacy mode

* restores legacy mode

* tell legacy mode what is going on

* Update code/controllers/subsystem/input.dm

* Update code/controllers/subsystem/input.dm

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* safeties!

* legacy mode is a pref now

* undo TM changes

* null prefs safeties

* Revert "legacy mode is a pref now"

This reverts commit b45af65139.

* revert this too thanks

Co-authored-by: mochi <shenesis@gmail.com>
Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
2022-07-13 21:34:41 +01:00

185 lines
4.5 KiB
Plaintext

/* Simple object type, calls a proc when "stepped" on by something */
/obj/effect/step_trigger
var/affect_ghosts = FALSE
var/stopper = TRUE // stops throwers
var/mobs_only = FALSE
invisibility = INVISIBILITY_ABSTRACT // nope cant see this shit
/obj/effect/step_trigger/proc/Trigger(atom/movable/A)
return FALSE
/obj/effect/step_trigger/Crossed(H, oldloc)
. = ..()
if(!H)
return
if(isobserver(H) && !affect_ghosts)
return
if(!ismob(H) && mobs_only)
return
Trigger(H)
/obj/effect/step_trigger/singularity_act()
return
/obj/effect/step_trigger/singularity_pull()
return
/* Sends a message to mob when triggered*/
/obj/effect/step_trigger/message
var/message //the message to give to the mob
var/once = 1
mobs_only = TRUE
/obj/effect/step_trigger/message/Trigger(mob/M)
if(M.client)
to_chat(M, "<span class='info'>[message]</span>")
if(once)
qdel(src)
/* Tosses things in a certain direction */
/obj/effect/step_trigger/thrower
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/nostop = 0 // if 1: will only be stopped by teleporters
var/list/affecting = list()
/obj/effect/step_trigger/thrower/Trigger(atom/A)
if(!A || !ismovable(A))
return
var/atom/movable/AM = A
var/curtiles = 0
var/stopthrow = 0
for(var/obj/effect/step_trigger/thrower/T in orange(2, src))
if(AM in T.affecting)
return
if(immobilize)
ADD_TRAIT(A, TRAIT_IMMOBILIZED, "[UID()]")
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)
step(AM, direction)
REMOVE_TRAIT(A, TRAIT_IMMOBILIZED, "[UID()]")
/* 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(atom/movable/A)
if(teleport_x && teleport_y && teleport_z)
var/turf/T = locate(teleport_x, teleport_y, teleport_z)
A.forceMove(T)
/* 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(atom/movable/A)
if(teleport_x && teleport_y && teleport_z)
if(teleport_x_offset && teleport_y_offset && teleport_z_offset)
var/turf/T = locate(rand(teleport_x, teleport_x_offset), rand(teleport_y, teleport_y_offset), rand(teleport_z, teleport_z_offset))
if (T)
A.forceMove(T)
/* Fancy teleporter, creates sparks and smokes when used */
/obj/effect/step_trigger/teleport_fancy
var/locationx
var/locationy
var/uses = 1 //0 for infinite uses
var/entersparks = 0
var/exitsparks = 0
var/entersmoke = 0
var/exitsmoke = 0
/obj/effect/step_trigger/teleport_fancy/Trigger(mob/M)
var/dest = locate(locationx, locationy, z)
M.Move(dest)
if(entersparks)
var/datum/effect_system/spark_spread/s = new
s.set_up(4, 1, src)
s.start()
if(exitsparks)
var/datum/effect_system/spark_spread/s = new
s.set_up(4, 1, dest)
s.start()
if(entersmoke)
var/datum/effect_system/smoke_spread/s = new
s.set_up(4, 1, src, 0)
s.start()
if(exitsmoke)
var/datum/effect_system/smoke_spread/s = new
s.set_up(4, 1, dest, 0)
s.start()
uses--
if(uses == 0)
qdel(src)
/* Simple sound player, Mapper friendly! */
/obj/effect/step_trigger/sound_effect
var/sound //eg. path to the sound, inside '' eg: 'growl.ogg'
var/volume = 100
var/freq_vary = 1 //Should the frequency of the sound vary?
var/extra_range = 0 // eg World.view = 7, extra_range = 1, 7+1 = 8, 8 turfs radius
var/happens_once = 0
var/triggerer_only = 0 //Whether the triggerer is the only person who hears this
/obj/effect/step_trigger/sound_effect/Trigger(atom/movable/A)
var/turf/T = get_turf(A)
if(!T)
return
if(triggerer_only && ismob(A))
var/mob/B = A
B.playsound_local(T, sound, volume, freq_vary)
else
playsound(T, sound, volume, freq_vary, extra_range)
if(happens_once)
qdel(src)