Adds Clockwork Reflectors

This commit is contained in:
BurgerLua
2019-05-30 22:52:43 -07:00
parent a6a54219fe
commit 5f94441cc7
4 changed files with 103 additions and 14 deletions
@@ -394,8 +394,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,
@@ -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 = "<span class='warning'>The reflectors's fragile shield shatters into pieces!</span>"
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, "<span class='warning'>[src] cannot be rotated while it is fastened to the floor!</span>")
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, "<span class='notice'>You [anchored ? "secure" : "unsecure"] \the [src].</span>")
I.play_tool_sound(src)
return TRUE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 127 KiB

+13 -12
View File
@@ -1232,6 +1232,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"
@@ -2504,22 +2505,10 @@
#include "code\modules\research\designs\AI_module_designs.dm"
#include "code\modules\research\designs\biogenerator_designs.dm"
#include "code\modules\research\designs\bluespace_designs.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_all_misc.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_cargo .dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_engi.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_medical.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_sci.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_sec.dm"
#include "code\modules\research\designs\computer_part_designs.dm"
#include "code\modules\research\designs\electronics_designs.dm"
#include "code\modules\research\designs\equipment_designs.dm"
#include "code\modules\research\designs\limbgrower_designs.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_all_misc.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_cargo.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_engi.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_medical.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_sci.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_service.dm"
#include "code\modules\research\designs\mecha_designs.dm"
#include "code\modules\research\designs\mechfabricator_designs.dm"
#include "code\modules\research\designs\medical_designs.dm"
@@ -2537,6 +2526,18 @@
#include "code\modules\research\designs\autolathe_desings\autolathe_designs_sec_and_hacked.dm"
#include "code\modules\research\designs\autolathe_desings\autolathe_designs_tcomms_and_misc.dm"
#include "code\modules\research\designs\autolathe_desings\autolathe_designs_tools.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_all_misc.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_cargo .dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_engi.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_medical.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_sci.dm"
#include "code\modules\research\designs\comp_board_designs\comp_board_designs_sec.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_all_misc.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_cargo.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_engi.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_medical.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_sci.dm"
#include "code\modules\research\designs\machine_desings\machine_designs_service.dm"
#include "code\modules\research\machinery\_production.dm"
#include "code\modules\research\machinery\circuit_imprinter.dm"
#include "code\modules\research\machinery\departmental_circuit_imprinter.dm"