From 50f282f8b242687b82db6efdbe898740ee351775 Mon Sep 17 00:00:00 2001 From: "mport2004@gmail.com" Date: Wed, 9 Feb 2011 06:07:32 +0000 Subject: [PATCH] Engineering got a new machine that spawns/feeds the singularity. Redid the power use code, should be working better now. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@999 316c924e-a436-60f5-8080-3fe189b3f50e --- code/ATMOSPHERICS/atmospherics.dm | 6 +- code/ATMOSPHERICS/pipes.dm | 1 - code/defines/obj/machinery.dm | 150 +- code/game/gamemodes/events/dust.dm | 3 +- code/game/machinery/alarm.dm | 5 +- code/game/machinery/atmoalter/canister.dm | 2 +- code/game/machinery/blender.dm | 4 +- code/game/machinery/machinery.dm | 8 + code/game/machinery/recharger.dm | 8 +- code/game/machinery/rechargestation.dm | 8 +- code/game/machinery/robot_fabricator.dm | 9 +- code/game/machinery/shieldgen.dm | 2 +- code/game/machinery/singularity.dm | 14 - code/game/machinery/status_display.dm | 3 +- code/game/machinery/turrets.dm | 6 +- code/game/master_controller.dm | 9 +- code/game/mecha/mech_fabricator.dm | 8 +- code/game/objects/items/helper_procs.dm | 52 +- code/modules/power/lighting.dm | 22 +- code/modules/power/singularity/collector.dm | 63 +- .../power/singularity/containment_field.dm | 4 +- code/modules/power/singularity/emitter.dm | 22 +- .../power/singularity/field_generator.dm | 5 +- code/modules/power/singularity/generator.dm | 19 +- .../particle_accelerator/particle.dm | 71 + .../particle_accelerator.dm | 225 + .../particle_accelerator/particle_chamber.dm | 5 + .../particle_accelerator/particle_control.dm | 176 + .../particle_accelerator/particle_emitter.dm | 47 + .../particle_accelerator/particle_power.dm | 7 + code/modules/power/singularity/singularity.dm | 250 +- code/{ => unused}/_debug.dm | 0 code/{game/machinery => unused}/travel.dm | 0 icons/changelog.html | 14 +- icons/effects/160x160.dmi | Bin 466127 -> 466132 bytes icons/effects/224x224.dmi | Bin 0 -> 324594 bytes icons/effects/288x288.dmi | Bin 0 -> 232 bytes icons/effects/96x96.dmi | Bin 187360 -> 264929 bytes icons/obj/machines/particle_accelerator.dmi | Bin 0 -> 3449 bytes icons/obj/singularity.dmi | Bin 17632 -> 26227 bytes maps/tgstation.2.0.1.dmm | 6821 +++++++++-------- tgstation.dme | 8 +- 42 files changed, 4483 insertions(+), 3574 deletions(-) delete mode 100644 code/game/machinery/singularity.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle_accelerator.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle_chamber.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle_control.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle_emitter.dm create mode 100644 code/modules/power/singularity/particle_accelerator/particle_power.dm rename code/{ => unused}/_debug.dm (100%) rename code/{game/machinery => unused}/travel.dm (100%) create mode 100644 icons/effects/224x224.dmi create mode 100644 icons/effects/288x288.dmi create mode 100644 icons/obj/machines/particle_accelerator.dmi diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 429efd6d97..439ca6562c 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -12,10 +12,14 @@ Pipelines + Other Objects -> Pipe network obj/machinery/atmospherics anchored = 1 - power_usage = 10 + use_power = 0 + idle_power_usage = 0 + active_power_usage = 0 power_channel = ENVIRON var/nodealert = 0 + + var/initialize_directions = 0 var/color diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 6ae9e361e1..25d7c16c6a 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -1,5 +1,4 @@ obj/machinery/atmospherics/pipe - power_usage = 0 var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke var/datum/pipeline/parent diff --git a/code/defines/obj/machinery.dm b/code/defines/obj/machinery.dm index 0640f0a0f2..d95a0aa25c 100644 --- a/code/defines/obj/machinery.dm +++ b/code/defines/obj/machinery.dm @@ -3,12 +3,16 @@ icon = 'stationobjs.dmi' var stat = 0 - power_usage = 200 + + use_power = 0 + //0 = dont run the auto + //1 = run auto, use idle + //2 = run auto, use active + idle_power_usage = 0 + active_power_usage = 0 power_channel = EQUIP //EQUIP,ENVIRON or LIGHT - - /obj/machinery/alarm name = "alarm" icon = 'monitors.dmi' @@ -16,7 +20,9 @@ anchored = 1.0 var/skipprocess = 0 //Experimenting var/alarm_frequency = "1437" - power_usage = 5 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 0 /obj/machinery/autolathe name = "Autolathe" @@ -37,7 +43,9 @@ var/hack_wire var/disable_wire var/shock_wire - power_usage = 50 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 100 /obj/machinery/camera name = "Security Camera" @@ -51,7 +59,9 @@ anchored = 1.0 var/invuln = null var/bugged = 0 - power_usage = 5 + use_power = 2 + idle_power_usage = 5 + active_power_usage = 10 /obj/machinery/dispenser @@ -63,7 +73,9 @@ var/o2tanks = 10.0 var/pltanks = 10.0 anchored = 1.0 - power_usage = 10 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 10 /obj/machinery/dna_scanner name = "DNA Scanner/Implanter" @@ -73,7 +85,9 @@ var/locked = 0.0 var/mob/occupant = null anchored = 1.0 - power_usage = 200 + use_power = 1 + idle_power_usage = 50 + active_power_usage = 300 /obj/machinery/dna_scannernew name = "DNA Modifier" @@ -83,7 +97,9 @@ var/locked = 0.0 var/mob/occupant = null anchored = 1.0 - power_usage = 200 + use_power = 1 + idle_power_usage = 50 + active_power_usage = 300 /obj/machinery/firealarm name = "Fire Alarm" @@ -95,7 +111,9 @@ var/timing = 0.0 var/lockdownbyai = 0 anchored = 1.0 - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 6 power_channel = ENVIRON /obj/machinery/partyalarm @@ -108,7 +126,9 @@ var/timing = 0.0 var/lockdownbyai = 0 anchored = 1.0 - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 6 /obj/machinery/hologram_proj @@ -117,6 +137,10 @@ icon_state = "hologram0" var/atom/projection = null anchored = 1.0 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 5 + /obj/machinery/hologram_ai name = "Hologram Projector Platform" @@ -129,6 +153,10 @@ var/h_g = 245.0 var/h_b = 245.0 anchored = 1.0 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 10 + /obj/machinery/igniter name = "igniter" @@ -137,6 +165,9 @@ var/id = null var/on = 1.0 anchored = 1.0 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/injector name = "injector" @@ -145,6 +176,9 @@ density = 1 anchored = 1.0 flags = ON_BORDER + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/mass_driver name = "mass driver" @@ -155,7 +189,9 @@ var/id = 1.0 anchored = 1.0 var/drive_range = 50 //this is mostly irrelevant since current mass drivers throw into space, but you could make a lower-range mass driver for interstation transport or something I guess. - power_usage = 50 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 50 /obj/machinery/meter name = "meter" @@ -165,7 +201,9 @@ anchored = 1.0 var/frequency = 0 var/id - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/nuclearbomb desc = "Uh oh." @@ -183,7 +221,7 @@ var/safety = 1.0 var/obj/item/weapon/disk/nuclear/auth = null flags = FPRINT - power_usage = 0 + use_power = 0 /obj/machinery/optable name = "Operating Table" @@ -191,7 +229,9 @@ icon_state = "table2-idle" density = 1 anchored = 1.0 - power_usage = 40 + use_power = 1 + idle_power_usage = 1 + active_power_usage = 5 var/mob/living/carbon/human/victim = null var/strapped = 0.0 @@ -210,7 +250,7 @@ var/can_rotate = 1 var/can_maximize_speed = 0 var/one_person_only = 0 - power_usage = 0 + use_power = 0 /obj/machinery/vehicle/pod name = "Escape Pod" @@ -236,7 +276,9 @@ var/locked = 0.0 var/mob/occupant = null anchored = 1.0 - power_usage = 600 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 600 /obj/machinery/scan_console name = "DNA Scanner Access Console" @@ -255,7 +297,9 @@ var/temp = null var/obj/machinery/dna_scanner/connected = null anchored = 1.0 - power_usage = 400 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 400 /obj/machinery/scan_consolenew name = "DNA Modifier Access Console" @@ -290,7 +334,9 @@ var/obj/machinery/dna_scanner/connected = null var/obj/item/weapon/disk/data/diskette = null anchored = 1.0 - power_usage = 400 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 400 /obj/machinery/sec_lock name = "Security Pad" @@ -302,7 +348,9 @@ var/obj/machinery/door/d2 = null anchored = 1.0 req_access = list(access_brig) - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/door_control name = "Remote Door Control" @@ -311,7 +359,9 @@ desc = "A remote control switch for a door." var/id = null anchored = 1.0 - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/driver_button name = "Mass Driver Button" @@ -321,7 +371,9 @@ var/id = null var/active = 0 anchored = 1.0 - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/ignition_switch name = "Ignition Switch" @@ -331,12 +383,14 @@ var/id = null var/active = 0 anchored = 1.0 - power_usage = 5 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 4 /obj/machinery/shuttle name = "shuttle" icon = 'shuttle.dmi' - power_usage = 0 + use_power = 0 /obj/machinery/shuttle/engine name = "engine" @@ -382,19 +436,25 @@ name = "hub" icon_state = "tele0" var/accurate = 0 - power_usage = 100 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 2000 /obj/machinery/teleport/station name = "station" icon_state = "controller" var/active = 0 var/engaged = 0 - power_usage = 100 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 2000 /obj/machinery/wire name = "wire" icon = 'power_cond.dmi' - power_usage = 1 + use_power = 1 + idle_power_usage = 0 + active_power_usage = 1 /obj/machinery/power name = null @@ -404,7 +464,9 @@ var/netnum = 0 var/directwired = 1 // by default, power machines are connected by a cable in a neighbouring turf // if set to 0, requires a 0-X cable on this turf - power_usage = 0 + use_power = 0 + idle_power_usage = 0 + active_power_usage = 0 /obj/machinery/power/terminal name = "terminal" @@ -447,7 +509,9 @@ icon_state = "power" density = 1 anchored = 1 - power_usage = 600 + use_power = 2 + idle_power_usage = 20 + active_power_usage = 80 /obj/machinery/power/solar name = "solar panel" @@ -465,7 +529,9 @@ var/ndir = SOUTH var/turn_angle = 0 var/obj/machinery/power/solar_control/control - power_usage = 0 + use_power = 0 + idle_power_usage = 0 + active_power_usage = 0 /obj/machinery/power/solar_control name = "solar panel control" @@ -483,7 +549,9 @@ var/trackrate = 600 // 300-900 seconds var/trackdir = 1 // 0 =CCW, 1=CW var/nexttime = 0 - power_usage = 500 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 20 /obj/machinery/cell_charger @@ -494,7 +562,9 @@ var/obj/item/weapon/cell/charging = null var/chargelevel = -1 anchored = 1 - power_usage = 50 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 60 /obj/machinery/light_switch desc = "A light switch" @@ -525,7 +595,9 @@ icon_state = "mw" density = 1 anchored = 1 - power_usage = 100 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 100 var/egg_amount = 0 //Current number of eggs inside var/flour_amount = 0 //Current amount of flour inside var/water_amount = 0 //Current amount of water inside @@ -564,7 +636,9 @@ anchored = 1 var/broken = 0 var/processing = 0 - power_usage = 50 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 50 /obj/machinery/gibber @@ -578,7 +652,9 @@ var/dirty = 0 // Does it need cleaning? var/gibtime = 40 // Time from starting until meat appears var/mob/occupant // Mob who has been put inside - power_usage = 50 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 50 /obj/machinery/holopad name = "holopad" @@ -587,4 +663,6 @@ anchored = 1 var/state = "off" var/slave_holo = null - power_usage = 50 \ No newline at end of file + use_power = 1 + idle_power_usage = 5 + active_power_usage = 100 \ No newline at end of file diff --git a/code/game/gamemodes/events/dust.dm b/code/game/gamemodes/events/dust.dm index a4b5658fb1..f5fd69a763 100644 --- a/code/game/gamemodes/events/dust.dm +++ b/code/game/gamemodes/events/dust.dm @@ -102,7 +102,8 @@ The "dust" will damage the hull of the station causin minor hull breaches. A.ex_act(strength) life-- if(life <= 0) - spawn(0) + walk(src,0) + spawn(1) del(src) return 0 return diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index d4759ce66c..a93746d48c 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1,6 +1,7 @@ /obj/machinery/alarm - - power_usage = 5 + use_power = 1 + idle_power_usage = 4 + active_power_usage = 8 power_channel = ENVIRON var/frequency = 1439 var/list/sensors = list() diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 94e65bbe06..4564884554 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -15,7 +15,7 @@ pressure_resistance = 7*ONE_ATMOSPHERE var/temperature_resistance = 1000 + T0C volume = 1000 - power_usage = 0 + use_power = 0 /obj/machinery/portable_atmospherics/canister/sleeping_agent name = "Canister: \[N2O\]" diff --git a/code/game/machinery/blender.dm b/code/game/machinery/blender.dm index e6d7cbae4f..f248667013 100644 --- a/code/game/machinery/blender.dm +++ b/code/game/machinery/blender.dm @@ -16,7 +16,9 @@ the blender or the processor: Processor items are solid objects and Blender resu icon_state = "blender_e" density = 1 anchored = 1 - power_usage = 20 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 50 flags = OPENCONTAINER //So that you can pour stuff into it. var/processing = 0 //This turns on (1) while it is processing so you don't accidentally get multiples from the same item. var/container = 1 //Is there a jug attached? Could have been done with a for loop but it's less code this way. diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index a592406f9c..5ac3c7a18b 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -29,6 +29,14 @@ if(prob(50)) del(src) +/obj/machinery/proc/auto_use_power() + if(!powered(power_channel)) + return 0 + if(src.use_power == 1) + use_power(idle_power_usage,power_channel) + else if(src.use_power >= 2) + use_power(active_power_usage,power_channel) + return 1 /obj/machinery/Topic(href, href_list) ..() diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 1f42c637a5..be6b05968b 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -3,7 +3,9 @@ obj/machinery/recharger icon = 'stationobjs.dmi' icon_state = "recharger0" name = "recharger" - power_usage = 50 + use_power = 1 + idle_power_usage = 4 + active_power_usage = 250 var obj/item/weapon/gun/energy/charging = null @@ -16,10 +18,12 @@ obj/machinery/recharger user.drop_item() G.loc = src src.charging = G + use_power = 2 if (istype(G, /obj/item/weapon/baton)) user.drop_item() G.loc = src src.charging2 = G + use_power = 2 /obj/machinery/recharger/attack_hand(mob/user as mob) src.add_fingerprint(user) @@ -27,10 +31,12 @@ obj/machinery/recharger src.charging.update_icon() src.charging.loc = src.loc src.charging = null + use_power = 1 if(src.charging2) src.charging2.update_icon() src.charging2.loc = src.loc src.charging2 = null + use_power = 1 /obj/machinery/recharger/attack_paw(mob/user as mob) diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 53300b433e..56755ddfcc 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -4,7 +4,9 @@ icon_state = "pod_0" density = 1 anchored = 1.0 - power_usage = 80 + use_power = 1 + idle_power_usage = 5 + active_power_usage = 1000 var/mob/occupant = null @@ -55,7 +57,6 @@ return else R.cell.charge += 50 - use_power(50) return @@ -67,7 +68,6 @@ return else H.energy += 50 - use_power(50) return go_out() @@ -81,6 +81,7 @@ src.occupant.loc = src.loc src.occupant = null build_icon() + src.use_power = 1 return restock_modules() @@ -136,6 +137,7 @@ O.loc = src.loc*/ src.add_fingerprint(usr) build_icon() + src.use_power = 2 return diff --git a/code/game/machinery/robot_fabricator.dm b/code/game/machinery/robot_fabricator.dm index 7dc19291ea..64cb3b3cab 100644 --- a/code/game/machinery/robot_fabricator.dm +++ b/code/game/machinery/robot_fabricator.dm @@ -7,7 +7,9 @@ var/metal_amount = 0 var/operating = 0 var/obj/item/robot_parts/being_built = null - power_usage = 1000 + use_power = 1 + idle_power_usage = 20 + active_power_usage = 5000 /obj/machinery/robotic_fabricator/attackby(var/obj/item/O as obj, var/mob/user as mob) if (istype(O, /obj/item/stack/sheet/metal)) @@ -126,6 +128,7 @@ Please wait until completion...
if (!isnull(building)) if (src.metal_amount >= build_cost) src.operating = 1 + src.use_power = 2 src.metal_amount = max(0, src.metal_amount - build_cost) @@ -134,13 +137,11 @@ Please wait until completion...
src.icon_state = "fab-active" src.updateUsrDialog() - use_power(5000) - spawn (build_time) if (!isnull(src.being_built)) src.being_built.loc = get_turf(src) src.being_built = null - + src.use_power = 1 src.operating = 0 src.icon_state = "fab-idle" return diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index f0e627f8fa..4e5881c4ce 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -34,7 +34,7 @@ var/obj/cable/attached // the attached cable var/storedpower = 0 flags = FPRINT | CONDUCT - power_usage = 500 + use_power = 0 /obj/machinery/shield name = "shield" diff --git a/code/game/machinery/singularity.dm b/code/game/machinery/singularity.dm deleted file mode 100644 index 4921fee4ba..0000000000 --- a/code/game/machinery/singularity.dm +++ /dev/null @@ -1,14 +0,0 @@ -/*//////////////////////////////////////////////// -The Singularity Engine -By Mport -tbh this could likely be better and I did not use all that many comments on it. -However people seem to like it for some reason. -*///////////////////////////////////////////////// - -#define collector_control_range 12 - - -/////EMITTER -//////////////ARRAY - - diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index cdc59c7e67..31941f03ed 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -11,7 +11,8 @@ name = "status display" anchored = 1 density = 1 - power_usage = 250 + use_power = 1 + idle_power_usage = 10 var/mode = 1 // 0 = Blank // 1 = Shuttle timer // 2 = Arbitrary message(s) diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index 5f00a96fe9..3fd4e5a2b3 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -63,7 +63,9 @@ var/wasvalid = 0 var/lastfired = 0 var/shot_delay = 30 //3 seconds between shots - power_usage = 100 + use_power = 1 + idle_power_usage = 50 + active_power_usage = 300 /obj/machinery/turretcover name = "pop-up turret cover" @@ -125,12 +127,14 @@ if (!isPopping()) if (isDown()) popUp() + use_power = 2 else targetting() else if (!isPopping()) if (!isDown()) popDown() + use_power = 1 else if (src.wasvalid) src.die() diff --git a/code/game/master_controller.dm b/code/game/master_controller.dm index cf60b8e45e..e85378a1ed 100644 --- a/code/game/master_controller.dm +++ b/code/game/master_controller.dm @@ -84,10 +84,11 @@ datum/controller/game_controller D.process() for(var/obj/machinery/machine in machines) - machine.process() - if(machine)//Testing this for now, might change it up later - Mport - if(machine.power_usage && machine.power_channel) - machine.use_power(machine.power_usage,machine.power_channel) + if(machine) + machine.process() + if(machine && machine.use_power) + machine.auto_use_power() + sleep(-1) sleep(1) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 0690ed8966..8d84df8f67 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -10,7 +10,9 @@ density = 1 anchored = 1 layer=2 - power_usage = 100 + use_power = 1 + idle_power_usage = 20 + active_power_usage = 5000 var/list/resources = list( "metal"=20000, "glass"=20000, @@ -135,11 +137,11 @@ src.being_built = new path(src) src.remove_resources(part) src.icon_state = "fabricator_ani" - src.power_usage = 2000 + src.use_power = 2 spawn(time) + src.use_power = 1 src.being_built.Move(get_step(src,EAST)) src.icon_state = initial(src.icon_state) - src.power_usage = initial(src.power_usage) src.visible_message("[src] beeps, \"The [src.being_built] is complete\".") src.being_built = null src.updateUsrDialog() diff --git a/code/game/objects/items/helper_procs.dm b/code/game/objects/items/helper_procs.dm index 3c39c5f135..eddfee0b94 100644 --- a/code/game/objects/items/helper_procs.dm +++ b/code/game/objects/items/helper_procs.dm @@ -72,10 +72,60 @@ mo.show_message(rendered, 2) return -/proc/is_type_in_list(var/list/L, var/atom/A) +/proc/is_type_in_list(var/atom/A, var/list/L) for(var/type in L) if(isnull(type)) continue if(istype(A, type)) return 1 + return 0 + +//Quick type checks for some tools +var/global/list/common_tools = list( +/obj/item/weapon/cable_coil, +/obj/item/weapon/wrench, +/obj/item/weapon/weldingtool, +/obj/item/weapon/screwdriver, +/obj/item/weapon/wirecutters, +/obj/item/device/multitool, +/obj/item/weapon/crowbar) + +/proc/istool(O) + if(O && is_type_in_list(O, common_tools)) + return 1 + return 0 + +/proc/iswrench(O) + if(O && istype(O, /obj/item/weapon/wrench)) + return 1 + return 0 + +/proc/iswelder(O) + if(O && istype(O, /obj/item/weapon/weldingtool)) + return 1 + return 0 + +/proc/iscoil(O) + if(O && istype(O, /obj/item/weapon/cable_coil)) + return 1 + return 0 + +/proc/iswirecutter(O) + if(O && istype(O, /obj/item/weapon/wirecutters)) + return 1 + return 0 + +/proc/isscrewdriver(O) + if(O && istype(O, /obj/item/weapon/screwdriver)) + return 1 + return 0 + +/proc/ismultitool(O) + if(O && istype(O, /obj/item/device/multitool)) + return 1 + return 0 + +/proc/iscrowbar(O) + if(O && istype(O, /obj/item/weapon/crowbar)) + return 1 return 0 \ No newline at end of file diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 7016c6878d..14f4ab78f2 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -19,7 +19,9 @@ desc = "A lighting fixture." anchored = 1 layer = 5 // They were appearing under mobs which is a little weird - Ostaf - power_usage = 0 + use_power = 2 + idle_power_usage = 2 + active_power_usage = 20 power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list var/on = 0 // 1 if on, 0 if off var/on_gs = 0 @@ -44,6 +46,12 @@ light_type = /obj/item/weapon/light/bulb +/obj/machinery/light/spot + name = "spotlight" + fitting = "large tube" + light_type = /obj/item/weapon/light/tube/large + brightness = 15 + // the desk lamp /obj/machinery/light/lamp name = "desk lamp" @@ -53,7 +61,6 @@ brightness = 5 desc = "A desk lamp" light_type = /obj/item/weapon/light/bulb - var/switchon = 0 // independent switching for lamps - not controlled by area lightswitch // green-shaded desk lamp @@ -98,7 +105,10 @@ if(LIGHT_BROKEN) icon_state = "[base_state]-broken" on = 0 - + if(!on) + use_power = 1 + else + use_power = 2 var/oldlum = luminosity //luminosity = on * brightness @@ -117,7 +127,7 @@ icon_state = "[base_state]-burned" on = 0 sd_SetLuminosity(0) - power_usage = (luminosity * 20) + active_power_usage = (luminosity * 20) if(on != on_gs) on_gs = on // var/area/A = get_area(src) @@ -436,6 +446,10 @@ g_amt = 200 brightness = 8 + large + name = "large light tube" + brightness = 15 + /obj/item/weapon/light/bulb name = "light bulb" desc = "A replacement light bulb." diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 3265635359..0a4af5ba3f 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -3,13 +3,16 @@ name = "Radiation Collector Array" desc = "A device which uses Hawking Radiation and plasma to produce power." icon = 'singularity.dmi' - icon_state = "collector" + icon_state = "ca" anchored = 1 density = 1 directwired = 1 +// use_power = 0 var obj/item/weapon/tank/plasma/P = null last_power = 0 + active = 0 + locked = 0 process() if(P) @@ -21,18 +24,32 @@ return + attack_hand(mob/user as mob) + if(anchored) + if(!src.locked || istype(user, /mob/living/silicon)) + toggle_power() + user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \ + "You turn the [src.name] [active? "on":"off"].") + return + else + if(src.locked) + user << "\red The controls are locked." + return + ..() + + attackby(obj/item/W, mob/user) if(istype(W, /obj/item/device/analyzer)) user << "\blue The [W.name] detects that [last_power]W were recently produced." return 1 - if(istype(W, /obj/item/weapon/tank/plasma)) + else if(istype(W, /obj/item/weapon/tank/plasma)) if(!src.anchored) user << "The [src] needs to be secured to the floor first." return 1 if(src.P) user << "\red There appears to already be a plasma tank loaded!" return 1 - icon_state = "collector +p" + updateicon() src.P = W W.loc = src if (user.client) @@ -55,6 +72,13 @@ connect_to_network() else disconnect_from_network() + else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) + if (src.allowed(user)) + src.locked = !src.locked + user << "Controls are now [src.locked ? "locked." : "unlocked."]" + else + user << "\red Access denied." + return 1 else ..() return 1 @@ -75,13 +99,40 @@ Z.loc = get_turf(src) Z.layer = initial(Z.layer) src.P = null - icon_state = "collector" + if(active) + toggle_power() + else + updateicon() receive_pulse(var/pulse_strength) - if(P) + if(P && active) var/power_produced = 0 power_produced = P.air_contents.toxins*pulse_strength*20 add_avail(power_produced) last_power = power_produced return - return \ No newline at end of file + return + + + updateicon() + overlays = null + if(P) + overlays += image('singularity.dmi', "ptank") + if(stat & (NOPOWER|BROKEN)) + return + if(active) + overlays += image('singularity.dmi', "on") + + + toggle_power() + active = !active + if(active) + icon_state = "ca_on" + flick("ca_active", src) + + else + icon_state = "ca" + flick("ca_deactive", src) + updateicon() + return + diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index c1737d906d..ef963b3b2c 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -1,4 +1,3 @@ - /obj/machinery/containment_field name = "Containment Field" desc = "An energy field." @@ -7,7 +6,8 @@ anchored = 1 density = 0 unacidable = 1 - power_usage = 0 + use_power = 0 + New() spawn(1) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 4865a54b16..1ace7d7b49 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -12,7 +12,9 @@ var/shot_number = 0 var/state = 0 var/locked = 0 - power_usage = 0 + use_power = 1 + idle_power_usage = 10 + active_power_usage = 300 /obj/machinery/emitter/New() @@ -34,13 +36,13 @@ if(src.active==1) src.active = 0 user << "You turn off the [src]." - src.power_usage = 0 + src.use_power = 1 else src.active = 1 user << "You turn on the [src]." src.shot_number = 0 src.fire_delay = 100 - src.power_usage = 100 + src.use_power = 2 update_icon() else user << "The controls are locked!" @@ -53,7 +55,7 @@ if(prob(1)&&prob(1)) if(src.active) src.active = 0 - src.power_usage = 0 + src.use_power = 1 return 1 @@ -109,11 +111,10 @@ /obj/machinery/emitter/attackby(obj/item/W, mob/user) - if(active) - user << "Turn off the [src] first." - return - - else if(istype(W, /obj/item/weapon/wrench)) + if(istype(W, /obj/item/weapon/wrench)) + if(active) + user << "Turn off the [src] first." + return switch(state) if(0) state = 1 @@ -134,6 +135,9 @@ return else if(istype(W, /obj/item/weapon/weldingtool)) + if(active) + user << "Turn off the [src] first." + return switch(state) if(0) user << "\red The [src.name] needs to be wrenched to the floor." diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 96feacd4b3..da4b161612 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -8,7 +8,7 @@ anchored = 0 density = 1 req_access = list(access_engine) - power_usage = 0 + use_power = 0 var Varedit_start = 0 Varpower = 0 @@ -58,7 +58,6 @@ Varedit_start = 0 if(src.active == 2) calc_power() - return @@ -144,7 +143,7 @@ else if (flag == PROJECTILE_WEAKBULLET) src.power -= 25 else if (flag == PROJECTILE_LASER) - src.power += 10 + src.power += 20 else if (flag == PROJECTILE_TASER) src.power += 5 else diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm index b51ef56501..5b2bfe213b 100644 --- a/code/modules/power/singularity/generator.dm +++ b/code/modules/power/singularity/generator.dm @@ -7,17 +7,33 @@ icon_state = "TheSingGen" anchored = 1 density = 1 - power_usage = 0 + use_power = 0 + var + energy = 0 //////////////////////Singularity gen START /obj/machinery/the_singularitygen/process() var/turf/T = get_turf(src) + if(src.energy >= 200) + new /obj/machinery/singularity/(T, 50) + spawn(0) + del(src) + return +/* if (singularity_is_surrounded(T)) new /obj/machinery/singularity/(T, 200) spawn(0) del(src) return +*/ + +///obj/machinery/the_singularitygen/Bumped(atom/A) +// if(istype(A,/obj/accelerated_particle)) +// src.energy += A:energy +// return +// ..() + /obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/weapon/wrench)) @@ -34,6 +50,7 @@ return return ..() + /proc/singularity_is_surrounded(turf/T)//TODO:Add a timer so we dont need this var/checkpointC = 0 for (var/obj/X in orange(4,T)) //TODO: do we need requirement to singularity be actually _surrounded_ by field? diff --git a/code/modules/power/singularity/particle_accelerator/particle.dm b/code/modules/power/singularity/particle_accelerator/particle.dm new file mode 100644 index 0000000000..2c95e28036 --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle.dm @@ -0,0 +1,71 @@ +/obj/accelerated_particle + name = "Accelerated Particles" + desc = "Small things moving very fast." + icon = 'particle_accelerator.dmi' + icon_state = "particle"//Need a new icon for this + anchored = 0 + density = 1 + var + movement_range = 10 + energy = 5 + + weak + movement_range = 8 + energy = 10 + + strong + movement_range = 15 + energy = 15 + + + New(loc, dir = 2) + src.loc = loc + src.dir = dir + if(movement_range > 20) + movement_range = 20 + spawn(0) + move(1) + return + + + Bump(atom/A) + if (A) + if(ismob(A)) + toxmob(A) + if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/machinery/singularity/))) + A:energy += energy + return + + + Bumped(atom/A) + if(ismob(A)) + Bump(A) + return + + + ex_act(severity) + del(src) + return + + + proc + toxmob(var/mob/M) + var/radiation = (energy*2) + if(istype(M,/mob/living/carbon/human)) + if(M:wear_suit) //TODO: check for radiation protection + radiation = round(radiation/2,1) + M.radiation += radiation + M.updatehealth() + //M << "\red You feel odd." + return + + + move(var/lag) + if(!step(src,dir)) + src.loc = get_step(src,dir) + movement_range-- + if(movement_range <= 0) + del(src) + else + sleep(lag) + move(lag) \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm new file mode 100644 index 0000000000..942b73857b --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -0,0 +1,225 @@ +/*Composed of 7 parts +3 Particle emitters +proc +emit_particle() + +1 power box +the only part of this thing that uses power, can hack to mess with the pa/make it better + +1 fuel chamber +contains procs for mixing gas and whatever other fuel it uses +mix_gas() + +1 gas holder WIP +acts like a tank valve on the ground that you wrench gas tanks onto +proc +extract_gas() +return_gas() +attach_tank() +remove_tank() +get_available_mix() + +1 End Cap + +1 Control computer +interface for the pa, acts like a computer with an html menu for diff parts and a status report +all other parts contain only a ref to this +a /machine/, tells the others to do work +contains ref for all parts +proc +process() +check_build() + +Setup map + |EC| +CC|FC| + |PB| +PE|PE|PE + + +*/ + +/obj/particle_accelerator + name = "Particle Accelerator" + desc = "Part of a Particle Accelerator." + icon = 'particle_accelerator.dmi' + icon_state = "none" + anchored = 0 + density = 1 + var + obj/machinery/particle_accelerator/control_box/master = null + construction_state = 0 + + end_cap + icon_state = "end_cap" + + + attackby(obj/item/W, mob/user) + if(istool(W)) + if(src.process_tool_hit(W,user)) + return + ..() + return + + + proc + update_state() + if(master) + master.update_state() + return 0 + + + report_ready(var/obj/O) + if(O && (O == master)) + if(construction_state >= 3) + return 1 + return 0 + + + report_master() + if(master) + return master + return 0 + + + connect_master(var/obj/O) + if(O && istype(O,/obj/machinery/particle_accelerator/control_box)) + if(O.dir == src.dir) + master = O + return 1 + return 0 + + + process_tool_hit(var/obj/O, var/mob/user) + if(!(O) || !(user)) + return 0 + if(!ismob(user) || !isobj(O)) + return 0 + var/temp_state = src.construction_state + + switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps + if(0) + if(iswrench(O)) + playsound(src.loc, 'Ratchet.ogg', 75, 1) + src.anchored = 1 + user.visible_message("[user.name] secures the [src.name] to the floor.", \ + "You secure the external bolts.") + temp_state++ + if(1) + if(iswrench(O)) + playsound(src.loc, 'Ratchet.ogg', 75, 1) + src.anchored = 0 + user.visible_message("[user.name] detaches the [src.name] from the floor.", \ + "You remove the external bolts.") + temp_state-- + else if(iscoil(O)) + if(O:use(1,user)) + user.visible_message("[user.name] adds wires to the [src.name].", \ + "You add some wires.") + temp_state++ + if(2) + if(iswirecutter(O))//TODO:Shock user if its on? + user.visible_message("[user.name] removes some wires from the [src.name].", \ + "You remove some wires.") + temp_state-- + else if(isscrewdriver(O)) + user.visible_message("[user.name] closes the [src.name]'s access panel.", \ + "You close the access panel.") + temp_state++ + if(3) + if(isscrewdriver(O)) + user.visible_message("[user.name] opens the [src.name]'s access panel.", \ + "You open the access panel.") + temp_state-- + if(temp_state == src.construction_state)//Nothing changed + return 0 + else + if(src.construction_state >= 3)//Was taken apart, update state + update_state() + src.construction_state = temp_state + update_icon() + return 1 + return 0 + + +/obj/machinery/particle_accelerator/ + name = "Particle Accelerator" + desc = "Part of a Particle Accelerator." + icon = 'particle_accelerator.dmi' + icon_state = "none" + anchored = 0 + density = 1 + use_power = 0 + idle_power_usage = 0 + active_power_usage = 0 + var + construction_state = 0 + active = 0 + + + attackby(obj/item/W, mob/user) + if(istool(W)) + if(src.process_tool_hit(W,user)) + return + ..() + return + + + proc + update_state() + return 0 + + + process_tool_hit(var/obj/O, var/mob/user) + if(!(O) || !(user)) + return 0 + if(!ismob(user) || !isobj(O)) + return 0 + var/temp_state = src.construction_state + switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps + if(0) + if(iswrench(O)) + playsound(src.loc, 'Ratchet.ogg', 75, 1) + src.anchored = 1 + user.visible_message("[user.name] secures the [src.name] to the floor.", \ + "You secure the external bolts.") + temp_state++ + if(1) + if(iswrench(O)) + playsound(src.loc, 'Ratchet.ogg', 75, 1) + src.anchored = 0 + user.visible_message("[user.name] detaches the [src.name] from the floor.", \ + "You remove the external bolts.") + temp_state-- + else if(iscoil(O)) + if(O:use(1)) + user.visible_message("[user.name] adds wires to the [src.name].", \ + "You add some wires.") + temp_state++ + if(2) + if(iswirecutter(O))//TODO:Shock user if its on? + user.visible_message("[user.name] removes some wires from the [src.name].", \ + "You remove some wires.") + temp_state-- + else if(isscrewdriver(O)) + user.visible_message("[user.name] closes the [src.name]'s access panel.", \ + "You close the access panel.") + temp_state++ + if(3) + if(isscrewdriver(O)) + user.visible_message("[user.name] opens the [src.name]'s access panel.", \ + "You open the access panel.") + temp_state-- + if(temp_state == src.construction_state)//Nothing changed + return 0 + else + if(src.construction_state >= 3)//Was taken apart, update state + update_state() + if(use_power) + use_power = 0 + src.construction_state = temp_state + if(src.construction_state >= 3) + use_power = 1 + update_icon() + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_chamber.dm b/code/modules/power/singularity/particle_accelerator/particle_chamber.dm new file mode 100644 index 0000000000..dec686f7b7 --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle_chamber.dm @@ -0,0 +1,5 @@ +/obj/particle_accelerator/fuel_chamber + name = "Particle Accelerator Emitter" + desc = "Part of a Particle Accelerator, might not want to stand near this end." + icon = 'particle_accelerator.dmi' + icon_state = "fuel_chamber" \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm new file mode 100644 index 0000000000..4d5dbe1026 --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -0,0 +1,176 @@ +/obj/machinery/particle_accelerator/control_box + name = "Particle Accelerator Control Box" + desc = "Part of a Particle Accelerator." + icon = 'particle_accelerator.dmi' + icon_state = "control_box" + anchored = 0 + density = 1 + use_power = 0 + idle_power_usage = 500 + active_power_usage = 10000 + construction_state = 0 + active = 0 + var + list/obj/particle_accelerator/connected_parts + assembled = 0 + strength = 0 + + + New() + connected_parts = list() + ..() + + + attack_hand(mob/user as mob) + if(construction_state >= 3) + interact(user) + + + update_state() + if(construction_state < 3) + use_power = 0 + assembled = 0 + active = 0 + connected_parts = list() + return + if(!part_scan()) + assembled = 0 + return + + + Topic(href, href_list) + ..() + if( href_list["close"] ) + usr << browse(null, "window=pacontrol") + usr.machine = null + return + if(href_list["togglep"]) + src.toggle_power() + if(href_list["scan"]) + src.part_scan() + if(href_list["strengthup"]) + src.strength++ + if(src.strength > 2) + src.strength = 2 + if(href_list["strengthdown"]) + src.strength-- + if(src.strength < 0) + src.strength = 0 + src.updateDialog() + + + process() + if(src.active) + for(var/obj/particle_accelerator/particle_emitter/PE in connected_parts) + if(PE) + PE.emit_particle(src.strength) +// for(var/obj/particle_accelerator/fuel_chamber/PF in connected_parts) +// PF.doshit() +// for(var/obj/particle_accelerator/power_box/PB in connected_parts) +// PB.doshit() + //finish up putting the fuel run and power use things in here + return + + + proc + part_scan() + connected_parts = list() + var/tally = 0 + var/ldir = 0 + var/rdir = 0 + var/odir = 0 + switch(src.dir) + if(1) + ldir = 4 + rdir = 8 + odir = 2 + if(2) + ldir = 8 + rdir = 4 + odir = 1 + if(4) + ldir = 1 + rdir = 2 + odir = 8 + if(8) + ldir = 2 + rdir = 1 + odir = 4 + var/turf/T = src.loc + T = get_step(T,rdir) + if(check_part(T,/obj/particle_accelerator/fuel_chamber)) + tally++ + T = get_step(T,odir) + if(check_part(T,/obj/particle_accelerator/end_cap)) + tally++ + T = get_step(T,dir) + T = get_step(T,dir) + if(check_part(T,/obj/particle_accelerator/power_box)) + tally++ + T = get_step(T,dir) + if(check_part(T,/obj/particle_accelerator/particle_emitter/center)) + tally++ + T = get_step(T,ldir) + if(check_part(T,/obj/particle_accelerator/particle_emitter/left)) + tally++ + T = get_step(T,rdir) + T = get_step(T,rdir) + if(check_part(T,/obj/particle_accelerator/particle_emitter/right)) + tally++ + if(tally >= 6) + assembled = 1 + return 1 + else + assembled = 0 + return 0 + + + check_part(var/turf/T, var/type) + if(!(T)||!(type)) + return 0 + var/obj/particle_accelerator/PA = locate(/obj/particle_accelerator) in T + if(istype(PA, type)) + if(PA.connect_master(src)) + if(PA.report_ready(src)) + src.connected_parts.Add(PA) + return 1 + return 0 + + + toggle_power() + src.active = !src.active + if(src.active) + src.use_power = 2 + else + src.use_power = 1 + return 1 + + + interact(mob/user) + if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) ) + if (!istype(user, /mob/living/silicon)) + user.machine = null + user << browse(null, "window=pacontrol") + return + user.machine = src + + var/dat = "" + dat += "Particle Accelerator Control Panel
" + dat += "Close

" + dat += "Status:
" + if(!assembled) + dat += "Unable to detect all parts!
" + dat += "Run Scan

" + else + dat += "All parts in place.

" + dat += "Power:" + if(active) + dat += "On
" + else + dat += "Off
" + dat += "Toggle Power

" + dat += "Particle Strength: [src.strength]" + dat += "--|++

" + + user << browse(dat, "window=pacontrol;size=420x500") + onclose(user, "pacontrol") diff --git a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm new file mode 100644 index 0000000000..b00587c43a --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm @@ -0,0 +1,47 @@ +/obj/particle_accelerator/particle_emitter + name = "Particle Accelerator Emitter" + desc = "Part of a Particle Accelerator, might not want to stand near this end." + icon = 'particle_accelerator.dmi' + icon_state = "none" + var + fire_delay = 50 + last_shot = 0 + + center + icon_state = "emitter_center" + + left + icon_state = "emitter_left" + + right + icon_state = "emitter_right" + + + update_icon() + return//Add overlays here + + + proc + set_delay(var/delay) + if(delay && delay >= 0) + src.fire_delay = delay + return 1 + return 0 + + + emit_particle(var/strength = 0) + if((src.last_shot + src.fire_delay) <= world.time) + src.last_shot = world.time + var/obj/accelerated_particle/A = null + var/turf/T = get_step(src,dir) + switch(strength) + if(0) + A = new/obj/accelerated_particle/weak(T, dir) + if(1) + A = new/obj/accelerated_particle(T, dir) + if(2) + A = new/obj/accelerated_particle/strong(T, dir) + if(A) + A.dir = src.dir + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_power.dm b/code/modules/power/singularity/particle_accelerator/particle_power.dm new file mode 100644 index 0000000000..f896739334 --- /dev/null +++ b/code/modules/power/singularity/particle_accelerator/particle_power.dm @@ -0,0 +1,7 @@ +/obj/particle_accelerator/power_box + name = "Particle Accelerator" + desc = "Part of a Particle Accelerator, this part seems to have a maintenance panel on it." + icon = 'particle_accelerator.dmi' + icon_state = "power_box" + anchored = 0 + density = 1 diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index a1ab4eba25..8a17aa1076 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -6,30 +6,30 @@ var/global/list/uneatable = list( /obj/machinery/singularity/ name = "Gravitational Singularity" desc = "A Gravitational Singularity." - icon = '160x160.dmi' - icon_state = "Singularity" + icon = 'singularity.dmi' + icon_state = "singularity_s1" anchored = 1 density = 1 layer = 6 unacidable = 1 //Don't comment this out. - power_usage = 0 + use_power = 0 var -// active = 0 + current_size = 1 + allowed_size = 1 contained = 1 //Are we going to move around? energy = 100 //How strong are we? - dissipate = 0 //Do we lose energy over time? TODO:Set this to 1 when/if the feederthing is finished - dissipate_delay = 5 + dissipate = 1 //Do we lose energy over time? + dissipate_delay = 10 dissipate_track = 0 - dissipate_strength = 10 //How much energy do we lose? + dissipate_strength = 1 //How much energy do we lose? move_self = 1 //Do we move on our own? - grav_pull = 6 //How many tiles out do we pull? + grav_pull = 4 //How many tiles out do we pull? + consume_range = 0 //How many tiles out do we eat event_chance = 15 //Prob for event each tick - New(loc, var/starting_energy = 200, var/temp = 0) + New(loc, var/starting_energy = 50, var/temp = 0) src.energy = starting_energy - pixel_x = -64 - pixel_y = -64 if(temp) spawn(temp) del(src) @@ -79,10 +79,13 @@ var/global/list/uneatable = list( eat() dissipate() check_energy() - move() - if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit - event() - pulse() + if(current_size >= 3) + move() + if(current_size <= 7) + pulse() + if(current_size >= 5) + if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit + event() return proc @@ -96,49 +99,115 @@ var/global/list/uneatable = list( dissipate_track++ + expand() + switch(src.allowed_size) + if(1) + current_size = 1 + icon = 'singularity.dmi' + icon_state = "singularity_s1" + pixel_x = 0 + pixel_y = 0 + grav_pull = 4 + consume_range = 0 + dissipate_delay = 10 + dissipate_track = 0 + dissipate_strength = 1 + if(3)//1 to 3 does not check for the turfs if you put the gens right next to a 1x1 then its going to eat them + current_size = 3 + icon = '96x96.dmi' + icon_state = "singularity_s3" + pixel_x = -32 + pixel_y = -32 + grav_pull = 6 + consume_range = 1 + dissipate_delay = 5 + dissipate_track = 0 + dissipate_strength = 5 + if(5) + if((check_turfs_in(1,2))&&(check_turfs_in(2,2))&&(check_turfs_in(4,2))&&(check_turfs_in(8,2))) + current_size = 5 + icon = '160x160.dmi' + icon_state = "singularity_s5" + pixel_x = -64 + pixel_y = -64 + grav_pull = 8 + consume_range = 2 + dissipate_delay = 10 + dissipate_track = 0 + dissipate_strength = 20 + if(7) + if((check_turfs_in(1,3))&&(check_turfs_in(2,3))&&(check_turfs_in(4,3))&&(check_turfs_in(8,3))) + current_size = 7 + icon = '224x224.dmi' + icon_state = "singularity_s7" + pixel_x = -96 + pixel_y = -96 + grav_pull = 10 + consume_range = 3 + dissipate_delay = 5 + dissipate_track = 0 + dissipate_strength = 15 + if(9)//this one also lacks a check for gens because it eats everything + current_size = 9 + icon = '288x288.dmi' + icon_state = "singularity_s9" + pixel_x = -128 + pixel_y = -128 + grav_pull = 15//This might cause some lag, dono though + consume_range = 4 + dissipate = 0 //It cant go smaller due to e loss + if(current_size == allowed_size) + return 1 + else + return 0 + + check_energy() if(energy <= 0) del(src) return 0 - switch(energy) + switch(energy)//Some of these numbers might need to be changed up later -Mport + if(1 to 199) + allowed_size = 1 + if(200 to 499) + allowed_size = 3 + if(500 to 999) + allowed_size = 5 if(1000 to 1999) - for(var/obj/machinery/field_generator/F in orange(5,src)) - F.turn_off() - emp_area() - toxmob() + allowed_size = 7 if(2000 to INFINITY) - explosion(src.loc, 4, 8, 15, 0) - if(src) - del(src) - return 0 + allowed_size = 9 + if(current_size != allowed_size) + expand() return 1 eat() - for (var/atom/X in orange(grav_pull,src)) + for(var/atom/X in orange(consume_range,src)) if(isarea(X)) continue - if(is_type_in_list(uneatable,X)) + consume(X) + for(var/atom/X in orange(grav_pull,src)) + if(isarea(X)) continue - switch(get_dist(src,X)) - if(0 to 2) - consume(X) - else if(!isturf(X)) - if(!X:anchored && !istype(X,/mob/living/carbon/human))//TODO:change the boots to just anchor so we dont have to add this to everything - step_towards(X,src) - else if(istype(X,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = X - if(istype(H.shoes,/obj/item/clothing/shoes/magboots)) - var/obj/item/clothing/shoes/magboots/M = H.shoes - if(M.magpulse) - continue - step_towards(H,src) + if(is_type_in_list(X, uneatable)) + continue + if(!isturf(X)) + if((!X:anchored && (!istype(X,/mob/living/carbon/human)))|| (src.current_size >= 9)) + step_towards(X,src) + else if(istype(X,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = X + if(istype(H.shoes,/obj/item/clothing/shoes/magboots)) + var/obj/item/clothing/shoes/magboots/M = H.shoes + if(M.magpulse) + continue + step_towards(H,src) return consume(var/atom/A) var/gain = 0 - if(is_type_in_list(uneatable,A)) + if(is_type_in_list(A, uneatable)) return 0 if (istype(A,/mob/living))//Mobs get gibbed gain = 20 @@ -166,34 +235,89 @@ var/global/list/uneatable = list( move(var/movement_dir = 0) + if(!move_self) + return 0 if(!(movement_dir in cardinal)) movement_dir = pick(NORTH, SOUTH, EAST, WEST) - switch(movement_dir) - if(NORTH) - if(!(can_move(locate(src.x,src.y+3,src.z))&&can_move(locate(src.x+1,src.y+3,src.z))&&can_move(locate(src.x-1,src.y+3,src.z)))) - return 0 - if(SOUTH) - if(!(can_move(locate(src.x,src.y-3,src.z))&&can_move(locate(src.x+1,src.y-3,src.z))&&can_move(locate(src.x-1,src.y-3,src.z)))) - return 0 - if(EAST) - if(!(can_move(locate(src.x+3,src.y,src.z))&&can_move(locate(src.x+3,src.y+1,src.z))&&can_move(locate(src.x+3,src.y-1,src.z)))) - return 0 - if(WEST) - if(!(can_move(locate(src.x-3,src.y,src.z))&&can_move(locate(src.x-3,src.y+1,src.z))&&can_move(locate(src.x-3,src.y-1,src.z)))) - return 0 - spawn(0) - step(src, movement_dir) + if(current_size >= 9)//The superlarge one does not care about things in its way + spawn(0) + step(src, movement_dir) + spawn(1) + step(src, movement_dir) + return 1 + else if(check_turfs_in(movement_dir)) + spawn(0) + step(src, movement_dir) + return 1 + return 0 + + + check_turfs_in(var/direction = 0, var/step = 0) + if(!direction) + return 0 + var/steps = 0 + if(!step) + switch(current_size) + if(1) + steps = 1 + if(3) + steps = 2 + if(5) + steps = 3 + if(7) + steps = 4 + if(9) + steps = 5 + else + steps = step + var/list/turfs = list() + var/turf/T = src.loc + for(var/i = 1 to steps) + T = get_step(T,direction) + if(!isturf(T)) + return 0 + turfs.Add(T) + var/dir2 = 0 + var/dir3 = 0 + switch(direction) + if(NORTH||SOUTH) + dir2 = 4 + dir3 = 8 + if(EAST||WEST) + dir2 = 1 + dir3 = 2 + var/turf/T2 = T + for(var/j = 1 to steps) + T2 = get_step(T2,dir2) + if(!isturf(T2)) + return 0 + turfs.Add(T2) + for(var/k = 1 to steps) + T = get_step(T,dir3) + if(!isturf(T)) + return 0 + turfs.Add(T) + for(var/turf/T3 in turfs) + if(isnull(T3)) + continue + if(!can_move(T3)) + return 0 + return 1 can_move(var/turf/T) if(!T) return 0 - if(locate(/obj/machinery/containment_field) in T) + if((locate(/obj/machinery/containment_field) in T)||(locate(/obj/machinery/shieldwall) in T)) return 0 else if(locate(/obj/machinery/field_generator) in T) var/obj/machinery/field_generator/G = locate(/obj/machinery/field_generator) in T if(G && G.active) return 0 + else if(locate(/obj/machinery/shieldwallgen) in T) + var/obj/machinery/shieldwallgen/S = locate(/obj/machinery/shieldwallgen) in T + if(S && S.active) + return 0 return 1 @@ -207,19 +331,19 @@ var/global/list/uneatable = list( if(4)//Stun mobs who lack optic scanners mezzer() else - //do nothing - return + return 0 + return 1 toxmob() var/toxrange = 8 - if (src.energy>100) - toxrange+=round((src.energy-100)/100) + if (src.energy>1000) + toxrange += 6 var/toxloss = 4 var/radiation = 5 - if (src.energy>150) - toxloss += round(((src.energy-150)/50)*4,1) - radiation += round(((src.energy-150)/50)*5,1) + if (src.energy>200) + toxloss = round(((src.energy-150)/50)*4,1) + radiation = round(((src.energy-150)/50)*5,1) for(var/mob/living/carbon/M in view(toxrange, src.loc)) if(istype(M,/mob/living/carbon/human)) if(M:wear_suit) //TODO: check for radiation protection diff --git a/code/_debug.dm b/code/unused/_debug.dm similarity index 100% rename from code/_debug.dm rename to code/unused/_debug.dm diff --git a/code/game/machinery/travel.dm b/code/unused/travel.dm similarity index 100% rename from code/game/machinery/travel.dm rename to code/unused/travel.dm diff --git a/icons/changelog.html b/icons/changelog.html index 4eabff65bf..4dcd6b4921 100644 --- a/icons/changelog.html +++ b/icons/changelog.html @@ -38,12 +38,24 @@

Visit our IRC channel, #tgstation13 on irc.rizon.net

/tg/Station 13 Development Team
- Coders: TLE, NEO, muskets, veryinky, Skie, Numbers, Agouri, Noka, Urist McDorf, Uhangi, Darem
+ Coders: TLE, NEO, muskets, veryinky, Skie, Numbers, Agouri, Noka, Urist McDorf, Uhangi, Darem, Mport
Spriters: Agouri, Cheridan, Cruazy Guest, Deeaych, Deuryn, Matty406, Microwave, ShiftyEyesShady, Skie, Uhangi, Veyveyr
Sounds: Skie
Thanks to: CDK Station devs, GoonStation devs, the original SpaceStation developers and Erikat for the new title image

Changelog

+
08.02.2011, r999-1000
+ +
06.02.2011, r979