mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-09 23:27:56 +01:00
[MIRROR] Rotation component refactor and improvements [MDB IGNORE] (#11304)
* Rotation component refactor and improvements * Update code/modules/power/singularity/emitter.dm * e Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
@@ -21,15 +21,7 @@
|
||||
. = ..()
|
||||
AddElement(art_type, impressiveness)
|
||||
AddElement(/datum/element/beauty, impressiveness * 75)
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null)
|
||||
|
||||
/obj/structure/statue/proc/can_be_rotated(mob/user)
|
||||
if(!anchored)
|
||||
return TRUE
|
||||
to_chat(user, span_warning("It's bolted to the floor, you'll need to unwrench it first."))
|
||||
|
||||
/obj/structure/statue/proc/can_user_rotate(mob/user)
|
||||
return user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
/obj/structure/statue/attackby(obj/item/W, mob/living/user, params)
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -14,10 +14,9 @@
|
||||
var/obj/item/assembly/a_left = null
|
||||
var/obj/item/assembly/a_right = null
|
||||
|
||||
/obj/item/assembly_holder/ComponentInitialize()
|
||||
/obj/item/assembly_holder/Initialize(mapload)
|
||||
. = ..()
|
||||
var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS
|
||||
AddComponent(/datum/component/simple_rotation, rotation_flags)
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
/obj/item/assembly_holder/Destroy()
|
||||
QDEL_NULL(a_left)
|
||||
|
||||
@@ -18,13 +18,9 @@
|
||||
. = ..()
|
||||
beams = list()
|
||||
START_PROCESSING(SSobj, src)
|
||||
AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/AfterRotation))
|
||||
|
||||
/obj/item/assembly/infra/ComponentInitialize()
|
||||
. = ..()
|
||||
var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS
|
||||
AddComponent(/datum/component/simple_rotation, rotation_flags, after_rotation=CALLBACK(src,.proc/after_rotation))
|
||||
|
||||
/obj/item/assembly/infra/proc/after_rotation()
|
||||
/obj/item/assembly/infra/proc/AfterRotation(mob/user, degrees)
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
var/mode = CIRCULATOR_HOT
|
||||
var/obj/machinery/power/generator/generator
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
//default cold circ for mappers
|
||||
/obj/machinery/atmospherics/components/binary/circulator/cold
|
||||
mode = CIRCULATOR_COLD
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/Destroy()
|
||||
if(generator)
|
||||
disconnectFromGenerator()
|
||||
|
||||
@@ -69,13 +69,10 @@
|
||||
|
||||
/obj/machinery/hydroponics/constructable/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddComponent(/datum/component/plumbing/simple_demand)
|
||||
AddComponent(/datum/component/usb_port, list(/obj/item/circuit_component/hydroponics))
|
||||
|
||||
/obj/machinery/hydroponics/constructable/proc/can_be_rotated(mob/user, rotation_type)
|
||||
return !anchored
|
||||
|
||||
/obj/machinery/hydroponics/constructable/RefreshParts()
|
||||
var/tmp_capacity = 0
|
||||
for (var/obj/item/stock_parts/matter_bin/M in component_parts)
|
||||
|
||||
@@ -21,10 +21,7 @@
|
||||
. = ..()
|
||||
set_anchored(bolt)
|
||||
create_reagents(buffer, reagent_flags)
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
|
||||
|
||||
/obj/machinery/plumbing/proc/can_be_rotated(mob/user,rotation_type)
|
||||
return !anchored
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
/obj/machinery/plumbing/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
if(!valid_output_configuration)
|
||||
. += span_warning("A flashing notification on the screen reads: \"Output location error!\"")
|
||||
|
||||
/obj/machinery/plumbing/bottler/can_be_rotated(mob/user, rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, span_warning("It is fastened to the floor!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
///changes the tile array
|
||||
/obj/machinery/plumbing/bottler/setDir(newdir)
|
||||
. = ..()
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
)
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
|
||||
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, span_warning("It is fastened to the floor!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/plumbing/fermenter/setDir(newdir)
|
||||
. = ..()
|
||||
eat_dir = newdir
|
||||
|
||||
@@ -17,12 +17,6 @@
|
||||
)
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
|
||||
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, span_warning("It is fastened to the floor!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/plumbing/grinder_chemical/setDir(newdir)
|
||||
. = ..()
|
||||
eat_dir = newdir
|
||||
|
||||
@@ -17,15 +17,12 @@
|
||||
|
||||
/obj/machinery/power/generator/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
find_circs()
|
||||
connect_to_network()
|
||||
SSair.start_processing_machine(src)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/power/generator/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
|
||||
|
||||
/obj/machinery/power/generator/Destroy()
|
||||
kill_circs()
|
||||
SSair.stop_processing_machine(src)
|
||||
|
||||
@@ -59,21 +59,6 @@
|
||||
///stores the direction and orientation of the last projectile
|
||||
var/last_projectile_params
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/welded/Initialize(mapload)
|
||||
welded = TRUE
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/emitter/ctf
|
||||
name = "Energy Cannon"
|
||||
active = TRUE
|
||||
active_power_usage = 0
|
||||
idle_power_usage = 0
|
||||
locked = TRUE
|
||||
req_access_txt = "100"
|
||||
welded = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
|
||||
/obj/machinery/power/emitter/Initialize(mapload)
|
||||
. = ..()
|
||||
RefreshParts()
|
||||
@@ -86,11 +71,13 @@
|
||||
sparks = new
|
||||
sparks.attach(src)
|
||||
sparks.set_up(5, TRUE, src)
|
||||
|
||||
/obj/machinery/power/emitter/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
|
||||
|
||||
/obj/machinery/power/emitter/welded/Initialize(mapload)
|
||||
welded = TRUE
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/emitter/set_anchored(anchorvalue)
|
||||
. = ..()
|
||||
if(!anchored && welded) //make sure they're keep in sync in case it was forcibly unanchored by badmins or by a megafauna.
|
||||
@@ -132,16 +119,6 @@
|
||||
. += span_notice("Its status display reads: Emitting one beam every <b>[DisplayTimeText(fire_delay)]</b>.")
|
||||
. += span_notice("Power consumption at <b>[display_power(active_power_usage)]</b>.")
|
||||
|
||||
/obj/machinery/power/emitter/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
|
||||
|
||||
/obj/machinery/power/emitter/proc/can_be_rotated(mob/user, rotation_type)
|
||||
if(!anchored)
|
||||
return TRUE
|
||||
to_chat(user, span_warning("It is fastened to the floor!"))
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/emitter/should_have_node()
|
||||
return welded
|
||||
|
||||
@@ -560,3 +537,13 @@
|
||||
delay = world.time + 10
|
||||
else if (emitter.charge < 10)
|
||||
playsound(src,'sound/machines/buzz-sigh.ogg', 50, TRUE)
|
||||
|
||||
/obj/machinery/power/emitter/ctf
|
||||
name = "Energy Cannon"
|
||||
active = TRUE
|
||||
active_power_usage = 0
|
||||
idle_power_usage = 0
|
||||
locked = TRUE
|
||||
req_access_txt = "100"
|
||||
welded = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
|
||||
/obj/machinery/chem_dispenser/drinks/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE)
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
/obj/machinery/chem_dispenser/drinks/setDir()
|
||||
var/old = dir
|
||||
|
||||
@@ -243,22 +243,23 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/virusfood, 30
|
||||
desc = "A stationary, plumbed, water tank."
|
||||
can_be_tanked = FALSE
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/plumbing/simple_supply)
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/wrench_act(mob/living/user, obj/item/I)
|
||||
..()
|
||||
default_unfasten_wrench(user, I)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/ComponentInitialize()
|
||||
AddComponent(/datum/component/plumbing/simple_supply)
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/storage
|
||||
name = "stationary storage tank"
|
||||
icon_state = "tank_stationary"
|
||||
reagent_id = null //start empty
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/storage/ComponentInitialize()
|
||||
/obj/structure/reagent_dispensers/plumbed/storage/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/storage/update_overlays()
|
||||
. = ..()
|
||||
@@ -272,11 +273,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/virusfood, 30
|
||||
tank_color.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
. += tank_color
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/storage/proc/can_be_rotated(mob/user, rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, span_warning("It is fastened to the floor!"))
|
||||
return !anchored
|
||||
|
||||
/obj/structure/reagent_dispensers/plumbed/fuel
|
||||
name = "stationary fuel tank"
|
||||
icon_state = "fuel_stationary"
|
||||
|
||||
@@ -33,14 +33,15 @@
|
||||
|
||||
pipename = initial(pipe_type.name)
|
||||
|
||||
AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/AfterRotation))
|
||||
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE)
|
||||
|
||||
if(flip)
|
||||
var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation)
|
||||
rotcomp.BaseRot(null,ROTATION_FLIP)
|
||||
rotcomp.Rotate(usr, ROTATION_FLIP) // this only gets used by pipes created by RPDs or pipe dispensers
|
||||
|
||||
update_appearance()
|
||||
|
||||
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE)
|
||||
|
||||
/obj/structure/disposalconstruct/Move()
|
||||
var/old_dir = dir
|
||||
..()
|
||||
@@ -85,12 +86,8 @@
|
||||
dpdir |= turn(dir, 180)
|
||||
return dpdir
|
||||
|
||||
/obj/structure/disposalconstruct/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_FLIP | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated), CALLBACK(src, .proc/after_rot))
|
||||
|
||||
/obj/structure/disposalconstruct/proc/after_rot(mob/user,rotation_type)
|
||||
if(rotation_type == ROTATION_FLIP)
|
||||
/obj/structure/disposalconstruct/proc/AfterRotation(mob/user, degrees)
|
||||
if(degrees == ROTATION_FLIP)
|
||||
var/obj/structure/disposalpipe/temp = pipe_type
|
||||
if(initial(temp.flip_type))
|
||||
if(ISDIAGONALDIR(dir)) // Fix RPD-induced diagonal turning
|
||||
@@ -98,12 +95,6 @@
|
||||
pipe_type = initial(temp.flip_type)
|
||||
update_appearance()
|
||||
|
||||
/obj/structure/disposalconstruct/proc/can_be_rotated(mob/user,rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, span_warning("You must unfasten the pipe before rotating it!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// construction/deconstruction
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
|
||||
@@ -20,10 +20,7 @@
|
||||
make_ridable()
|
||||
wheels_overlay = image(icon, overlay_icon, FLY_LAYER)
|
||||
ADD_TRAIT(src, TRAIT_NO_IMMOBILIZE, INNATE_TRAIT)
|
||||
|
||||
/obj/vehicle/ridden/wheelchair/ComponentInitialize() //Since it's technically a chair I want it to have chair properties
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate),CALLBACK(src, .proc/can_be_rotated),null)
|
||||
AddComponent(/datum/component/simple_rotation) //Since it's technically a chair I want it to have chair properties
|
||||
|
||||
/obj/vehicle/ridden/wheelchair/atom_destruction(damage_flag)
|
||||
new /obj/item/stack/rods(drop_location(), 1)
|
||||
@@ -58,21 +55,6 @@
|
||||
if(has_buckled_mobs())
|
||||
. += wheels_overlay
|
||||
|
||||
|
||||
///used for simple rotation component checks
|
||||
/obj/vehicle/ridden/wheelchair/proc/can_be_rotated(mob/living/user)
|
||||
return TRUE
|
||||
|
||||
///used in simple rotation component checks as to whether a user can rotate this chair
|
||||
/obj/vehicle/ridden/wheelchair/proc/can_user_rotate(mob/living/user)
|
||||
var/mob/living/L = user
|
||||
if(istype(L))
|
||||
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return FALSE
|
||||
if(isobserver(user) && CONFIG_GET(flag/ghost_interaction))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/// I assign the ridable element in this so i don't have to fuss with hand wheelchairs and motor wheelchairs having different subtypes
|
||||
/obj/vehicle/ridden/wheelchair/proc/make_ridable()
|
||||
AddElement(/datum/element/ridable, /datum/component/riding/vehicle/wheelchair/hand)
|
||||
|
||||
Reference in New Issue
Block a user