Genericises rotate() on objects. (#8430)

This commit is contained in:
Matt Atlas
2020-03-17 17:17:42 +01:00
committed by GitHub
parent d68a92f48b
commit 72c968eba6
24 changed files with 373 additions and 665 deletions
+1
View File
@@ -40,6 +40,7 @@
#include "code\__defines\misc.dm"
#include "code\__defines\mobs.dm"
#include "code\__defines\modular_guns.dm"
#include "code\__defines\obj.dm"
#include "code\__defines\psi.dm"
#include "code\__defines\qdel.dm"
#include "code\__defines\radio.dm"
@@ -6,7 +6,8 @@
desc = "A gas circulator turbine and heat exchanger."
icon = 'icons/obj/pipes.dmi'
icon_state = "circ-off"
anchored = 0
anchored = FALSE
obj_flags = OBJ_FLAG_ROTATABLE
var/kinetic_efficiency = 0.04 //combined kinetic and kinetic-to-electric efficiency
var/volume_ratio = 0.2
@@ -20,7 +21,7 @@
var/volume_capacity_used = 0
var/stored_energy = 0
density = 1
density = TRUE
/obj/machinery/atmospherics/binary/circulator/Initialize()
. = ..()
@@ -120,26 +121,3 @@
else
..()
/obj/machinery/atmospherics/binary/circulator/verb/rotate_clockwise()
set category = "Object"
set name = "Rotate Circulator (Clockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, 90))
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
/obj/machinery/atmospherics/binary/circulator/verb/rotate_anticlockwise()
set category = "Object"
set name = "Rotate Circulator (Counterclockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, -90))
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
@@ -5,6 +5,7 @@
icon_state = "turbine"
anchored = 0
density = 1
obj_flags = OBJ_FLAG_ROTATABLE
var/efficiency = 0.4
var/kin_energy = 0
@@ -118,27 +119,6 @@
else
..()
verb/rotate_clockwise()
set category = "Object"
set name = "Rotate Circulator (Clockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, -90))
verb/rotate_anticlockwise()
set category = "Object"
set name = "Rotate Circulator (Counterclockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, 90))
//Goddamn copypaste from binary base class because atmospherics machinery API is not damn flexible
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
@@ -230,6 +210,7 @@
icon_state = "motor"
anchored = 0
density = 1
obj_flags = OBJ_FLAG_ROTATABLE
var/kin_to_el_ratio = 0.1 //How much kinetic energy will be taken from turbine and converted into electricity
var/obj/machinery/atmospherics/pipeturbine/turbine
@@ -267,23 +248,3 @@
updateConnection()
else
..()
verb/rotate_clock()
set category = "Object"
set name = "Rotate Motor Clockwise"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, -90))
verb/rotate_anticlock()
set category = "Object"
set name = "Rotate Motor Counterclockwise"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, 90))
+1
View File
@@ -10,6 +10,7 @@
#define SPAN_ALIEN(X) "<span class='alium'>[X]</span>"
#define SPAN_ITALIC(X) "<span class='italic'>[X]</span>"
#define SPAN_BOLD(X) "<span class='bold'>[X]</span>"
#define SPAN_SUBTLE(X) "<span class='subtle'>[X]</span>"
#define FONT_SMALL(X) "<font size='1'>[X]</font>"
#define FONT_NORMAL(X) "<font size='2'>[X]</font>"
+1
View File
@@ -0,0 +1 @@
#define OBJ_FLAG_ROTATABLE (1<<1) //Can this object be rotated?
+1 -20
View File
@@ -10,6 +10,7 @@
density = 0
anchored = 0
use_power = 0
obj_flags = OBJ_FLAG_ROTATABLE
var/obj/item/circuitboard/circuit = null
var/list/components = null
var/list/req_components = null
@@ -17,26 +18,6 @@
var/state = 1
var/pitch_toggle = 1
/obj/machinery/constructable_frame/verb/rotate_clockwise()
set category = "Object"
set name = "Rotate Clockwise"
set src in view(1)
if(use_check(usr) || anchored)
return
src.set_dir(turn(src.dir, -90))
/obj/machinery/constructable_frame/verb/rotate_counterclockwise()
set category = "Object"
set name = "Rotate Counter-Clockwise"
set src in view(1)
if(use_check(usr) || anchored)
return
src.set_dir(turn(src.dir, 90))
/obj/machinery/constructable_frame/proc/update_desc()
var/D
+1 -11
View File
@@ -9,6 +9,7 @@
use_power = 1
idle_power_usage = 2
active_power_usage = 50
obj_flags = OBJ_FLAG_ROTATABLE
var/power = 1.0
var/code = 1.0
@@ -68,17 +69,6 @@
"You hear a ratchet")
src.anchored = 0
/obj/machinery/mass_driver/verb/rotate()
set name = "Rotate"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 90))
return 1
/obj/item/mass_driver_diy
name = "Mass Driver Kit"
desc = "A do-it-yourself kit for constructing the finest of mass drivers."
+9 -15
View File
@@ -65,6 +65,7 @@ Buildable meters
randpixel = 5
w_class = 3
level = 2
obj_flags = OBJ_FLAG_ROTATABLE
/obj/item/pipe/New(var/loc, var/pipe_type as num, var/dir as num, var/obj/machinery/atmospherics/make_from = null)
..()
@@ -317,25 +318,18 @@ Buildable meters
// rotate the pipe item clockwise
/obj/item/pipe/verb/rotate()
set category = "Object"
set name = "Rotate Pipe"
set src in view(1)
/obj/item/pipe/rotate()
. = ..()
sanitize_dir()
if ( usr.stat || usr.restrained() )
return
src.set_dir(turn(src.dir, -90))
if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE))
if(dir==2)
/obj/item/pipe/proc/sanitize_dir()
if(pipe_type in list(PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE))
if(dir == 2)
set_dir(1)
else if(dir==8)
else if(dir == 8)
set_dir(4)
else if (pipe_type in list (PIPE_MANIFOLD4W, PIPE_SUPPLY_MANIFOLD4W, PIPE_SCRUBBERS_MANIFOLD4W))
else if(pipe_type in list(PIPE_MANIFOLD4W, PIPE_SUPPLY_MANIFOLD4W, PIPE_SCRUBBERS_MANIFOLD4W))
set_dir(2)
//src.pipe_set_dir(get_pipe_dir())
return
/obj/item/pipe/Move()
..()
+29 -5
View File
@@ -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)
+1 -39
View File
@@ -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)
. = ..()
+1 -12
View File
@@ -6,10 +6,9 @@
icon_state = "infrared"
origin_tech = list(TECH_MAGNET = 2)
matter = list(DEFAULT_WALL_MATERIAL = 1000, "glass" = 500, "waste" = 100)
wires = WIRE_PULSE
secured = 0
obj_flags = OBJ_FLAG_ROTATABLE
var/on = 0
var/visible = 0
@@ -143,16 +142,6 @@
return
verb/rotate()//This could likely be better
set name = "Rotate Infrared Laser"
set category = "Object"
set src in usr
set_dir(turn(dir, 90))
return
/***************************IBeam*********************************/
/obj/effect/beam/i_beam
+1 -14
View File
@@ -9,6 +9,7 @@
name = "mining drill head"
desc = "A large industrial drill. Its bore does not penetrate deep enough to access the sublevels."
icon_state = "mining_drill"
obj_flags = OBJ_FLAG_ROTATABLE
var/braces_needed = 2
var/list/supports = list()
var/supported = FALSE
@@ -459,17 +460,3 @@
connected.supports -= src
connected.check_supports()
connected = null
/obj/machinery/mining/brace/verb/rotate()
set name = "Rotate"
set category = "Object"
set src in oview(1)
if(usr.stat) return
if (src.anchored)
to_chat(usr, "It is anchored in place!")
return FALSE
src.set_dir(turn(src.dir, 90))
return TRUE
+3 -13
View File
@@ -1100,25 +1100,15 @@ var/list/total_extraction_beacons = list()
desc = "A finely chiselled sculpting block, it is ready to be your canvas."
icon = 'icons/obj/mining.dmi'
icon_state = "sculpting_block"
density = 1
opacity = 1
density = TRUE
opacity = TRUE
anchored = 0
obj_flags = OBJ_FLAG_ROTATABLE
var/sculpted = 0
var/mob/living/T
var/times_carved = 0
var/last_struck = 0
/obj/structure/sculpting_block/verb/rotate()
set name = "Rotate"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 90))
return 1
/obj/structure/sculpting_block/attackby(obj/item/C as obj, mob/user as mob)
if (C.iswrench())
+2 -2
View File
@@ -97,7 +97,7 @@
adjust_speed(0, -get_acceleration())
/obj/effect/map/ship/proc/rotate(var/direction)
/obj/effect/map/ship/proc/rotate_ship(var/direction)
var/matrix/M = matrix()
M.Turn(dir2angle(direction))
src.transform = M //Rotate ship
@@ -113,4 +113,4 @@
if(newloc)
Move(newloc)
if(rotate)
rotate(get_heading())
rotate_ship(get_heading())
+4 -24
View File
@@ -2,10 +2,11 @@
name = "thermoelectric generator"
desc = "It's a high efficiency thermoelectric generator."
icon_state = "teg"
density = 1
anchored = 0
density = TRUE
anchored = FALSE
obj_flags = OBJ_FLAG_ROTATABLE
use_power = 1
use_power = FALSE
idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things.
var/max_power = 500000
@@ -221,24 +222,3 @@
/obj/machinery/power/generator/power_change()
..()
updateicon()
/obj/machinery/power/generator/verb/rotate_clock()
set category = "Object"
set name = "Rotate Generator (Clockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, 90))
/obj/machinery/power/generator/verb/rotate_anticlock()
set category = "Object"
set name = "Rotate Generator (Counterclockwise)"
set src in view(1)
if (usr.stat || usr.restrained() || anchored)
return
src.set_dir(turn(src.dir, -90))
+3 -13
View File
@@ -5,9 +5,10 @@
desc = "It is a heavy duty industrial laser."
icon = 'icons/obj/singularity.dmi'
icon_state = "emitter"
anchored = 0
density = 1
anchored = FALSE
density = TRUE
req_access = list(access_engine_equip)
obj_flags = OBJ_FLAG_ROTATABLE
var/id = null
use_power = 0 //uses powernet power, not APC power
@@ -33,17 +34,6 @@
QDEL_NULL(spark_system)
return ..()
/obj/machinery/power/emitter/verb/rotate()
set name = "Rotate"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 90))
return 1
/obj/machinery/power/emitter/Initialize()
. = ..()
spark_system = bind_spark(src, 5, alldirs)
@@ -64,6 +64,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
icon = 'icons/obj/machines/particle_accelerator.dmi'
anchored = FALSE
density = TRUE
obj_flags = OBJ_FLAG_ROTATABLE
var/obj/machinery/particle_accelerator/control_box/master
var/construction_state = 0
var/reference
@@ -82,36 +83,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
icon_state = "end_cap"
reference = "end_cap"
/obj/structure/particle_accelerator/verb/rotate()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 270))
return TRUE
/obj/structure/particle_accelerator/verb/rotateccw()
set name = "Rotate Counter Clockwise"
set category = "Object"
set src in oview(1)
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 90))
return TRUE
/obj/structure/particle_accelerator/examine(mob/user)
switch(construction_state)
if(0)
@@ -265,36 +236,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
var/powered
var/strength = 0
/obj/machinery/particle_accelerator/verb/rotate()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 270))
return TRUE
/obj/machinery/particle_accelerator/verb/rotateccw()
set name = "Rotate Counter-Clockwise"
set category = "Object"
set src in oview(1)
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 90))
return TRUE
/obj/machinery/particle_accelerator/update_icon()
return
+252 -264
View File
@@ -11,6 +11,7 @@
density = 0
matter = list(DEFAULT_WALL_MATERIAL = 1850)
level = 2
obj_flags = OBJ_FLAG_ROTATABLE
var/sortType = ""
var/ptype = 0
// 0=straight, 1=bent, 2=junction-j1, 3=junction-j2, 4=junction-y, 5=trunk, 6=disposal bin, 7=outlet, 8=inlet 9=pipe-j1s 10=pipe-j2s
@@ -19,170 +20,157 @@
var/base_state = "pipe-s"
// update iconstate and dpdir due to dir and type
proc/update()
var/flip = turn(dir, 180)
var/left = turn(dir, 90)
var/right = turn(dir, -90)
/obj/structure/disposalconstruct/proc/update()
var/flip = turn(dir, 180)
var/left = turn(dir, 90)
var/right = turn(dir, -90)
switch(ptype)
if(0)
base_state = "pipe-s"
dpdir = dir | flip
if(1)
base_state = "pipe-c"
dpdir = dir | right
if(2)
base_state = "pipe-j1"
dpdir = dir | right | flip
if(3)
base_state = "pipe-j2"
dpdir = dir | left | flip
if(4)
base_state = "pipe-y"
dpdir = dir | left | right
if(5)
base_state = "pipe-t"
dpdir = dir
// disposal bin has only one dir, thus we don't need to care about setting it
if(6)
if(anchored)
base_state = "disposal"
else
base_state = "condisposal"
switch(ptype)
if(0)
base_state = "pipe-s"
dpdir = dir | flip
if(1)
base_state = "pipe-c"
dpdir = dir | right
if(2)
base_state = "pipe-j1"
dpdir = dir | right | flip
if(3)
base_state = "pipe-j2"
dpdir = dir | left | flip
if(4)
base_state = "pipe-y"
dpdir = dir | left | right
if(5)
base_state = "pipe-t"
dpdir = dir
// disposal bin has only one dir, thus we don't need to care about setting it
if(6)
if(anchored)
base_state = "disposal"
else
base_state = "condisposal"
if(7)
base_state = "outlet"
dpdir = dir
if(7)
base_state = "outlet"
dpdir = dir
if(8)
base_state = "intake"
dpdir = dir
if(8)
base_state = "intake"
dpdir = dir
if(9)
base_state = "pipe-j1s"
dpdir = dir | right | flip
if(9)
base_state = "pipe-j1s"
dpdir = dir | right | flip
if(10)
base_state = "pipe-j2s"
dpdir = dir | left | flip
if(10)
base_state = "pipe-j2s"
dpdir = dir | left | flip
///// Z-Level stuff
if(11)
base_state = "pipe-u"
dpdir = dir
if(12)
base_state = "pipe-d"
dpdir = dir
if(11)
base_state = "pipe-u"
dpdir = dir
if(12)
base_state = "pipe-d"
dpdir = dir
///// Z-Level stuff
if(13)
base_state = "pipe-tagger"
dpdir = dir | flip
if(14)
base_state = "pipe-tagger-partial"
dpdir = dir | flip
if(13)
base_state = "pipe-tagger"
dpdir = dir | flip
if(14)
base_state = "pipe-tagger-partial"
dpdir = dir | flip
///// Z-Level stuff
if(!(ptype in list(6, 7, 8, 11, 12, 13, 14)))
if(!(ptype in list(6, 7, 8, 11, 12, 13, 14)))
///// Z-Level stuff
icon_state = "con[base_state]"
else
icon_state = base_state
icon_state = "con[base_state]"
else
icon_state = base_state
if(invisibility) // if invisible, fade icon
alpha = 128
else
alpha = 255
//otherwise burying half-finished pipes under floors causes them to half-fade
if(invisibility) // if invisible, fade icon
alpha = 128
else
alpha = 255
//otherwise burying half-finished pipes under floors causes them to half-fade
// hide called by levelupdate if turf intact status changes
// change visibility status and force update of icon
hide(var/intact)
invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact
update()
/obj/structure/disposalconstruct/hide(var/intact)
invisibility = (intact && level==1) ? 101: 0 // hide if floor is intact
update()
// flip and rotate verbs
verb/rotate()
set category = "Object"
set name = "Rotate Pipe"
set src in view(1)
/obj/structure/disposalconstruct/rotate(var/mob/user)
. = ..()
update()
if(usr.stat)
return
/obj/structure/disposalconstruct/verb/flip()
set category = "Object"
set name = "Flip Pipe"
set src in view(1)
if(usr.stat)
return
if(anchored)
to_chat(usr, "You must unfasten the pipe before rotating it.")
return
if(anchored)
to_chat(usr, "You must unfasten the pipe before flipping it.")
return
set_dir(turn(dir, -90))
update()
set_dir(turn(dir, 180))
switch(ptype)
if(2)
ptype = 3
if(3)
ptype = 2
if(9)
ptype = 10
if(10)
ptype = 9
verb/flip()
set category = "Object"
set name = "Flip Pipe"
set src in view(1)
if(usr.stat)
return
if(anchored)
to_chat(usr, "You must unfasten the pipe before flipping it.")
return
set_dir(turn(dir, 180))
switch(ptype)
if(2)
ptype = 3
if(3)
ptype = 2
if(9)
ptype = 10
if(10)
ptype = 9
update()
update()
// returns the type path of disposalpipe corresponding to this item dtype
proc/dpipetype()
switch(ptype)
if(0,1)
return /obj/structure/disposalpipe/segment
if(2,3,4)
return /obj/structure/disposalpipe/junction
if(5)
return /obj/structure/disposalpipe/trunk
if(6)
return /obj/machinery/disposal
if(7)
return /obj/structure/disposaloutlet
if(8)
return /obj/machinery/disposal/deliveryChute
if(9)
switch(subtype)
if(0)
return /obj/structure/disposalpipe/sortjunction
if(1)
return /obj/structure/disposalpipe/sortjunction/wildcard
if(2)
return /obj/structure/disposalpipe/sortjunction/untagged
if(10)
switch(subtype)
if(0)
return /obj/structure/disposalpipe/sortjunction/flipped
if(1)
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
if(2)
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
/obj/structure/disposalconstruct/proc/dpipetype()
switch(ptype)
if(0,1)
return /obj/structure/disposalpipe/segment
if(2,3,4)
return /obj/structure/disposalpipe/junction
if(5)
return /obj/structure/disposalpipe/trunk
if(6)
return /obj/machinery/disposal
if(7)
return /obj/structure/disposaloutlet
if(8)
return /obj/machinery/disposal/deliveryChute
if(9)
switch(subtype)
if(0)
return /obj/structure/disposalpipe/sortjunction
if(1)
return /obj/structure/disposalpipe/sortjunction/wildcard
if(2)
return /obj/structure/disposalpipe/sortjunction/untagged
if(10)
switch(subtype)
if(0)
return /obj/structure/disposalpipe/sortjunction/flipped
if(1)
return /obj/structure/disposalpipe/sortjunction/wildcard/flipped
if(2)
return /obj/structure/disposalpipe/sortjunction/untagged/flipped
///// Z-Level stuff
if(11)
return /obj/structure/disposalpipe/up
if(12)
return /obj/structure/disposalpipe/down
if(11)
return /obj/structure/disposalpipe/up
if(12)
return /obj/structure/disposalpipe/down
///// Z-Level stuff
if(13)
return /obj/structure/disposalpipe/tagger
if(14)
return /obj/structure/disposalpipe/tagger/partial
return
if(13)
return /obj/structure/disposalpipe/tagger
if(14)
return /obj/structure/disposalpipe/tagger/partial
return
@@ -190,136 +178,136 @@
// wrench: (un)anchor
// weldingtool: convert to real pipe
attackby(var/obj/item/I, var/mob/user)
var/nicetype = "pipe"
var/ispipe = 0 // Indicates if we should change the level of this pipe
src.add_fingerprint(user)
switch(ptype)
if(6)
nicetype = "disposal bin"
if(7)
nicetype = "disposal outlet"
if(8)
nicetype = "delivery chute"
if(9, 10)
switch(subtype)
if(0)
nicetype = "sorting pipe"
if(1)
nicetype = "wildcard sorting pipe"
if(2)
nicetype = "untagged sorting pipe"
ispipe = 1
if(13)
nicetype = "tagging pipe"
ispipe = 1
if(14)
nicetype = "partial tagging pipe"
ispipe = 1
/obj/structure/disposalconstruct/attackby(var/obj/item/I, var/mob/user)
var/nicetype = "pipe"
var/ispipe = 0 // Indicates if we should change the level of this pipe
src.add_fingerprint(user)
switch(ptype)
if(6)
nicetype = "disposal bin"
if(7)
nicetype = "disposal outlet"
if(8)
nicetype = "delivery chute"
if(9, 10)
switch(subtype)
if(0)
nicetype = "sorting pipe"
if(1)
nicetype = "wildcard sorting pipe"
if(2)
nicetype = "untagged sorting pipe"
ispipe = 1
if(13)
nicetype = "tagging pipe"
ispipe = 1
if(14)
nicetype = "partial tagging pipe"
ispipe = 1
else
nicetype = "pipe"
ispipe = 1
var/turf/T = src.loc
if(!T.is_plating())
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
return
var/obj/structure/disposalpipe/CP = locate() in T
if(I.iswrench())
if(anchored)
anchored = 0
if(ispipe)
level = 2
density = 0
else
nicetype = "pipe"
ispipe = 1
var/turf/T = src.loc
if(!T.is_plating())
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
return
var/obj/structure/disposalpipe/CP = locate() in T
if(I.iswrench())
if(anchored)
anchored = 0
if(ispipe)
level = 2
density = 0
else
density = 1
to_chat(user, "You detach the [nicetype] from the underfloor.")
else
if(ptype>=6 && ptype <= 8) // Disposal or outlet
if(CP) // There's something there
if(!istype(CP,/obj/structure/disposalpipe/trunk))
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
return
else // Nothing under, fuck.
density = 1
to_chat(user, "You detach the [nicetype] from the underfloor.")
else
if(ptype>=6 && ptype <= 8) // Disposal or outlet
if(CP) // There's something there
if(!istype(CP,/obj/structure/disposalpipe/trunk))
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
return
else
if(CP)
update()
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
to_chat(user, "There is already a [nicetype] at that location.")
return
anchored = 1
if(ispipe)
level = 1 // We don't want disposal bins to disappear under the floors
density = 0
else
density = 1 // We don't want disposal bins or outlets to go density 0
to_chat(user, "You attach the [nicetype] to the underfloor.")
playsound(src.loc, I.usesound, 100, 1)
update()
else if(I.iswelder())
if(anchored)
var/obj/item/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
to_chat(user, "Welding the [nicetype] in place.")
if(do_after(user, 20/W.toolspeed))
if(!src || !W.isOn()) return
to_chat(user, "The [nicetype] has been welded in place!")
update() // TODO: Make this neat
if(ispipe) // Pipe
var/pipetype = dpipetype()
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
src.transfer_fingerprints_to(P)
P.base_icon_state = base_state
P.set_dir(dir)
P.dpdir = dpdir
P.updateicon()
//Needs some special treatment ;)
if(ptype==9 || ptype==10)
var/obj/structure/disposalpipe/sortjunction/SortP = P
SortP.sortType = sortType
SortP.updatedir()
SortP.updatedesc()
SortP.updatename()
else if(ptype==6) // Disposal bin
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
src.transfer_fingerprints_to(P)
P.mode = 0 // start with pump off
else if(ptype==7) // Disposal outlet
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
src.transfer_fingerprints_to(P)
P.set_dir(dir)
var/obj/structure/disposalpipe/trunk/Trunk = CP
Trunk.linked = P
else if(ptype==8) // Disposal outlet
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
src.transfer_fingerprints_to(P)
P.set_dir(dir)
qdel(src)
return
else
to_chat(user, "You need more welding fuel to complete this task.")
else // Nothing under, fuck.
to_chat(user, "The [nicetype] requires a trunk underneath it in order to work.")
return
else
to_chat(user, "You need to attach it to the plating first!")
if(CP)
update()
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
to_chat(user, "There is already a [nicetype] at that location.")
return
anchored = 1
if(ispipe)
level = 1 // We don't want disposal bins to disappear under the floors
density = 0
else
density = 1 // We don't want disposal bins or outlets to go density 0
to_chat(user, "You attach the [nicetype] to the underfloor.")
playsound(src.loc, I.usesound, 100, 1)
update()
else if(I.iswelder())
if(anchored)
var/obj/item/weldingtool/W = I
if(W.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
to_chat(user, "Welding the [nicetype] in place.")
if(do_after(user, 20/W.toolspeed))
if(!src || !W.isOn()) return
to_chat(user, "The [nicetype] has been welded in place!")
update() // TODO: Make this neat
if(ispipe) // Pipe
var/pipetype = dpipetype()
var/obj/structure/disposalpipe/P = new pipetype(src.loc)
src.transfer_fingerprints_to(P)
P.base_icon_state = base_state
P.set_dir(dir)
P.dpdir = dpdir
P.updateicon()
//Needs some special treatment ;)
if(ptype==9 || ptype==10)
var/obj/structure/disposalpipe/sortjunction/SortP = P
SortP.sortType = sortType
SortP.updatedir()
SortP.updatedesc()
SortP.updatename()
else if(ptype==6) // Disposal bin
var/obj/machinery/disposal/P = new /obj/machinery/disposal(src.loc)
src.transfer_fingerprints_to(P)
P.mode = 0 // start with pump off
else if(ptype==7) // Disposal outlet
var/obj/structure/disposaloutlet/P = new /obj/structure/disposaloutlet(src.loc)
src.transfer_fingerprints_to(P)
P.set_dir(dir)
var/obj/structure/disposalpipe/trunk/Trunk = CP
Trunk.linked = P
else if(ptype==8) // Disposal outlet
var/obj/machinery/disposal/deliveryChute/P = new /obj/machinery/disposal/deliveryChute(src.loc)
src.transfer_fingerprints_to(P)
P.set_dir(dir)
qdel(src)
return
else
to_chat(user, "You need more welding fuel to complete this task.")
return
else
to_chat(user, "You need to attach it to the plating first!")
return
/obj/structure/disposalconstruct/hides_under_flooring()
if(anchored)
@@ -5,6 +5,7 @@
icon_state = "suspension2"
density = 1
req_access = list(access_research)
obj_flags = OBJ_FLAG_ROTATABLE
var/obj/item/cell/cell
var/obj/item/card/id/auth_card
var/locked = 1
@@ -315,26 +316,6 @@
deactivate()
return ..()
/obj/machinery/suspension_gen/verb/rotate_ccw()
set src in view(1)
set name = "Rotate suspension gen (counter-clockwise)"
set category = "Object"
if(anchored)
to_chat(usr, "<span class='warning'>You cannot rotate [src], it has been firmly fixed to the floor.</span>")
else
set_dir(turn(dir, 90))
/obj/machinery/suspension_gen/verb/rotate_cw()
set src in view(1)
set name = "Rotate suspension gen (clockwise)"
set category = "Object"
if(anchored)
to_chat(usr, "<span class='warning'>You cannot rotate [src], it has been firmly fixed to the floor.</span>")
else
set_dir(turn(dir, -90))
/obj/effect/suspension_field
name = "energy field"
icon = 'icons/effects/effects.dmi'
+1 -23
View File
@@ -7,6 +7,7 @@
desc = "Machine that charges a shield generator."
icon = 'icons/obj/machines/shielding.dmi'
icon_state = "capacitor"
obj_flags = OBJ_FLAG_ROTATABLE
var/active = 0
density = 1
var/stored_charge = 0 //not to be confused with power cell charge, this is in Joules
@@ -147,26 +148,3 @@
icon_state = "broke"
else
..()
/obj/machinery/shield_capacitor/verb/rotate()
set name = "Rotate capacitor clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored)
to_chat(usr, "It is fastened to the floor!")
return
if(config.ghost_interaction)
src.set_dir(turn(src.dir, -90))
return
else
if(istype(usr,/mob/living/simple_animal/rat))
return
if(!usr || !isturf(usr.loc))
return
if(usr.stat || usr.restrained())
return
src.set_dir(turn(src.dir, -90))
return
return
+1
View File
@@ -80,6 +80,7 @@ h1.alert, h2.alert {color: #000000;}
.rose {color: #ff5050;}
.info {color: #0000CC;}
.notice {color: #000099;}
.subtle {color: #000099; font-size: 75%; font-style: italic;}
.alium {color: #00ff00;}
.cult {color: #800080; font-weight: bold; font-style: italic;}
@@ -0,0 +1,42 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: MattAtlas
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "You can now alt click rotatable objects to rotate them."
- rscadd: "Objects that can be rotated will now tell you in their description."