mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 04:17:33 +01:00
Genericises rotate() on objects. (#8430)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
base_icon = "chair"
|
||||
buckle_dir = 0
|
||||
buckle_lying = 0 //force people to sit up in chairs when buckled
|
||||
obj_flags = OBJ_FLAG_ROTATABLE
|
||||
var/propelled = 0 // Check for fire-extinguisher-driven chairs
|
||||
|
||||
/obj/structure/bed/chair/attackby(obj/item/W as obj, mob/user as mob)
|
||||
@@ -70,25 +71,6 @@
|
||||
if(buckled_mob)
|
||||
buckled_mob.set_dir(dir)
|
||||
|
||||
/obj/structure/bed/chair/verb/rotate()
|
||||
set name = "Rotate Chair"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(config.ghost_interaction)
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return
|
||||
else
|
||||
if(israt(usr))
|
||||
return
|
||||
if(!usr || !isturf(usr.loc))
|
||||
return
|
||||
if(usr.stat || usr.restrained())
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return
|
||||
|
||||
// Leaving this in for the sake of compilation.
|
||||
/obj/structure/bed/chair/comfy
|
||||
desc = "It's a chair. It looks comfy."
|
||||
|
||||
@@ -13,6 +13,7 @@ obj/structure/windoor_assembly
|
||||
name = "windoor assembly"
|
||||
icon = 'icons/obj/doors/windoor.dmi'
|
||||
icon_state = "l_windoor_assembly01"
|
||||
obj_flags = OBJ_FLAG_ROTATABLE
|
||||
anchored = 0
|
||||
density = 0
|
||||
dir = NORTH
|
||||
@@ -26,7 +27,7 @@ obj/structure/windoor_assembly
|
||||
var/secure = "" //Whether or not this creates a secure windoor
|
||||
var/state = "01" //How far the door assembly has progressed in terms of sprites
|
||||
|
||||
obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
|
||||
/obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
|
||||
..()
|
||||
if(constructed)
|
||||
state = "01"
|
||||
@@ -261,62 +262,27 @@ obj/structure/windoor_assembly/Destroy()
|
||||
//Update to reflect changes(if applicable)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/windoor_assembly/rotate(var/mob/user)
|
||||
if(use_check_and_message(user))
|
||||
return
|
||||
|
||||
//Rotates the windoor assembly clockwise
|
||||
//These directions are fucked up, apparently dm rotates anticlockwise by default
|
||||
/obj/structure/windoor_assembly/verb/rotate()
|
||||
set name = "Rotate Windoor Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
var/targetdir = turn(src.dir, 270)
|
||||
if(anchored)
|
||||
to_chat(user, SPAN_WARNING("\The [src] is bolted to the floor!"))
|
||||
return FALSE
|
||||
|
||||
var/targetdir = turn(dir, 270)
|
||||
for(var/obj/obstacle in get_turf(src))
|
||||
if (obstacle == src)
|
||||
continue
|
||||
|
||||
if((obstacle.flags & ON_BORDER) && obstacle.dir == targetdir)
|
||||
to_chat(usr, span("danger", "You can't turn the windoor assembly that way, there's already something there!"))
|
||||
to_chat(usr, SPAN_WARNING("You can't turn the windoor assembly that way, there's already something there!"))
|
||||
return
|
||||
|
||||
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(targetdir)
|
||||
|
||||
if(src.state != "01")
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
//Rotates the windoor assembly anticlockwise
|
||||
/obj/structure/windoor_assembly/verb/revrotate()
|
||||
set name = "Rotate Windoor Anticlockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
var/targetdir = turn(src.dir, 90)
|
||||
|
||||
for(var/obj/obstacle in get_turf(src))
|
||||
if (obstacle == src)
|
||||
continue
|
||||
|
||||
if((obstacle.flags & ON_BORDER) && obstacle.dir == targetdir)
|
||||
to_chat(usr, span("danger", "You can't turn the windoor assembly that way, there's already something there!"))
|
||||
return
|
||||
|
||||
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(targetdir)
|
||||
set_dir(targetdir)
|
||||
|
||||
if(src.state != "01")
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
icon = 'icons/obj/structures.dmi'
|
||||
density = 1
|
||||
w_class = 3
|
||||
|
||||
layer = 3.2//Just above doors
|
||||
anchored = 1.0
|
||||
flags = ON_BORDER
|
||||
obj_flags = OBJ_FLAG_ROTATABLE
|
||||
var/maxhealth = 14.0
|
||||
var/maximal_heat = T0C + 100 // Maximal heat before this window begins taking damage from fire
|
||||
var/damage_per_fire_tick = 2.0 // Amount of damage per fire tick. Regular windows are not fireproof so they might as well break quickly.
|
||||
@@ -300,44 +300,6 @@
|
||||
take_damage(damage)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate()
|
||||
set name = "Rotate Window Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
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
|
||||
set_dir(turn(dir, 90))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/revrotate()
|
||||
set name = "Rotate Window Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
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
|
||||
set_dir(turn(dir, 270))
|
||||
updateSilicate()
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
return
|
||||
|
||||
/obj/structure/window/Initialize(mapload, start_dir = null, constructed=0)
|
||||
. = ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user