diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 050e4f7b15..b17bc87ffd 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -409,8 +409,10 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \ new/datum/stack_recipe("brass pinion airlock - windowed", /obj/machinery/door/airlock/clockwork/brass, 5, time = 50, one_per_turf = TRUE, on_floor = TRUE), \ new/datum/stack_recipe("brass windoor", /obj/machinery/door/window/clockwork, 2, time = 30, on_floor = TRUE, window_checks = TRUE), \ null, - new/datum/stack_recipe("directional brass window", /obj/structure/window/reinforced/clockwork/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \ - new/datum/stack_recipe("fulltile brass window", /obj/structure/window/reinforced/clockwork/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \ + new/datum/stack_recipe("brass reflector", /obj/structure/destructible/clockwork/reflector, 10, time = 100, one_per_turf = TRUE, on_floor = TRUE, window_checks = TRUE), \ + null, + new/datum/stack_recipe("brass window - directional", /obj/structure/window/reinforced/clockwork/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \ + new/datum/stack_recipe("brass window - fulltile", /obj/structure/window/reinforced/clockwork/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \ new/datum/stack_recipe("brass chair", /obj/structure/chair/brass, 1, time = 0, one_per_turf = TRUE, on_floor = TRUE), \ new/datum/stack_recipe("brass table frame", /obj/structure/table_frame/brass, 1, time = 5, one_per_turf = TRUE, on_floor = TRUE), \ null, diff --git a/code/modules/antagonists/clockcult/clock_structures/reflector.dm b/code/modules/antagonists/clockcult/clock_structures/reflector.dm new file mode 100644 index 0000000000..34ad051d19 --- /dev/null +++ b/code/modules/antagonists/clockcult/clock_structures/reflector.dm @@ -0,0 +1,86 @@ +/obj/structure/destructible/clockwork/reflector + name = "reflector" + desc = "A large lantern-shaped machine made of thin brass. It looks fragile." + clockwork_desc = "A lantern-shaped generator that produces power when near starlight." + icon_state = "reflector" + unanchored_icon = "reflector_unwrenched" + max_integrity = 40 + construction_value = 5 + layer = WALL_OBJ_LAYER + break_message = "The reflectors's fragile shield shatters into pieces!" + resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF + light_color = "#DAAA18" + var/list/allowed_projectile_typecache = list( + /obj/item/projectile/beam + ) + + var/ini_dir = null + +/obj/structure/destructible/clockwork/reflector/Initialize() + . = ..() + allowed_projectile_typecache = typecacheof(allowed_projectile_typecache) + +/obj/structure/destructible/clockwork/reflector/ComponentInitialize() + . = ..() + AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation)) + +/obj/structure/destructible/clockwork/reflector/bullet_act(obj/item/projectile/P) + if(!anchored || !allowed_projectile_typecache[P.type] || !(P.dir in GLOB.cardinals)) + return ..() + + if(auto_reflect(P, P.dir, get_turf(P), P.Angle) != -1) + return ..() + + return -1 + +/obj/structure/destructible/clockwork/reflector/proc/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle) + + //Yell at me if this exists already. + + var/real_angle = 0 + + switch(dir) + if(NORTH) + real_angle = 0 + if(EAST) + real_angle = 90 + if(SOUTH) + real_angle = 180 + if(WEST) + real_angle = 270 + + var/incidence = GET_ANGLE_OF_INCIDENCE(real_angle, (P.Angle + 180)) + if(abs(incidence) > 90 && abs(incidence) < 270) + return FALSE + var/new_angle = SIMPLIFY_DEGREES(real_angle + incidence) + P.setAngle(new_angle) + P.ignore_source_check = TRUE + P.range = P.decayedRange + P.decayedRange = max(P.decayedRange--, 0) + return -1 + +/obj/structure/destructible/clockwork/reflector/proc/can_be_rotated(mob/user,rotation_type) + if(anchored) + to_chat(user, "[src] cannot be rotated while it is fastened to the floor!") + return FALSE + + return TRUE + +/obj/structure/destructible/clockwork/reflector/Move() + . = ..() + setDir(ini_dir) + +/obj/structure/destructible/clockwork/reflector/proc/after_rotation(mob/user,rotation_type) + ini_dir = dir + add_fingerprint(user) + + +/obj/structure/destructible/clockwork/reflector/wrench_act(mob/living/user, obj/item/I) + + if(!is_servant_of_ratvar(user)) + return ..() + + anchored = !anchored + to_chat(user, "You [anchored ? "secure" : "unsecure"] \the [src].") + I.play_tool_sound(src) + return TRUE \ No newline at end of file diff --git a/icons/obj/clockwork_objects.dmi b/icons/obj/clockwork_objects.dmi index 56cfdf468b..1948bb605c 100644 Binary files a/icons/obj/clockwork_objects.dmi and b/icons/obj/clockwork_objects.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 0fbefaa7b8..37df11d40c 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1236,6 +1236,7 @@ #include "code\modules\antagonists\clockcult\clock_structures\mania_motor.dm" #include "code\modules\antagonists\clockcult\clock_structures\ocular_warden.dm" #include "code\modules\antagonists\clockcult\clock_structures\ratvar_the_clockwork_justicar.dm" +#include "code\modules\antagonists\clockcult\clock_structures\reflector.dm" #include "code\modules\antagonists\clockcult\clock_structures\stargazer.dm" #include "code\modules\antagonists\clockcult\clock_structures\taunting_trail.dm" #include "code\modules\antagonists\clockcult\clock_structures\wall_gear.dm"