mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 21:19:44 +01:00
Rotatable Atom Element (#18440)
* initial work * a much better way of doing this * these are needed * minimize change * nope * missing elements * whitespace * species cases * reduce pasta in ghosts * more small fixes * fixes for windows and inventory * unneeded * protected * circulator uses examine --------- Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
@@ -19,6 +19,10 @@ LINEN BINS
|
||||
drop_sound = 'sound/items/drop/clothing.ogg'
|
||||
pickup_sound = 'sound/items/pickup/clothing.ogg'
|
||||
|
||||
/obj/item/bedsheet/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/rotatable/onlyflip)
|
||||
|
||||
/obj/item/bedsheet/attack_self(mob/user as mob)
|
||||
user.drop_item()
|
||||
if(layer == initial(layer))
|
||||
@@ -39,22 +43,8 @@ LINEN BINS
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/bedsheet/verb/turn_around()
|
||||
set name = "Turn Around"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
|
||||
if(dir >= 2)
|
||||
src.set_dir(1)
|
||||
else
|
||||
src.set_dir(2)
|
||||
/obj/item/bedsheet/ghosts_can_use_rotate_verbs()
|
||||
return CONFIG_GET(flag/ghost_interaction)
|
||||
|
||||
/obj/item/bedsheet/blue
|
||||
icon_state = "sheetblue"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
/obj/structure/closet/crate/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/climbable)
|
||||
AddElement(/datum/element/rotatable)
|
||||
|
||||
/obj/structure/closet/crate/can_open()
|
||||
return 1
|
||||
@@ -71,26 +72,6 @@
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/structure/closet/crate/verb/rotate_clockwise()
|
||||
set name = "Rotate Crate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
|
||||
/obj/structure/closet/crate/verb/rotate_counterclockwise()
|
||||
set category = "Object"
|
||||
set name = "Rotate Crate Counterclockwise"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
|
||||
/obj/structure/closet/crate/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(W.has_tool_quality(TOOL_WRENCH) && istype(src,/obj/structure/closet/crate/bin))
|
||||
return ..()
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
to_chat(usr, span_notice("You switch [on ? "on" : "off"] [src]."))
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/e_chair/rotate_clockwise()
|
||||
..()
|
||||
cut_overlays()
|
||||
add_overlay(image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir)) //there's probably a better way of handling this, but eh. -Pete
|
||||
return
|
||||
/obj/structure/bed/chair/e_chair/set_dir()
|
||||
. = ..()
|
||||
if(.)
|
||||
cut_overlays()
|
||||
add_overlay(image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir)) //there's probably a better way of handling this, but eh. -Pete
|
||||
|
||||
/obj/structure/bed/chair/e_chair/proc/shock()
|
||||
if(!on)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
return INITIALIZE_HINT_QDEL
|
||||
color = material.icon_colour
|
||||
AddElement(/datum/element/climbable)
|
||||
AddElement(/datum/element/rotatable)
|
||||
|
||||
/obj/structure/gravemarker/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -109,40 +110,5 @@
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/gravemarker/verb/rotate_clockwise()
|
||||
set name = "Rotate Grave Marker Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(anchored)
|
||||
return
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return
|
||||
|
||||
//VOREstation edit: counter-clockwise rotation
|
||||
/obj/structure/gravemarker/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Grave Marker Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(anchored)
|
||||
return
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return
|
||||
/obj/structure/gravemarker/ghosts_can_use_rotate_verbs()
|
||||
return CONFIG_GET(flag/ghost_interaction)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
if (constructed) // player-constructed railings
|
||||
anchored = FALSE
|
||||
AddElement(/datum/element/climbable/unanchored_can_break, 3.4 SECONDS, TRUE) // It's a RAILING!
|
||||
AddElement(/datum/element/rotatable)
|
||||
if(src.anchored)
|
||||
update_icon(0)
|
||||
|
||||
@@ -132,43 +133,12 @@
|
||||
if (WEST)
|
||||
add_overlay(image(icon, src, "[icon_modifier]mcorneroverlay", pixel_y = 32))
|
||||
|
||||
/obj/structure/railing/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Railing Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
if (!can_touch(usr) || ismouse(usr))
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/structure/railing/verb/rotate_clockwise()
|
||||
set name = "Rotate Railing Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
if (!can_touch(usr) || ismouse(usr))
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
update_icon()
|
||||
return
|
||||
/obj/structure/railing/handle_rotation_verbs(angle)
|
||||
if(!can_touch(usr))
|
||||
return FALSE
|
||||
. = ..()
|
||||
if(.)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/railing/verb/flip() // This will help push railing to remote places, such as open space turfs
|
||||
set name = "Flip Railing"
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
if(new_padding_material)
|
||||
padding_material = get_material_by_name(new_padding_material)
|
||||
update_icon()
|
||||
if(flippable) // If we can't change directions, don't bother.
|
||||
// Ugly check for chairs, beds can only be flipped north and south...
|
||||
if(istype(src,/obj/structure/bed/chair))
|
||||
AddElement(/datum/element/rotatable)
|
||||
else
|
||||
AddElement(/datum/element/rotatable/onlyflip)
|
||||
return INITIALIZE_HINT_NORMAL
|
||||
|
||||
/obj/structure/bed/get_material()
|
||||
@@ -170,29 +176,11 @@
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
|
||||
/obj/structure/bed/verb/turn_around()
|
||||
set name = "Turn Around"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
/obj/structure/bed/ghosts_can_use_rotate_verbs()
|
||||
return CONFIG_GET(flag/ghost_interaction)
|
||||
|
||||
if(!flippable)
|
||||
to_chat(usr,span_notice("\The [src] can't face the other direction."))
|
||||
return
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
if(dir == 2)
|
||||
src.set_dir(1)
|
||||
else if(dir == 1)
|
||||
src.set_dir(2)
|
||||
else if(dir == 4)
|
||||
src.set_dir(8)
|
||||
else if(dir == 8)
|
||||
src.set_dir(4)
|
||||
/obj/structure/bed/can_use_rotate_verbs_while_anchored()
|
||||
return TRUE
|
||||
|
||||
/obj/structure/bed/psych
|
||||
name = "psychiatrist's couch"
|
||||
|
||||
@@ -66,34 +66,6 @@
|
||||
for(var/mob/living/L as anything in buckled_mobs)
|
||||
L.set_dir(dir)
|
||||
|
||||
/obj/structure/bed/chair/verb/rotate_clockwise()
|
||||
set name = "Rotate Chair Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
|
||||
/obj/structure/bed/chair/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Chair Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
|
||||
/obj/structure/bed/chair/shuttle
|
||||
name = "chair"
|
||||
icon_state = "shuttlechair"
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
update_state()
|
||||
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
AddElement(/datum/element/rotatable)
|
||||
|
||||
/obj/structure/windoor_assembly/Destroy()
|
||||
density = FALSE
|
||||
@@ -270,46 +271,14 @@
|
||||
name = "near finished "
|
||||
name += "[secure ? "secure " : ""]windoor assembly[created_name ? " ([created_name])" : ""]"
|
||||
|
||||
//Rotates the windoor assembly clockwise
|
||||
/obj/structure/windoor_assembly/verb/rotate_clockwise()
|
||||
set name = "Rotate Windoor Assembly Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored)
|
||||
to_chat(usr,"It is fastened to the floor; therefore, you can't rotate it!")
|
||||
return 0
|
||||
if(src.state != "01")
|
||||
/obj/structure/windoor_assembly/handle_rotation_verbs(angle)
|
||||
if(state != "01")
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
|
||||
if(src.state != "01")
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
update_icon()
|
||||
return
|
||||
|
||||
//VOREstation edit: counter-clockwise rotation
|
||||
/obj/structure/windoor_assembly/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Windoor Assembly Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored)
|
||||
to_chat(usr,"It is fastened to the floor; therefore, you can't rotate it!")
|
||||
return 0
|
||||
if(src.state != "01")
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
|
||||
if(src.state != "01")
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
update_icon()
|
||||
return
|
||||
//VOREstation edit end
|
||||
. = ..()
|
||||
if(.)
|
||||
if(state != "01")
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
update_icon()
|
||||
|
||||
//Flips the windoor assembly, determines whather the door opens to the left or the right
|
||||
/obj/structure/windoor_assembly/verb/flip()
|
||||
|
||||
@@ -342,49 +342,14 @@
|
||||
take_damage(damage)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Window Counterclockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
/obj/structure/window/handle_rotation_verbs(angle)
|
||||
if(is_fulltile())
|
||||
return 0
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
return FALSE
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate_clockwise()
|
||||
set name = "Rotate Window Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return 0
|
||||
|
||||
if(is_fulltile())
|
||||
return 0
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor therefore you can't rotate it!")
|
||||
return 0
|
||||
|
||||
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
. = ..()
|
||||
if(.)
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
/obj/structure/window/Initialize(mapload, start_dir=null, constructed=0)
|
||||
. = ..()
|
||||
@@ -396,7 +361,10 @@
|
||||
if (constructed)
|
||||
anchored = FALSE
|
||||
state = 0
|
||||
update_verbs()
|
||||
|
||||
// If we started anchored we'll need to disable rotation
|
||||
AddElement(/datum/element/rotatable)
|
||||
update_verbs()
|
||||
|
||||
health = maxhealth
|
||||
|
||||
@@ -450,11 +418,13 @@
|
||||
//Updates the availabiliy of the rotation verbs
|
||||
/obj/structure/window/proc/update_verbs()
|
||||
if(anchored || is_fulltile())
|
||||
verbs -= /obj/structure/window/verb/rotate_counterclockwise
|
||||
verbs -= /obj/structure/window/verb/rotate_clockwise
|
||||
verbs -= /atom/movable/proc/rotate_counterclockwise
|
||||
verbs -= /atom/movable/proc/rotate_clockwise
|
||||
verbs -= /atom/movable/proc/turn_around
|
||||
else if(!is_fulltile())
|
||||
verbs += /obj/structure/window/verb/rotate_counterclockwise
|
||||
verbs += /obj/structure/window/verb/rotate_clockwise
|
||||
verbs |= /atom/movable/proc/rotate_counterclockwise
|
||||
verbs |= /atom/movable/proc/rotate_clockwise
|
||||
verbs |= /atom/movable/proc/turn_around
|
||||
|
||||
//merges adjacent full-tile windows into one (blatant ripoff from game/smoothwall.dm)
|
||||
/obj/structure/window/update_icon()
|
||||
|
||||
Reference in New Issue
Block a user