|
| 1 | +// This is a set of WIP code made with the intent on giving dungeon creators more tools in their toolbox when making PVE dungeons. :3 |
| 2 | + |
| 3 | + |
| 4 | +/obj/structure/dungeontool/trigger // A hidden obj that sends a redstone trigger when crossed by a mob with a mind |
| 5 | + name = "invisible trigger plate" |
| 6 | + desc = "Used for quietly triggering redstone structures. Only triggered by mobs with a mind" |
| 7 | + icon = 'icons/roguetown/misc/traps.dmi' |
| 8 | + icon_state = "pressureplate" |
| 9 | + max_integrity = 9999 |
| 10 | + damage_deflection = 100 |
| 11 | + opacity = FALSE |
| 12 | + density = FALSE |
| 13 | + anchored = TRUE |
| 14 | + invisibility = 101 |
| 15 | + |
| 16 | +/obj/structure/dungeontool/trigger/Crossed(atom/movable/AM) |
| 17 | + . = ..() |
| 18 | + if(!anchored) |
| 19 | + return |
| 20 | + if(ismob(AM) && AM:mind) |
| 21 | + triggerquiet() |
| 22 | + |
| 23 | +/obj/structure/dungeontool/trigger/proc/triggerquiet() |
| 24 | + for(var/obj/structure/O in redstone_attached) |
| 25 | + spawn(0) O.redstone_triggered() |
| 26 | + |
| 27 | +/obj/structure/dungeontool/triggered // A simple obj that does a thing when activated by redstone. Create subtypes, do not use this parent obj |
| 28 | + name = "triggered obj" |
| 29 | + desc = "Does a thing when triggered" |
| 30 | + icon = 'icons/roguetown/misc/traps.dmi' |
| 31 | + icon_state = "base_trap_plate" |
| 32 | + max_integrity = 9999 |
| 33 | + damage_deflection = 100 |
| 34 | + opacity = FALSE |
| 35 | + density = FALSE |
| 36 | + anchored = TRUE |
| 37 | + alpha = 0 // needs to do multiple things but not be interacted with directly by mobs |
| 38 | + mouse_opacity = 0 // ^^^^ |
| 39 | + nomouseover = TRUE // ^^^^ |
| 40 | + redstone_id = "" |
| 41 | + var/activated = FALSE // checking if the triggered should trigger once or indefinitely |
| 42 | + |
| 43 | +/obj/structure/dungeontool/triggered/redstone_triggered() //simple obj's thing that it does when triggered. Create subtypes, do not use parent triggered effect |
| 44 | + if(obj_broken) |
| 45 | + return |
| 46 | + if(!activated) |
| 47 | + playsound(src, 'sound/blank.ogg', 100) |
| 48 | + visible_message("sends a message to chat in screen wide range from object by default") |
| 49 | + activated = TRUE |
| 50 | + |
| 51 | +/obj/structure/dungeontool/triggered/thiefdaddmobs |
| 52 | + name = "triggered for addmobs trigger" |
| 53 | + redstone_id = "addmobs" |
| 54 | + |
| 55 | +/obj/structure/dungeontool/triggered/thiefdaddmobs/redstone_triggered() |
| 56 | + if(obj_broken) |
| 57 | + return |
| 58 | + if(!activated) |
| 59 | + activated = TRUE |
| 60 | + playsound(src, 'sound/foley/smash_rock.ogg', 100) |
| 61 | + sleep(15) |
| 62 | + playsound(src, 'sound/foley/smash_rock.ogg', 70) |
| 63 | + sleep(15) |
| 64 | + playsound(src, 'sound/foley/smash_rock.ogg', 40) |
| 65 | + visible_message("That sounded pretty loud...") |
| 66 | + |
| 67 | +/obj/structure/dungeontool/triggered/barracksalert |
| 68 | + name = "triggered for barracks alert trigger" |
| 69 | + redstone_id = "barracks" |
| 70 | + |
| 71 | +/obj/structure/dungeontool/triggered/barracksalert/redstone_triggered() |
| 72 | + if(obj_broken) |
| 73 | + return |
| 74 | + if(!activated) |
| 75 | + playsound(src, 'sound/foley/equip/equip_armor_chain.ogg', 100) |
| 76 | + |
| 77 | +/obj/structure/dungeontool/triggered/invisibleshutterclosed //useful monster closets |
| 78 | + name = "invisible shutter (closed)" |
| 79 | + icon = 'icons/roguetown/misc/structure.dmi' |
| 80 | + icon_state = "shutter0" |
| 81 | + desc = "Can only be opened, but not closed by a redstone trigger." |
| 82 | + density = TRUE |
| 83 | + opacity = TRUE |
| 84 | + dir = SOUTH |
| 85 | + invisibility = 101 //cannot be seen or interacted with and has density and opacity until triggered |
| 86 | + activated = FALSE |
| 87 | + layer = ABOVE_MOB_LAYER |
| 88 | + plane = GAME_PLANE_UPPER |
| 89 | + obj_flags = BLOCK_Z_OUT_DOWN | BLOCK_Z_OUT_UP | BLOCK_Z_IN_DOWN | BLOCK_Z_IN_UP |
| 90 | + |
| 91 | +/obj/structure/dungeontool/triggered/invisibleshutterclosed/redstone_triggered() |
| 92 | + if(obj_broken) |
| 93 | + return |
| 94 | + if(!activated) |
| 95 | + activated = TRUE |
| 96 | + density = FALSE |
| 97 | + opacity = FALSE |
| 98 | + |
| 99 | +/obj/structure/dungeontool/mover //moves mobs and objs in the dir, checks every 1.5 seconds, used for monster closet |
| 100 | + name = "mob mover" |
| 101 | + desc = "moves a mob in the direction indicated." |
| 102 | + icon = 'icons/blanks/32x32.dmi' |
| 103 | + icon_state = "dir_indicator" |
| 104 | + density = FALSE |
| 105 | + opacity = FALSE |
| 106 | + invisibility = 101 |
| 107 | + anchored = TRUE |
| 108 | + |
| 109 | +/obj/structure/dungeontool/mover/New() |
| 110 | + ..() |
| 111 | + spawn() |
| 112 | + while(src) |
| 113 | + move_mobs() |
| 114 | + sleep(15) |
| 115 | + |
| 116 | +/obj/structure/dungeontool/mover/proc/move_mobs() |
| 117 | + var/turf/T = loc |
| 118 | + if(!istype(T, /turf)) |
| 119 | + return |
| 120 | + for(var/mob/M in T.contents) |
| 121 | + step(M, dir) |
0 commit comments