mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 12:02:31 +01:00
Genericises rotate() on objects. (#8430)
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
/obj
|
||||
//Used to store information about the contents of the object.
|
||||
var/list/matter
|
||||
animate_movement = 2
|
||||
|
||||
|
||||
var/list/matter //Used to store information about the contents of the object.
|
||||
var/w_class // Size of the object.
|
||||
var/list/origin_tech = null //Used by R&D to determine what research bonuses it grants.
|
||||
var/unacidable = 0 //universal "unacidabliness" var, here so you can use it in any obj.
|
||||
animate_movement = 2
|
||||
|
||||
var/obj_flags //Special flags such as whether or not this object can be rotated.
|
||||
var/throwforce = 1
|
||||
var/list/attack_verb //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]"
|
||||
var/sharp = 0 // whether this object cuts
|
||||
var/edge = 0 // whether this object is more likely to dismember
|
||||
var/in_use = 0 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
|
||||
var/damtype = "brute"
|
||||
var/damtype = BRUTE
|
||||
var/force = 0
|
||||
var/armor_penetration = 0
|
||||
var/noslice = 0 // To make it not able to slice things.
|
||||
@@ -24,7 +27,7 @@
|
||||
var/icon_species_in_hand = 0//If 1, we will use the species tag even for rendering this item in the left/right hand.
|
||||
|
||||
var/equip_slot = 0
|
||||
var/usesound = null
|
||||
var/usesound
|
||||
var/toolspeed = 1
|
||||
|
||||
/obj/Destroy()
|
||||
@@ -221,3 +224,24 @@
|
||||
var/shake_dir = pick(-1, 1)
|
||||
animate(src, transform = turn(matrix(), 8*shake_dir), pixel_x = init_px + 2*shake_dir, time = 1)
|
||||
animate(transform = null, pixel_x = init_px, time = 6, easing = ELASTIC_EASING)
|
||||
|
||||
/obj/proc/rotate(var/mob/user)
|
||||
if(use_check_and_message(user))
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(user, SPAN_WARNING("\The [src] is bolted down to the floor!"))
|
||||
return
|
||||
|
||||
set_dir(turn(dir, 90))
|
||||
update_icon()
|
||||
|
||||
/obj/AltClick(var/mob/user)
|
||||
if(obj_flags & OBJ_FLAG_ROTATABLE)
|
||||
rotate(user)
|
||||
..()
|
||||
|
||||
/obj/examine(mob/user)
|
||||
. = ..()
|
||||
if((obj_flags & OBJ_FLAG_ROTATABLE))
|
||||
to_chat(user, SPAN_SUBTLE("Can be rotated with alt-click."))
|
||||
|
||||
@@ -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