From 7f77c0ec9163c72d88cc37febef4cbedb4f13ea7 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Mon, 28 May 2012 23:37:43 +0100 Subject: [PATCH] TG: - Standardized var definition for RND and radio code (possibly some other stuff) - Removed all cases (that I saw anyway) of flags being defined by static numbers. Revision: r3663 Author: baloh.matevz --- code/defines/obj.dm | 2 +- code/defines/obj/weapon.dm | 2 +- code/game/objects/effect_system.dm | 2 +- code/game/objects/items/weapons/cameras.dm | 4 +- code/game/objects/radio/electropack.dm | 3 +- code/game/objects/radio/radio.dm | 58 ++++++++-------- code/modules/assembly/assembly.dm | 69 +++++++++++-------- code/modules/assembly/holder.dm | 22 +++--- code/modules/mob/living/blob/blob.dm | 5 +- .../mob/living/silicon/robot/robot_modules.dm | 20 +++--- code/modules/power/antimatter/engine.dm | 2 +- code/modules/research/circuitprinter.dm | 10 +-- code/modules/research/protolathe.dm | 22 +++--- 13 files changed, 117 insertions(+), 104 deletions(-) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 49a7910defb..da9e82092fa 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -515,7 +515,7 @@ density = 0 anchored = 1.0 layer = 2.3 //under pipes - // flags = 64.0 + // flags = CONDUCT /obj/structure/lattice/New() ..() diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 5ca3759a809..dfa013f0325 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -849,7 +849,7 @@ name = "dummy" invisibility = 101.0 anchored = 1.0 - flags = 2.0 + flags = TABLEPASS /obj/item/weapon/extinguisher name = "fire extinguisher" diff --git a/code/game/objects/effect_system.dm b/code/game/objects/effect_system.dm index c661ae8a725..727b4ab103a 100644 --- a/code/game/objects/effect_system.dm +++ b/code/game/objects/effect_system.dm @@ -18,7 +18,7 @@ would spawn and follow the beaker, even if it is carried or thrown. icon = 'effects.dmi' icon_state = "extinguish" var/life = 15.0 - flags = 2.0 + flags = TABLEPASS mouse_opacity = 0 /obj/effect/effect/smoke diff --git a/code/game/objects/items/weapons/cameras.dm b/code/game/objects/items/weapons/cameras.dm index 8acba217c74..0fc1ecb6255 100644 --- a/code/game/objects/items/weapons/cameras.dm +++ b/code/game/objects/items/weapons/cameras.dm @@ -42,7 +42,8 @@ icon_state = "camera" item_state = "electropack" w_class = 2.0 - flags = 466.0 + flags = FPRINT | CONDUCT | USEDELAY | TABLEPASS + slot_flags = SLOT_BELT m_amt = 2000 throwforce = 5 throw_speed = 4 @@ -51,7 +52,6 @@ var/pictures_left = 30 var/can_use = 1 - /obj/item/weapon/photo name = "photo" icon = 'items.dmi' diff --git a/code/game/objects/radio/electropack.dm b/code/game/objects/radio/electropack.dm index 209fbea8b53..dd5462fbff5 100644 --- a/code/game/objects/radio/electropack.dm +++ b/code/game/objects/radio/electropack.dm @@ -8,7 +8,8 @@ m_amt = 10000 frequency = 1449 w_class = 5.0 - flags = 323 + flags = FPRINT | CONDUCT | TABLEPASS + slot_flags = SLOT_BACK item_state = "electropack" /obj/item/device/radio/electropack/examine() diff --git a/code/game/objects/radio/radio.dm b/code/game/objects/radio/radio.dm index e9c27e0a959..fbc50e2c70e 100644 --- a/code/game/objects/radio/radio.dm +++ b/code/game/objects/radio/radio.dm @@ -9,46 +9,44 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use suffix = "\[3\]" icon_state = "walkietalkie" item_state = "walkietalkie" - var - on = 1 // 0 for off - last_transmission - frequency = 1459 //common chat - traitor_frequency = 0 //tune to frequency to unlock traitor supplies - canhear_range = 3 // the range which mobs can hear this radio from - obj/item/device/radio/patch_link = null - obj/item/device/uplink/radio/traitorradio = null - wires = WIRE_SIGNAL | WIRE_RECEIVE | WIRE_TRANSMIT - b_stat = 0 - broadcasting = 0 - listening = 1 - freerange = 0 // 0 - Sanitize frequencies, 1 - Full range - list/channels = list() //see communications.dm for full list. First channes is a "default" for :h - subspace_transmission = 0 + var/on = 1 // 0 for off + var/last_transmission + var/frequency = 1459 //common chat + var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies + var/canhear_range = 3 // the range which mobs can hear this radio from + var/obj/item/device/radio/patch_link = null + var/obj/item/device/uplink/radio/traitorradio = null + var/wires = WIRE_SIGNAL | WIRE_RECEIVE | WIRE_TRANSMIT + var/b_stat = 0 + var/broadcasting = 0 + var/listening = 1 + var/freerange = 0 // 0 - Sanitize frequencies, 1 - Full range + var/list/channels = list() //see communications.dm for full list. First channes is a "default" for :h + var/subspace_transmission = 0 // "Example" = FREQ_LISTENING|FREQ_BROADCASTING - flags = 450 // hello i'm a fucking idiot why is this 450?? CODE GODS PLEASE EXPLAIN~ + flags = FPRINT | CONDUCT | TABLEPASS + slot_flags = SLOT_BELT throw_speed = 2 throw_range = 9 w_class = 2 g_amt = 25 m_amt = 75 - var/const - WIRE_SIGNAL = 1 //sends a signal, like to set off a bomb or electrocute someone - WIRE_RECEIVE = 2 - WIRE_TRANSMIT = 4 - TRANSMISSION_DELAY = 5 // only 2/second/radio - FREQ_LISTENING = 1 + var/const/WIRE_SIGNAL = 1 //sends a signal, like to set off a bomb or electrocute someone + var/const/WIRE_RECEIVE = 2 + var/const/WIRE_TRANSMIT = 4 + var/const/TRANSMISSION_DELAY = 5 // only 2/second/radio + var/const/FREQ_LISTENING = 1 //FREQ_BROADCASTING = 2 /obj/item/device/radio - var - datum/radio_frequency/radio_connection - list/datum/radio_frequency/secure_radio_connections = new - proc - set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) + var/datum/radio_frequency/radio_connection + var/list/datum/radio_frequency/secure_radio_connections = new + + proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 039aac01924..dd1ccda088d 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -46,31 +46,43 @@ throw_range = 10 origin_tech = "magnets=1" - var - secured = 1 - small_icon_state_left = null - small_icon_state_right = null - list/small_icon_state_overlays = null - obj/item/device/assembly_holder/holder = null - cooldown = 0//To prevent spam - wires = WIRE_RECEIVE | WIRE_PULSE + var/secured = 1 + var/small_icon_state_left = null + var/small_icon_state_right = null + var/list/small_icon_state_overlays = null + var/obj/item/device/assembly_holder/holder = null + var/cooldown = 0//To prevent spam + var/wires = WIRE_RECEIVE | WIRE_PULSE - var/const - WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate() - WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder - WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly - WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate() - WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message + var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate() + var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder + var/const/WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly + var/const/WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate() + var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message - proc - activate() //What the device does when turned on - pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs - pulse(var/radio = 0) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct - toggle_secure() //Code that has to happen when the assembly is un\secured goes here - attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another - process_cooldown() //Called via spawn(10) to have it count down the cooldown var - holder_movement() //Called when the holder is moved - interact(mob/user as mob) //Called when attack_self is called + proc/activate() //What the device does when turned on + return + + proc/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs + return + + proc/pulse(var/radio = 0) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct + return + + proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here + return + + proc/attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another + return + + proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var + return + + proc/holder_movement() //Called when the holder is moved + return + + proc/interact(mob/user as mob) //Called when attack_self is called + return process_cooldown() @@ -186,11 +198,10 @@ Desc: If true is an object that can be attached to an assembly holder but is a s /obj/proc/IsSpecialAssembly() return 0 /* - var - small_icon_state = null//If this obj will go inside the assembly use this for icons - list/small_icon_state_overlays = null//Same here - obj/holder = null - cooldown = 0//To prevent spam + var/small_icon_state = null//If this obj will go inside the assembly use this for icons + var/list/small_icon_state_overlays = null//Same here + var/obj/holder = null + var/cooldown = 0//To prevent spam proc Activate()//Called when this assembly is pulsed by another one @@ -222,4 +233,4 @@ Desc: If true is an object that can be attached to an assembly holder but is a s //Remember to have it set its loc somewhere in here -*/ \ No newline at end of file +*/ diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index ac0cb27ad57..f499c3c0875 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -11,16 +11,20 @@ throw_speed = 3 throw_range = 10 - var - secured = 0 - obj/item/device/assembly/a_left = null - obj/item/device/assembly/a_right = null - obj/special_assembly = null + var/secured = 0 + var/obj/item/device/assembly/a_left = null + var/obj/item/device/assembly/a_right = null + var/obj/special_assembly = null + + proc/attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user) + return + + proc/attach_special(var/obj/O, var/mob/user) + return + + proc/process_activation(var/obj/item/device/D) + return - proc - attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user) - attach_special(var/obj/O, var/mob/user) - process_activation(var/obj/item/device/D) IsAssemblyHolder() diff --git a/code/modules/mob/living/blob/blob.dm b/code/modules/mob/living/blob/blob.dm index 7c4cd8eeeca..87963069fe3 100644 --- a/code/modules/mob/living/blob/blob.dm +++ b/code/modules/mob/living/blob/blob.dm @@ -6,9 +6,8 @@ pass_flags = PASSBLOB see_in_dark = 8 see_invisible = 2 - var - ghost_name = "Unknown" - creating_blob = 0 + var/ghost_name = "Unknown" + var/creating_blob = 0 New() diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 2962b346929..039888914d8 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -5,10 +5,10 @@ w_class = 100.0 item_state = "electronic" flags = FPRINT|TABLEPASS | CONDUCT - var - list/modules = list() - obj/item/emag = null - obj/item/borg/upgrade/jetpack = null + + var/list/modules = list() + var/obj/item/emag = null + var/obj/item/borg/upgrade/jetpack = null emp_act(severity) @@ -59,12 +59,12 @@ ..() src.modules += new /obj/item/borg/sight/hud/med(src) src.modules += new /obj/item/device/healthanalyzer(src) - src.modules += new /obj/item/weapon/reagent_containers/borghypo + src.modules += new /obj/item/weapon/reagent_containers/borghypo(src) src.modules += new /obj/item/weapon/reagent_containers/glass/large(src) src.modules += new /obj/item/weapon/reagent_containers/robodropper(src) - src.modules += new /obj/item/weapon/reagent_containers/syringe - src.modules += new /obj/item/weapon/extinguisher/mini - src.emag = new /obj/item/weapon/circular_saw + src.modules += new /obj/item/weapon/reagent_containers/syringe(src) + src.modules += new /obj/item/weapon/extinguisher/mini(src) + src.emag = new /obj/item/weapon/circular_saw(src) return @@ -142,8 +142,8 @@ New() ..() src.modules += new /obj/item/weapon/soap/nanotrasen(src) - src.modules += new /obj/item/weapon/trashbag - src.modules += new/obj/item/weapon/mop + src.modules += new /obj/item/weapon/trashbag(src) + src.modules += new/obj/item/weapon/mop(src) src.emag = new /obj/item/weapon/cleaner(src) var/datum/reagents/R = new/datum/reagents(1000) diff --git a/code/modules/power/antimatter/engine.dm b/code/modules/power/antimatter/engine.dm index ae54faa10ce..824e3fe0e89 100644 --- a/code/modules/power/antimatter/engine.dm +++ b/code/modules/power/antimatter/engine.dm @@ -2,7 +2,7 @@ icon = 'AM_Engine.dmi' density = 1 anchored = 1.0 - flags = 512.0 + flags = ON_BORDER /obj/machinery/power/am_engine/bits name = "Antimatter Engine" diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index f99231a3d35..34da0c1071a 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -8,11 +8,11 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). name = "Circuit Imprinter" icon_state = "circuit_imprinter" flags = OPENCONTAINER - var - g_amount = 0 - gold_amount = 0 - diamond_amount = 0 - max_material_amount = 75000.0 + + var/g_amount = 0 + var/gold_amount = 0 + var/diamond_amount = 0 + var/max_material_amount = 75000.0 New() ..() diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index c4da96269a8..c70a8f25dae 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -11,17 +11,17 @@ Note: Must be placed west/left of and R&D console to function. name = "Protolathe" icon_state = "protolathe" flags = OPENCONTAINER - var - max_material_storage = 100000 //All this could probably be done better with a list but meh. - m_amount = 0.0 - g_amount = 0.0 - gold_amount = 0.0 - silver_amount = 0.0 - plasma_amount = 0.0 - uranium_amount = 0.0 - diamond_amount = 0.0 - clown_amount = 0.0 - adamantine_amount = 0.0 + + var/max_material_storage = 100000 //All this could probably be done better with a list but meh. + var/m_amount = 0.0 + var/g_amount = 0.0 + var/gold_amount = 0.0 + var/silver_amount = 0.0 + var/plasma_amount = 0.0 + var/uranium_amount = 0.0 + var/diamond_amount = 0.0 + var/clown_amount = 0.0 + var/adamantine_amount = 0.0 New()