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
This commit is contained in:
mport2004@gmail.com
2011-02-09 06:07:32 +00:00
parent 86a47cbc4e
commit 50f282f8b2
42 changed files with 4483 additions and 3574 deletions
+18 -4
View File
@@ -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."
+57 -6
View File
@@ -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
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
@@ -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)
+13 -9
View File
@@ -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."
@@ -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
+18 -1
View File
@@ -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?
@@ -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)
@@ -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
@@ -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"
@@ -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<BR>"
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR><BR>"
dat += "Status:<BR>"
if(!assembled)
dat += "Unable to detect all parts!<BR>"
dat += "<A href='?src=\ref[src];scan=1'>Run Scan</A><BR><BR>"
else
dat += "All parts in place.<BR><BR>"
dat += "Power:"
if(active)
dat += "On<BR>"
else
dat += "Off <BR>"
dat += "<A href='?src=\ref[src];togglep=1'>Toggle Power</A><BR><BR>"
dat += "Particle Strength: [src.strength]"
dat += "<A href='?src=\ref[src];strengthdown=1'>--</A>|<A href='?src=\ref[src];strengthup=1'>++</A><BR><BR>"
user << browse(dat, "window=pacontrol;size=420x500")
onclose(user, "pacontrol")
@@ -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
@@ -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
+187 -63
View File
@@ -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