Files
Aurora.3/code/game/objects/structures/curtains.dm
Fluffy c24b4c7097 Projectile refactoring madness (#19878)
Refactored the projectile code, mostly in line with TG's now.
Refactored various procs that are used or depends on it.
Projectiles can now ricochet if enabled to.
Damage falloffs with distance.
Homing projectiles can now have accuracy falloff with distance.
Projectiles have a maximum range.
Muzzle flash is configurable per projectile.
Impact effect of the projectile is configurable per projectile.
Accuracy decreases with distance.
Projectiles work with signals and emits them, for easy hooking up from
other parts of the code.
Meatshielding is now less effective .
Impact sound is now configurable per projectile.

High risk.
2024-09-23 10:12:57 +00:00

111 lines
3.1 KiB
Plaintext

/obj/structure/curtain
name = "curtain"
icon = 'icons/obj/curtain.dmi'
icon_state = "closed"
layer = ABOVE_WINDOW_LAYER
opacity = 1
density = 0
anchored = TRUE //curtains start secured in place
build_amt = 2
var/manipulating = FALSE //prevents queuing up multiple deconstructs and returning a bunch of cloth
var/curtain_material = MATERIAL_CLOTH
/obj/structure/curtain/Initialize()
. = ..()
material = SSmaterials.get_material_by_name(curtain_material)
AddComponent(/datum/component/turf_hand)
/obj/structure/curtain/open
icon_state = "open"
layer = ABOVE_HUMAN_LAYER
opacity = 0
/obj/structure/curtain/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit)
. = ..()
if(. != BULLET_ACT_HIT)
return .
if(hitting_projectile.damage > 0)
visible_message(SPAN_WARNING("[hitting_projectile] tears [src] down!"))
qdel(src)
/obj/structure/curtain/attack_hand(mob/user)
playsound(get_turf(loc), 'sound/effects/curtain.ogg', 15, 1, -5)
toggle()
..()
/obj/structure/curtain/attack_ai(mob/user)
if(istype(user, /mob/living/silicon/robot) && Adjacent(user)) // Robots can open/close it, but not the AI.
attack_hand(user)
/obj/structure/curtain/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iswirecutter() || attacking_item.sharp && !attacking_item.noslice)
if(manipulating) return
manipulating = TRUE
visible_message(SPAN_NOTICE("[user] begins cutting down \the [src]."),
SPAN_NOTICE("You begin cutting down \the [src]."))
if(!attacking_item.use_tool(src, user, 30, volume = 50))
manipulating = FALSE
return
visible_message(SPAN_NOTICE("[user] cuts down \the [src]."),
SPAN_NOTICE("You cut down \the [src]."))
dismantle()
if(attacking_item.isscrewdriver()) //You can anchor/unanchor curtains
anchored = !anchored
var/obj/structure/curtain/C
for(C in src.loc)
if(C != src && C.anchored) //Can't secure more than one curtain in a tile
to_chat(user, "There is already a curtain secured here!")
return
attacking_item.play_tool_sound(get_turf(src), 50)
visible_message(SPAN_NOTICE("\The [src] has been [anchored ? "secured in place" : "unsecured"] by \the [user]."))
/obj/structure/curtain/proc/toggle()
src.set_opacity(!src.opacity)
if(opacity)
icon_state = "closed"
layer = ABOVE_HUMAN_LAYER
else
icon_state = "open"
layer = ABOVE_WINDOW_LAYER
/obj/structure/curtain/black
name = "black curtain"
color = "#222222"
/obj/structure/curtain/medical
name = "plastic curtain"
color = "#B8F5E3"
anchored = FALSE
alpha = 200
curtain_material = MATERIAL_PLASTIC
/obj/structure/curtain/open/medical
name = "plastic curtain"
color = "#B8F5E3"
anchored = FALSE
alpha = 200
curtain_material = MATERIAL_PLASTIC
/obj/structure/curtain/open/bed
name = "bed curtain"
color = "#854636"
/obj/structure/curtain/open/privacy
name = "privacy curtain"
color = "#B8F5E3"
anchored = FALSE
/obj/structure/curtain/open/shower
name = "shower curtain"
color = "#ACD1E9"
alpha = 200
/obj/structure/curtain/open/shower/engineering
color = "#FFA500"
/obj/structure/curtain/open/shower/security
color = "#AA0000"