mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 08:34:16 +01:00
Updated:
Singularity Engine -Recoded some parts, still works mostly the same Welders -Recoded, it works mostly the same but is easier to use in code -Cyborgs have a larger fuel tank -Brought most if not all of the areas that use welders upto spec Moved the changeling chem recharge code into the human life proc New players who log out before spawning in are now deleted New minor Common event Machines around the station use more power, system might need some changes later Likely few other minor changes that I just cant think of atm git-svn-id: http://tgstation13.googlecode.com/svn/trunk@945 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
src.verbs += /proc/toggle_adminmsg
|
||||
|
||||
src.verbs += /client/proc/triple_ai //triple AIs~ --NEO
|
||||
|
||||
src.verbs += /client/proc/cmd_mass_modify_object_variables
|
||||
// Admin "must have"
|
||||
src.verbs += /client/proc/cmd_admin_list_occ
|
||||
src.verbs += /client/proc/cmd_admin_mute
|
||||
@@ -81,7 +81,7 @@
|
||||
src.verbs += /proc/givetestverbs
|
||||
src.verbs += /obj/admins/proc/spawn_atom
|
||||
src.verbs += /obj/admins/proc/toggletintedweldhelmets
|
||||
|
||||
|
||||
|
||||
// Admin helpers
|
||||
src.verbs += /client/proc/cmd_admin_attack_log
|
||||
@@ -171,7 +171,7 @@
|
||||
src.verbs += /obj/admins/proc/voteres //toggle votes
|
||||
src.verbs += /client/proc/deadchat //toggles deadchat
|
||||
src.verbs += /proc/toggle_adminmsg
|
||||
|
||||
src.verbs += /client/proc/cmd_mass_modify_object_variables
|
||||
// Admin "must have"
|
||||
src.verbs += /client/proc/cmd_admin_list_occ
|
||||
src.verbs += /client/proc/cmd_admin_mute
|
||||
@@ -1093,7 +1093,7 @@
|
||||
src.verbs -= /client/proc/cmd_admin_prison
|
||||
src.verbs -= /obj/admins/proc/unprison
|
||||
src.verbs -= /proc/togglebuildmode
|
||||
|
||||
src.verbs -= /client/proc/cmd_mass_modify_object_variables
|
||||
// Unnecessary commands
|
||||
src.verbs -= /client/proc/funbutton
|
||||
src.verbs -= /client/proc/make_sound // -- TLE
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
/client/proc/cmd_mass_modify_object_variables(obj/O as obj|mob|turf|area in world)
|
||||
set category = "Debug"
|
||||
set name = "Mass Edit Variables"
|
||||
set desc="(target) Edit all instances of a target item's variables"
|
||||
src.massmodify_variables(O)
|
||||
|
||||
|
||||
/client/proc/massmodify_variables(var/atom/O)
|
||||
var/list/locked = list("vars", "key", "ckey", "client")
|
||||
|
||||
if(!src.authenticated || !src.holder)
|
||||
src << "Only administrators may use this command."
|
||||
return
|
||||
|
||||
var/list/names = list()
|
||||
for (var/V in O.vars)
|
||||
names += V
|
||||
|
||||
names = sortList(names)
|
||||
|
||||
var/variable = input("Which var?","Var") as null|anything in names
|
||||
if(!variable)
|
||||
return
|
||||
var/default
|
||||
var/var_value = O.vars[variable]
|
||||
var/dir
|
||||
|
||||
if (locked.Find(variable) && !(src.holder.rank in list("Host", "Coder")))
|
||||
return
|
||||
|
||||
if(isnull(var_value))
|
||||
usr << "Unable to determine variable type."
|
||||
|
||||
else if(isnum(var_value))
|
||||
usr << "Variable appears to be <b>NUM</b>."
|
||||
default = "num"
|
||||
dir = 1
|
||||
|
||||
else if(istext(var_value))
|
||||
usr << "Variable appears to be <b>TEXT</b>."
|
||||
default = "text"
|
||||
|
||||
else if(isloc(var_value))
|
||||
usr << "Variable appears to be <b>REFERENCE</b>."
|
||||
default = "reference"
|
||||
|
||||
else if(isicon(var_value))
|
||||
usr << "Variable appears to be <b>ICON</b>."
|
||||
var_value = "\icon[var_value]"
|
||||
default = "icon"
|
||||
|
||||
else if(istype(var_value,/atom) || istype(var_value,/datum))
|
||||
usr << "Variable appears to be <b>TYPE</b>."
|
||||
default = "type"
|
||||
|
||||
else if(istype(var_value,/list))
|
||||
usr << "Variable appears to be <b>LIST</b>."
|
||||
default = "list"
|
||||
|
||||
else if(istype(var_value,/client))
|
||||
usr << "Variable appears to be <b>CLIENT</b>."
|
||||
default = "cancel"
|
||||
|
||||
else
|
||||
usr << "Variable appears to be <b>FILE</b>."
|
||||
default = "file"
|
||||
|
||||
usr << "Variable contains: [var_value]"
|
||||
if(dir)
|
||||
switch(var_value)
|
||||
if(1)
|
||||
dir = "NORTH"
|
||||
if(2)
|
||||
dir = "SOUTH"
|
||||
if(4)
|
||||
dir = "EAST"
|
||||
if(8)
|
||||
dir = "WEST"
|
||||
if(5)
|
||||
dir = "NORTHEAST"
|
||||
if(6)
|
||||
dir = "SOUTHEAST"
|
||||
if(9)
|
||||
dir = "NORTHWEST"
|
||||
if(10)
|
||||
dir = "SOUTHWEST"
|
||||
else
|
||||
dir = null
|
||||
if(dir)
|
||||
usr << "If a direction, direction is: [dir]"
|
||||
|
||||
var/class = input("What kind of variable?","Variable Type",default) as null|anything in list("text",
|
||||
"num","type","icon","file","edit referenced object","restore to default")
|
||||
|
||||
if(!class)
|
||||
return
|
||||
|
||||
var/original_name
|
||||
|
||||
if (!istype(O, /atom))
|
||||
original_name = "\ref[O] ([O])"
|
||||
else
|
||||
original_name = O:name
|
||||
|
||||
switch(class)
|
||||
|
||||
if("restore to default")
|
||||
O.vars[variable] = initial(O.vars[variable])
|
||||
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
if("edit referenced object")
|
||||
return .(O.vars[variable])
|
||||
|
||||
if("text")
|
||||
O.vars[variable] = input("Enter new text:","Text",\
|
||||
O.vars[variable]) as text
|
||||
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
if("num")
|
||||
O.vars[variable] = input("Enter new number:","Num",\
|
||||
O.vars[variable]) as num
|
||||
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
if("type")
|
||||
O.vars[variable] = input("Enter type:","Type",O.vars[variable]) \
|
||||
in typesof(/obj,/mob,/area,/turf)
|
||||
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
if("file")
|
||||
O.vars[variable] = input("Pick file:","File",O.vars[variable]) \
|
||||
as file
|
||||
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O.type, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O.type, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
if("icon")
|
||||
O.vars[variable] = input("Pick icon:","Icon",O.vars[variable]) \
|
||||
as icon
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in world)
|
||||
if (M.type == O.type)
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
log_admin("[key_name(src)] mass modified [original_name]'s [variable] to [O.vars[variable]]")
|
||||
message_admins("[key_name_admin(src)] mass modified [original_name]'s [variable] to [O.vars[variable]]", 1)
|
||||
@@ -41,6 +41,9 @@
|
||||
//Disease Check
|
||||
handle_virus_updates()
|
||||
|
||||
//Changeling things
|
||||
handle_changeling()
|
||||
|
||||
//Handle temperature/pressure differences between body and environment
|
||||
handle_environment(environment)
|
||||
|
||||
@@ -720,7 +723,7 @@
|
||||
if(!seer)
|
||||
src.see_invisible = 0
|
||||
|
||||
if (istype(src.head, /obj/item/clothing/head/helmet/welding) && tinted_weldhelh)
|
||||
if (istype(src.head, /obj/item/clothing/head/helmet/welding) && tinted_weldhelh)
|
||||
src.see_in_dark = 0
|
||||
|
||||
if (src.sleep) src.sleep.icon_state = text("sleep[]", src.sleeping)
|
||||
@@ -866,6 +869,13 @@
|
||||
if(!M.nodamage)
|
||||
M.bruteloss += 5
|
||||
src.nutrition += 10
|
||||
|
||||
handle_changeling()
|
||||
if (mind)
|
||||
if (mind.special_role == "Changeling")
|
||||
src.chem_charges = between(0, (max((0.9 - (chem_charges / 50)), 0.1) + chem_charges), 50)
|
||||
|
||||
|
||||
/*
|
||||
// Commented out so hunger system won't be such shock
|
||||
// Damage and effects from not eating
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
//Disease Check
|
||||
handle_virus_updates()
|
||||
|
||||
//Changeling things
|
||||
handle_changeling()
|
||||
|
||||
//Handle temperature/pressure differences between body and environment
|
||||
if(environment) // More error checking -- TLE
|
||||
handle_environment(environment)
|
||||
@@ -564,4 +567,9 @@
|
||||
src.drop_item()
|
||||
src.density = 1
|
||||
else
|
||||
src.density = !src.lying
|
||||
src.density = !src.lying
|
||||
|
||||
handle_changeling()
|
||||
if (mind)
|
||||
if (mind.special_role == "Changeling")
|
||||
src.chem_charges = between(0, (max((0.9 - (chem_charges / 50)), 0.1) + chem_charges), 50)
|
||||
@@ -351,9 +351,10 @@
|
||||
statpanel("Status")
|
||||
stat(null, text("Intent: []", src.a_intent))
|
||||
stat(null, text("Move Mode: []", src.m_intent))
|
||||
if (src.client.statpanel == "Status")
|
||||
if (src.mind.special_role == "Changeling")
|
||||
stat("Chemical Storage", src.chem_charges)
|
||||
if(client && mind)
|
||||
if (src.client.statpanel == "Status")
|
||||
if (src.mind.special_role == "Changeling")
|
||||
stat("Chemical Storage", src.chem_charges)
|
||||
return
|
||||
|
||||
/mob/living/carbon/monkey/update_clothing()
|
||||
|
||||
@@ -185,18 +185,16 @@
|
||||
|
||||
/mob/living/silicon/hivebot/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
|
||||
if (W:get_fuel() > 2)
|
||||
W:use_fuel(1)
|
||||
if (W:remove_fuel(4))
|
||||
src.bruteloss -= 30
|
||||
if(src.bruteloss < 0) src.bruteloss = 0
|
||||
src.updatehealth()
|
||||
src.add_fingerprint(user)
|
||||
for(var/mob/O in viewers(user, null))
|
||||
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
|
||||
else
|
||||
user << "Need more welding fuel!"
|
||||
return
|
||||
src.bruteloss -= 30
|
||||
if(src.bruteloss < 0) src.bruteloss = 0
|
||||
src.updatehealth()
|
||||
src.add_fingerprint(user)
|
||||
for(var/mob/O in viewers(user, null))
|
||||
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
|
||||
|
||||
|
||||
/mob/living/silicon/hivebot/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
|
||||
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
|
||||
process_locks()
|
||||
if(weapon_lock)
|
||||
src.module_active = null
|
||||
src.module_state_1 = null
|
||||
src.module_state_2 = null
|
||||
src.module_state_3 = null
|
||||
|
||||
@@ -348,17 +348,17 @@
|
||||
|
||||
/mob/living/silicon/robot/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
|
||||
if (W:get_fuel() > 2)
|
||||
W:use_fuel(1)
|
||||
if (W:remove_fuel(4))
|
||||
src.bruteloss -= 30
|
||||
if(src.bruteloss < 0) src.bruteloss = 0
|
||||
src.updatehealth()
|
||||
src.add_fingerprint(user)
|
||||
for(var/mob/O in viewers(user, null))
|
||||
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
|
||||
else
|
||||
user << "Need more welding fuel!"
|
||||
return
|
||||
src.bruteloss -= 30
|
||||
if(src.bruteloss < 0) src.bruteloss = 0
|
||||
src.updatehealth()
|
||||
src.add_fingerprint(user)
|
||||
for(var/mob/O in viewers(user, null))
|
||||
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
|
||||
|
||||
|
||||
else if(istype(W, /obj/item/weapon/cable_coil) && wiresexposed)
|
||||
var/obj/item/weapon/cable_coil/coil = W
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
..()
|
||||
src.modules += new /obj/item/weapon/extinguisher(src)
|
||||
src.modules += new /obj/item/weapon/screwdriver(src)
|
||||
src.modules += new /obj/item/weapon/weldingtool(src)
|
||||
src.modules += new /obj/item/weapon/weldingtool/largetank(src)
|
||||
src.modules += new /obj/item/weapon/wrench(src)
|
||||
src.modules += new /obj/item/device/analyzer(src)
|
||||
src.modules += new /obj/item/device/flashlight(src)
|
||||
|
||||
@@ -1381,7 +1381,7 @@
|
||||
namecounts[name] = 1
|
||||
creatures[name] = D
|
||||
|
||||
for (var/obj/machinery/the_singularity/S in world)
|
||||
for (var/obj/machinery/singularity/S in world)
|
||||
var/name = "Singularity"
|
||||
if (name in names)
|
||||
namecounts[name]++
|
||||
|
||||
@@ -3,6 +3,7 @@ mob/new_player
|
||||
|
||||
var/datum/preferences/preferences
|
||||
var/ready = 0
|
||||
var/spawning = 0
|
||||
|
||||
invisibility = 101
|
||||
|
||||
@@ -80,6 +81,8 @@ mob/new_player
|
||||
Logout()
|
||||
ready = 0
|
||||
..()
|
||||
if(!spawning)
|
||||
del(src)
|
||||
return
|
||||
|
||||
verb
|
||||
@@ -142,6 +145,8 @@ mob/new_player
|
||||
if(alert(src,"Are you sure you wish to observe? You will not be able to play this round!","Player Setup","Yes","No") == "Yes")
|
||||
var/mob/dead/observer/observer = new()
|
||||
|
||||
src.spawning = 1
|
||||
|
||||
close_spawn_windows()
|
||||
var/obj/O = locate("landmark*Observer-Start")
|
||||
src << "\blue Now teleporting."
|
||||
@@ -397,6 +402,7 @@ mob/new_player
|
||||
src << browse(dat, "window=latechoices;size=300x640;can_close=0")
|
||||
|
||||
proc/create_character()
|
||||
src.spawning = 1
|
||||
var/mob/living/carbon/human/new_character = new(src.loc)
|
||||
|
||||
close_spawn_windows()
|
||||
|
||||
+18
-18
@@ -366,23 +366,23 @@
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
user << "You start welding APC frame..."
|
||||
W:use_fuel(2)
|
||||
W:eyecheck(user)
|
||||
playsound(src.loc, 'Welder.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
if (emagged || malfhack || (stat & BROKEN) || opened==2)
|
||||
new /obj/item/stack/sheet/metal(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut apart by [user.name] with the weldingtool.",\
|
||||
"You disassembled brocken APC frame.",\
|
||||
"\red You hear welding.")
|
||||
else
|
||||
new /obj/item/apc_frame(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut from the wall by [user.name] with the weldingtool.",\
|
||||
"You cut APC frame from the wall.",\
|
||||
"\red You hear welding.")
|
||||
del(src)
|
||||
if(W:remove_fuel(2))
|
||||
playsound(src.loc, 'Welder.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
if (emagged || malfhack || (stat & BROKEN) || opened==2)
|
||||
new /obj/item/stack/sheet/metal(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut apart by [user.name] with the weldingtool.",\
|
||||
"You disassembled brocken APC frame.",\
|
||||
"\red You hear welding.")
|
||||
else
|
||||
new /obj/item/apc_frame(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut from the wall by [user.name] with the weldingtool.",\
|
||||
"You cut APC frame from the wall.",\
|
||||
"\red You hear welding.")
|
||||
del(src)
|
||||
return
|
||||
else if (istype(W, /obj/item/apc_frame) && opened && emagged)
|
||||
emagged = 0
|
||||
if (opened==2)
|
||||
@@ -810,7 +810,7 @@
|
||||
else
|
||||
malfai << "Hack complete. The APC is now under your exclusive control. Unable to fuse interface due to insufficient cell charge."
|
||||
else
|
||||
malfai << "Hack complete. The APC is now under your exclusive control. Unable to fuse interface due to lack of cell do discharge."
|
||||
malfai << "Hack complete. The APC is now under your exclusive control. Unable to fuse interface due to lack of cell to discharge."
|
||||
|
||||
|
||||
src.updateDialog()
|
||||
|
||||
@@ -19,7 +19,10 @@
|
||||
desc = "A lighting fixture."
|
||||
anchored = 1
|
||||
layer = 5 // They were appearing under mobs which is a little weird - Ostaf
|
||||
power_usage = 0
|
||||
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
|
||||
var/brightness = 8 // luminosity when on, also used in power calculation
|
||||
var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN
|
||||
|
||||
@@ -63,9 +66,23 @@
|
||||
// create a new lighting fixture
|
||||
/obj/machinery/light/New()
|
||||
..()
|
||||
|
||||
switch(fitting)
|
||||
if("tube")
|
||||
brightness = rand(6,9)
|
||||
if("bulb")
|
||||
brightness = rand(3,6)
|
||||
spawn(1)
|
||||
update()
|
||||
|
||||
/obj/machinery/light/Del()
|
||||
var/area/A = get_area(src)
|
||||
if(A)
|
||||
on = 0
|
||||
// A.update_lights()
|
||||
..()
|
||||
|
||||
|
||||
// update the icon_state and luminosity of the light depending on its state
|
||||
/obj/machinery/light/proc/update()
|
||||
|
||||
@@ -100,7 +117,12 @@
|
||||
icon_state = "[base_state]-burned"
|
||||
on = 0
|
||||
sd_SetLuminosity(0)
|
||||
|
||||
power_usage = (luminosity * 20)
|
||||
if(on != on_gs)
|
||||
on_gs = on
|
||||
// var/area/A = get_area(src)
|
||||
// if(A)
|
||||
// A.update_lights()
|
||||
|
||||
|
||||
// attempt to set the light's on/off status
|
||||
@@ -129,8 +151,6 @@
|
||||
|
||||
/obj/machinery/light/attackby(obj/item/W, mob/user)
|
||||
|
||||
if (istype(user, /mob/living/silicon))
|
||||
return
|
||||
|
||||
// attempt to insert light
|
||||
if(istype(W, /obj/item/weapon/light))
|
||||
@@ -145,6 +165,7 @@
|
||||
user << "You insert the [L.name]."
|
||||
switchcount = L.switchcount
|
||||
rigged = L.rigged
|
||||
brightness = L.brightness
|
||||
del(L)
|
||||
|
||||
on = has_power()
|
||||
@@ -255,6 +276,7 @@
|
||||
var/obj/item/weapon/light/L = new light_type()
|
||||
L.status = status
|
||||
L.rigged = rigged
|
||||
L.brightness = src.brightness
|
||||
L.loc = usr
|
||||
L.layer = 20
|
||||
if(user.hand)
|
||||
@@ -318,8 +340,9 @@
|
||||
#define LIGHTING_POWER_FACTOR 20 //20W per unit luminosity
|
||||
|
||||
/obj/machinery/light/process()
|
||||
if(on)
|
||||
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
|
||||
return
|
||||
// if(on)
|
||||
// use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
|
||||
|
||||
// called when area power state changes
|
||||
|
||||
@@ -402,6 +425,7 @@
|
||||
var/switchcount = 0 // number of times switched
|
||||
m_amt = 60
|
||||
var/rigged = 0 // true if rigged to explode
|
||||
var/brightness = 2 //how much light it gives off
|
||||
|
||||
/obj/item/weapon/light/tube
|
||||
name = "light tube"
|
||||
@@ -410,6 +434,7 @@
|
||||
base_state = "ltube"
|
||||
item_state = "c_tube"
|
||||
g_amt = 200
|
||||
brightness = 8
|
||||
|
||||
/obj/item/weapon/light/bulb
|
||||
name = "light bulb"
|
||||
@@ -418,6 +443,7 @@
|
||||
base_state = "lbulb"
|
||||
item_state = "contvapour"
|
||||
g_amt = 100
|
||||
brightness = 5
|
||||
|
||||
// update the icon state and description of the light
|
||||
/obj/item/weapon/light
|
||||
@@ -436,6 +462,11 @@
|
||||
|
||||
/obj/item/weapon/light/New()
|
||||
..()
|
||||
switch(name)
|
||||
if("light tube")
|
||||
brightness = rand(6,9)
|
||||
if("light bulb")
|
||||
brightness = rand(4,6)
|
||||
update()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
/obj/machinery/power/rad_collector
|
||||
name = "Radiation Collector Array"
|
||||
desc = "A device which uses Hawking Radiation and plasma to produce power."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "collector"
|
||||
anchored = 1
|
||||
density = 1
|
||||
directwired = 1
|
||||
var
|
||||
obj/item/weapon/tank/plasma/P = null
|
||||
last_power = 0
|
||||
|
||||
process()
|
||||
if(P)
|
||||
if(P.air_contents.toxins <= 0)
|
||||
P.air_contents.toxins = 0
|
||||
eject()
|
||||
else
|
||||
P.air_contents.toxins -= 0.001
|
||||
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))
|
||||
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"
|
||||
src.P = W
|
||||
W.loc = src
|
||||
if (user.client)
|
||||
user.client.screen -= W
|
||||
user.u_equip(W)
|
||||
else if(istype(W, /obj/item/weapon/crowbar))
|
||||
if(P)
|
||||
eject()
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
if(P)
|
||||
user << "\red Remove the plasma tank first."
|
||||
return 1
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
src.anchored = !src.anchored
|
||||
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
|
||||
"You [anchored? "secure":"undo"] the external bolts.", \
|
||||
"You hear ratchet")
|
||||
else
|
||||
..()
|
||||
return 1
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
switch(severity)
|
||||
if(2, 3)
|
||||
eject()
|
||||
return ..()
|
||||
|
||||
|
||||
proc
|
||||
eject()
|
||||
var/obj/item/weapon/tank/plasma/Z = src.P
|
||||
if (!Z)
|
||||
return
|
||||
Z.loc = get_turf(src)
|
||||
Z.layer = initial(Z.layer)
|
||||
src.P = null
|
||||
icon_state = "collector"
|
||||
|
||||
receive_pulse(var/pulse_strength)
|
||||
if(P)
|
||||
var/power_produced = 0
|
||||
power_produced = P.air_contents.toxins*pulse_strength*20
|
||||
add_avail(power_produced)
|
||||
last_power = power_produced
|
||||
return
|
||||
return
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
/obj/machinery/containment_field
|
||||
name = "Containment Field"
|
||||
desc = "An energy field."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "Contain_F"
|
||||
anchored = 1
|
||||
density = 0
|
||||
unacidable = 1
|
||||
power_usage = 0
|
||||
|
||||
New()
|
||||
spawn(1)
|
||||
src.sd_SetLuminosity(5)
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(get_dist(src, user) > 1)
|
||||
return 0
|
||||
else
|
||||
shock(user)
|
||||
return 1
|
||||
|
||||
|
||||
blob_act()
|
||||
return
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
return
|
||||
|
||||
|
||||
HasProximity(atom/movable/AM as mob|obj)
|
||||
if(istype(AM,/mob/living/silicon) && prob(40))
|
||||
shock(AM)
|
||||
return
|
||||
if(istype(AM,/mob/living/carbon) && prob(50))
|
||||
shock(AM)
|
||||
return
|
||||
|
||||
|
||||
proc
|
||||
shock(mob/user as mob)
|
||||
if(iscarbon(user))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
var/shock_damage = min(rand(30,40),rand(30,40))
|
||||
user.burn_skin(shock_damage)
|
||||
user.updatehealth()
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>You feel a powerful shock course through your body sending you flying!</B>", \
|
||||
"\red You hear a heavy electrical crack")
|
||||
var/stun = min(shock_damage, 15)
|
||||
if(user.stunned < shock_damage) user.stunned = stun
|
||||
if(user.weakened < 10) user.weakened = 10
|
||||
user.updatehealth()
|
||||
var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
|
||||
user.throw_at(target, 200, 4)
|
||||
return
|
||||
else if(issilicon(user))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
var/shock_damage = rand(15,30)
|
||||
user.fireloss += shock_damage
|
||||
user.updatehealth()
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>Energy pulse detected, system damaged!</B>", \
|
||||
"\red You hear an electrical crack")
|
||||
if(prob(20))
|
||||
if(user.stunned < 2)
|
||||
user.stunned = 2
|
||||
return
|
||||
return
|
||||
@@ -0,0 +1,179 @@
|
||||
/obj/machinery/emitter
|
||||
name = "Emitter"
|
||||
desc = "A heavy duty industrial laser"
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "Emitter"
|
||||
anchored = 0
|
||||
density = 1
|
||||
req_access = list(access_engine)
|
||||
var/active = 0
|
||||
var/fire_delay = 100
|
||||
var/last_shot = 0
|
||||
var/shot_number = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
power_usage = 0
|
||||
|
||||
|
||||
/obj/machinery/emitter/New()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/emitter/update_icon()
|
||||
if (active && !(stat & (NOPOWER|BROKEN)))
|
||||
icon_state = "Emitter +a"
|
||||
else
|
||||
icon_state = "Emitter"
|
||||
|
||||
|
||||
/obj/machinery/emitter/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
if(state == 2)
|
||||
if(!src.locked || istype(user, /mob/living/silicon))
|
||||
if(src.active==1)
|
||||
src.active = 0
|
||||
user << "You turn off the [src]."
|
||||
src.power_usage = 0
|
||||
else
|
||||
src.active = 1
|
||||
user << "You turn on the [src]."
|
||||
src.shot_number = 0
|
||||
src.fire_delay = 100
|
||||
src.power_usage = 100
|
||||
update_icon()
|
||||
else
|
||||
user << "The controls are locked!"
|
||||
else
|
||||
user << "The [src] needs to be firmly secured to the floor first."
|
||||
return 1
|
||||
|
||||
/obj/machinery/emitter/emp_act()//Emitters are hardened but still might have issues
|
||||
use_power(50)
|
||||
if(prob(1)&&prob(1))
|
||||
if(src.active)
|
||||
src.active = 0
|
||||
src.power_usage = 0
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/emitter/process()
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(src.state != 2)
|
||||
src.active = 0
|
||||
return
|
||||
|
||||
if(((src.last_shot + src.fire_delay) <= world.time) && (src.active == 1))
|
||||
src.last_shot = world.time
|
||||
if(src.shot_number < 3)
|
||||
src.fire_delay = 2
|
||||
src.shot_number ++
|
||||
else
|
||||
src.fire_delay = rand(20,100)
|
||||
src.shot_number = 0
|
||||
|
||||
use_power(1000)
|
||||
var/obj/beam/a_laser/A = new /obj/beam/a_laser( src.loc )
|
||||
A.icon_state = "u_laser"
|
||||
playsound(src.loc, 'emitter.ogg', 75, 1)
|
||||
|
||||
if(prob(35))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
A.dir = src.dir
|
||||
if(src.dir == 1)//Up
|
||||
A.yo = 20
|
||||
A.xo = 0
|
||||
|
||||
else if(src.dir == 2)//Down
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
|
||||
else if(src.dir == 4)//Right
|
||||
A.yo = 0
|
||||
A.xo = 20
|
||||
|
||||
else if(src.dir == 8)//Left
|
||||
A.yo = 0
|
||||
A.xo = -20
|
||||
|
||||
else // Any other
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
|
||||
A.process()
|
||||
|
||||
|
||||
/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))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/weapon/weldingtool))
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
return
|
||||
if(1)
|
||||
if (W:remove_fuel(2))
|
||||
playsound(src.loc, 'Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
state = 2
|
||||
user << "You weld the [src] to the floor."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
if(2)
|
||||
if (W:remove_fuel(2))
|
||||
playsound(src.loc, 'Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
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
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/emitter/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
@@ -0,0 +1,308 @@
|
||||
|
||||
/////FIELD GEN
|
||||
#define field_generator_max_power 250
|
||||
/obj/machinery/field_generator
|
||||
name = "Field Generator"
|
||||
desc = "A large thermal battery that projects a high amount of energy when powered."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "Field_Gen"
|
||||
anchored = 0
|
||||
density = 1
|
||||
req_access = list(access_engine)
|
||||
power_usage = 0
|
||||
var
|
||||
Varedit_start = 0
|
||||
Varpower = 0
|
||||
active = 0
|
||||
power = 20
|
||||
state = 0
|
||||
warming_up = 0
|
||||
powerlevel = 0
|
||||
list/obj/machinery/containment_field/fields
|
||||
list/obj/machinery/field_generator/connected_gens
|
||||
|
||||
|
||||
update_icon()
|
||||
if (!active)
|
||||
icon_state = "Field_Gen"
|
||||
return
|
||||
var/level = 3
|
||||
switch (power)
|
||||
if(0 to 60)
|
||||
level = 1
|
||||
if(61 to 220)
|
||||
level = 2
|
||||
if(221 to INFINITY)
|
||||
level = 3
|
||||
level = min(level,warming_up)
|
||||
if (powerlevel!=level)
|
||||
powerlevel = level
|
||||
icon_state = "Field_Gen +a[powerlevel]"
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
fields = list()
|
||||
connected_gens = list()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if(src.Varedit_start == 1)
|
||||
if(src.active == 0)
|
||||
src.active = 1
|
||||
src.state = 2
|
||||
src.power = field_generator_max_power
|
||||
src.anchored = 1
|
||||
src.warming_up = 3
|
||||
turn_on()
|
||||
Varedit_start = 0
|
||||
if(src.active == 2)
|
||||
calc_power()
|
||||
|
||||
return
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(get_dist(src, user) <= 1)//Need to actually touch the thing to turn it on
|
||||
if(src.active >= 1)
|
||||
user << "You are unable to turn off the [src] once it is online."
|
||||
return 1
|
||||
else
|
||||
user.visible_message("[user.name] turns on the [src.name]", \
|
||||
"You turn on the [src].", \
|
||||
"You hear heavy droning")
|
||||
turn_on()
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
user << "The [src] needs to be firmly secured to the floor first."
|
||||
return
|
||||
|
||||
|
||||
attackby(obj/item/W, mob/user)
|
||||
if(active)
|
||||
user << "The [src] needs to be off."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/weldingtool))
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
return
|
||||
if(1)
|
||||
if (W:remove_fuel(2,user))
|
||||
playsound(src.loc, 'Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
state = 2
|
||||
user << "You weld the field generator to the floor."
|
||||
else
|
||||
return
|
||||
if(2)
|
||||
if (W:remove_fuel(2,user))
|
||||
playsound(src.loc, 'Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
else
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
emp_act()
|
||||
return 0
|
||||
|
||||
|
||||
bullet_act(flag)
|
||||
if (flag == PROJECTILE_BULLET)
|
||||
src.power -= 100
|
||||
else if (flag == PROJECTILE_WEAKBULLET)
|
||||
src.power -= 50
|
||||
else if (flag == PROJECTILE_LASER)
|
||||
src.power += 20
|
||||
else if (flag == PROJECTILE_TASER)
|
||||
src.power += 5
|
||||
else
|
||||
src.power -= 30
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
Del()
|
||||
src.cleanup()
|
||||
..()
|
||||
|
||||
|
||||
proc
|
||||
turn_off()
|
||||
src.active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
update_icon()
|
||||
|
||||
|
||||
turn_on()
|
||||
src.active = 1
|
||||
warming_up = 1
|
||||
powerlevel = 0
|
||||
spawn(1)
|
||||
while (warming_up<3 && active)
|
||||
sleep(50)
|
||||
warming_up++
|
||||
update_icon()
|
||||
if(warming_up >= 3)
|
||||
start_fields()
|
||||
update_icon()
|
||||
|
||||
|
||||
calc_power()
|
||||
if(Varpower)
|
||||
return
|
||||
|
||||
update_icon()
|
||||
if(src.power > field_generator_max_power)
|
||||
src.power = field_generator_max_power
|
||||
|
||||
var/power_draw = 0
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (isnull(F))
|
||||
continue
|
||||
power_draw++
|
||||
|
||||
if(draw_power(round(power_draw/2,1)))
|
||||
return 1
|
||||
else
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message("\red The [src.name] shuts down!")
|
||||
turn_off()
|
||||
src.power = 0
|
||||
return
|
||||
|
||||
|
||||
draw_power(var/draw = 0,var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null)
|
||||
// if(G && G == src)//Loopin, set fail
|
||||
// return 0
|
||||
if(src.power >= draw)//We have enough power
|
||||
src.power -= draw
|
||||
return 1
|
||||
else//Need more power
|
||||
return 0
|
||||
/* draw -= src.power
|
||||
src.power = 0 ill finis this up when not about to pass out
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if(isnull(FG))
|
||||
continue
|
||||
if(FG == last)//We just asked you
|
||||
continue
|
||||
if(G)//Another gen is askin for power and we dont have it
|
||||
if(FG.draw_power(draw,G,src))//Can you take the load
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
else//We are askin another for power
|
||||
if(FG.draw_power(draw,src,src))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
*/
|
||||
|
||||
start_fields()
|
||||
if(!src.state == 2 || !anchored)
|
||||
turn_off()
|
||||
return
|
||||
spawn(1)
|
||||
setup_field(1)
|
||||
spawn(2)
|
||||
setup_field(2)
|
||||
spawn(3)
|
||||
setup_field(4)
|
||||
spawn(4)
|
||||
setup_field(8)
|
||||
src.active = 2
|
||||
|
||||
|
||||
setup_field(var/NSEW)
|
||||
var/turf/T = src.loc
|
||||
var/obj/machinery/field_generator/G
|
||||
var/steps = 0
|
||||
if(!NSEW)//Make sure its ran right
|
||||
return
|
||||
for(var/dist = 0, dist <= 9, dist += 1) // checks out to 8 tiles away for another generator
|
||||
T = get_step(T, NSEW)
|
||||
steps += 1
|
||||
G = locate(/obj/machinery/field_generator) in T
|
||||
if(!isnull(G))
|
||||
steps -= 1
|
||||
if(!G.active)
|
||||
return
|
||||
break
|
||||
if(isnull(G))
|
||||
return
|
||||
T = src.loc
|
||||
for(var/dist = 0, dist < steps, dist += 1) // creates each field tile
|
||||
var/field_dir = get_dir(T,get_step(G.loc, NSEW))
|
||||
T = get_step(T, NSEW)
|
||||
if(!locate(/obj/machinery/containment_field) in T)
|
||||
var/obj/machinery/containment_field/CF = new/obj/machinery/containment_field()
|
||||
fields += CF
|
||||
G.fields += CF
|
||||
CF.loc = T
|
||||
CF.dir = field_dir
|
||||
var/listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
if(FG == G)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
connected_gens.Add(G)
|
||||
listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG2 in G.connected_gens)
|
||||
if (isnull(FG2))
|
||||
continue
|
||||
if(FG2 == src)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
G.connected_gens.Add(src)
|
||||
|
||||
|
||||
cleanup()
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (isnull(F))
|
||||
continue
|
||||
del(F)
|
||||
fields = list()
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
FG.connected_gens.Remove(src)
|
||||
connected_gens.Remove(FG)
|
||||
connected_gens = list()
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
/////SINGULARITY SPAWNER
|
||||
/obj/machinery/the_singularitygen/
|
||||
name = "Gravitational Singularity Generator"
|
||||
desc = "An Odd Device which produces a Gravitational Singularity when set up."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "TheSingGen"
|
||||
anchored = 1
|
||||
density = 1
|
||||
power_usage = 0
|
||||
|
||||
//////////////////////Singularity gen START
|
||||
|
||||
/obj/machinery/the_singularitygen/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if (singularity_is_surrounded(T))
|
||||
new /obj/machinery/singularity/(T, 200)
|
||||
spawn(0)
|
||||
del(src)
|
||||
return
|
||||
|
||||
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
anchored = !anchored
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the [src.name] to the floor.", \
|
||||
"You hear ratchet")
|
||||
else
|
||||
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
|
||||
"You unsecure the [src.name] from the floor.", \
|
||||
"You hear ratchet")
|
||||
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?
|
||||
if(istype(X, /obj/machinery/containment_field) || istype(X, /obj/machinery/shieldwall))
|
||||
checkpointC ++
|
||||
return checkpointC >= 20
|
||||
@@ -0,0 +1,269 @@
|
||||
var/global/list/uneatable = list(
|
||||
/obj/machinery/singularity,
|
||||
/turf/space,/obj/effects,
|
||||
/obj/overlay)
|
||||
|
||||
/obj/machinery/singularity/
|
||||
name = "Gravitational Singularity"
|
||||
desc = "A Gravitational Singularity."
|
||||
icon = '160x160.dmi'
|
||||
icon_state = "Singularity"
|
||||
anchored = 1
|
||||
density = 1
|
||||
layer = 6
|
||||
unacidable = 1 //Don't comment this out.
|
||||
power_usage = 0
|
||||
var
|
||||
active = 0
|
||||
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_track = 0
|
||||
dissipate_strength = 10 //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?
|
||||
event_chance = 15 //Prob for event each tick
|
||||
|
||||
|
||||
New(loc, var/starting_energy = 200, var/temp = 0)
|
||||
src.energy = starting_energy
|
||||
pixel_x = -64
|
||||
pixel_y = -64
|
||||
if(temp)
|
||||
spawn(temp)
|
||||
del(src)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
Del()
|
||||
//Could have it do something bad when this happens, explode/implode or something
|
||||
..()
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
consume(user)
|
||||
return 1
|
||||
|
||||
|
||||
blob_act(severity)
|
||||
return
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(prob(10))
|
||||
del(src)
|
||||
return
|
||||
if(2.0 to 3.0)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
Bump(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
Bumped(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
eat()
|
||||
dissipate()
|
||||
check_energy()
|
||||
move()
|
||||
if(prob(event_chance))//Chance for it to run a special event
|
||||
event()
|
||||
pulse()
|
||||
return
|
||||
|
||||
proc
|
||||
dissipate()
|
||||
if(!dissipate)
|
||||
return
|
||||
if(dissipate_track >= dissipate_delay)
|
||||
src.energy -= dissipate_strength
|
||||
dissipate_track = 0
|
||||
else
|
||||
dissipate_track++
|
||||
|
||||
|
||||
check_energy()
|
||||
if(energy <= 0)
|
||||
del(src)
|
||||
return 0
|
||||
switch(energy)
|
||||
if(1000 to 1999)
|
||||
for(var/obj/machinery/field_generator/F in orange(5,src))
|
||||
F.turn_off()
|
||||
emp_area()
|
||||
toxmob()
|
||||
if(2000 to INFINITY)
|
||||
explosion(src.loc, 4, 8, 15, 0)
|
||||
if(src)
|
||||
del(src)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
is_eatable(atom/X)
|
||||
for (var/Type in uneatable)
|
||||
if (istype(X, Type))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
eat()
|
||||
for (var/atom/X in orange(grav_pull,src))
|
||||
if(isarea(X))
|
||||
continue
|
||||
if (!is_eatable(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)
|
||||
return
|
||||
|
||||
|
||||
consume(var/atom/A)
|
||||
var/gain = 0
|
||||
if (!is_eatable(A))
|
||||
return
|
||||
if (istype(A,/mob/living))//Mobs get gibbed
|
||||
gain = 20
|
||||
if(istype(A,/mob/living/carbon/human))
|
||||
if(A:mind)
|
||||
if((A:mind:assigned_role == "Station Engineer") || (A:mind:assigned_role == "Chief Engineer") )
|
||||
gain = 100
|
||||
A:gib()
|
||||
else if(istype(A,/obj/))
|
||||
A:ex_act(1.0)
|
||||
if(A) del(A)
|
||||
gain = 2
|
||||
else if(isturf(A))
|
||||
var/turf/T = A
|
||||
if(T.intact)
|
||||
for(var/obj/O in T.contents)
|
||||
if(O.level != 1)
|
||||
continue
|
||||
if(O.invisibility == 101)
|
||||
src.consume(O)
|
||||
A:ReplaceWithSpace()
|
||||
gain = 2
|
||||
src.energy += gain
|
||||
return
|
||||
|
||||
|
||||
move(var/movement_dir = 0)
|
||||
if(!movement_dir == 1 || !movement_dir == 2 || !movement_dir == 4 || !movement_dir == 8)
|
||||
movement_dir = pick(NORTH, SOUTH, EAST, WEST)
|
||||
var/turf/T = null
|
||||
switch(movement_dir)
|
||||
if(NORTH)
|
||||
T = locate(src.x,src.y+3,src.z)
|
||||
if(SOUTH)
|
||||
T = locate(src.x,src.y-3,src.z)
|
||||
if(EAST)
|
||||
T =locate(src.x+3,src.y,src.z)
|
||||
if(WEST)
|
||||
T = locate(src.x-3,src.y,src.z)
|
||||
if(can_move(T))
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
|
||||
|
||||
can_move(var/turf/T)
|
||||
if(!T)
|
||||
return 0
|
||||
if(locate(/obj/machinery/containment_field) 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
|
||||
return 1
|
||||
|
||||
|
||||
event()
|
||||
var/numb = pick(1,2,3,4,5,6)
|
||||
switch(numb)
|
||||
if(1)//EMP
|
||||
emp_area()
|
||||
if(2,3)//tox damage all carbon mobs in area
|
||||
toxmob()
|
||||
if(4)//Stun mobs who lack optic scanners
|
||||
mezzer()
|
||||
else
|
||||
//do nothing
|
||||
return
|
||||
|
||||
|
||||
toxmob()
|
||||
var/toxrange = 8
|
||||
if (src.energy>100)
|
||||
toxrange+=round((src.energy-100)/100)
|
||||
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)
|
||||
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
|
||||
toxloss = round(toxloss/2,1)
|
||||
radiation = round(radiation/2,1)
|
||||
M.toxloss += toxloss
|
||||
M.radiation += radiation
|
||||
M.updatehealth()
|
||||
M << "\red You feel odd."
|
||||
return
|
||||
|
||||
|
||||
mezzer()
|
||||
for(var/mob/living/carbon/M in oviewers(8, src))
|
||||
if(istype(M,/mob/living/carbon/human))
|
||||
if(istype(M:glasses,/obj/item/clothing/glasses/meson))
|
||||
M << "\blue You look directly into The [src.name], good thing you had your protective eyewear on!"
|
||||
return
|
||||
M << "\red You look directly into The [src.name] and feel weak."
|
||||
if (M:stunned < 3)
|
||||
M.stunned = 3
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("\red <B>[] stares blankly at The []!</B>", M, src), 1)
|
||||
return
|
||||
|
||||
|
||||
emp_area()
|
||||
var/turf/myturf = get_turf(src)
|
||||
var/obj/overlay/pulse = new/obj/overlay ( myturf )
|
||||
pulse.icon = 'effects.dmi'
|
||||
pulse.icon_state = "emppulse"
|
||||
pulse.name = "emp pulse"
|
||||
pulse.anchored = 1
|
||||
spawn(20)
|
||||
del(pulse)
|
||||
for (var/atom/X in orange(8,src))
|
||||
X.emp_act()
|
||||
return
|
||||
|
||||
|
||||
pulse()
|
||||
for(var/obj/machinery/power/rad_collector/R in orange(15,src))
|
||||
if(istype(R,/obj/machinery/power/rad_collector))
|
||||
R.receive_pulse(energy)
|
||||
return
|
||||
@@ -1,6 +1,37 @@
|
||||
// the SMES
|
||||
// stores power
|
||||
|
||||
#define SMESMAXCHARGELEVEL 200000
|
||||
#define SMESMAXOUTPUT 200000
|
||||
|
||||
/obj/machinery/power/smes/magical
|
||||
name = "magical power storage unit"
|
||||
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
|
||||
process()
|
||||
capacity = INFINITY
|
||||
charge = INFINITY
|
||||
..()
|
||||
|
||||
/obj/machinery/power/smes
|
||||
name = "power storage unit"
|
||||
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit."
|
||||
icon_state = "smes"
|
||||
density = 1
|
||||
anchored = 1
|
||||
var/output = 50000
|
||||
var/lastout = 0
|
||||
var/loaddemand = 0
|
||||
var/capacity = 5e6
|
||||
var/charge = 1e6
|
||||
var/charging = 0
|
||||
var/chargemode = 0
|
||||
var/chargecount = 0
|
||||
var/chargelevel = 50000
|
||||
var/online = 1
|
||||
var/n_tag = null
|
||||
var/obj/machinery/power/terminal/terminal = null
|
||||
|
||||
|
||||
/obj/machinery/power/smes/New()
|
||||
..()
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
return
|
||||
|
||||
/obj/machinery/power/solar/proc/update_solar_exposure()
|
||||
if(!sun)
|
||||
return
|
||||
if(obscured)
|
||||
sunfrac = 0
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user