Files
Bubberstation/code/game/objects/objs.dm
Cruix ac0bad5d61 Added priority overlay system. (#18225)
Added priority overlays to atoms, which will not be removed when overlays are cut and will always remain on top when new overlays are added. This requires everyone to use add_overlay() and cut_overlays() instead of overlays += and overlays.Cut(). These procs are found in __HELPERS/icons.dm, and the priority overlay list is found in game/atoms.dm. Everything else is replacing deprecated overlay manipulation.
2016-06-17 10:11:53 +12:00

223 lines
5.6 KiB
Plaintext

/obj
languages = HUMAN
var/crit_fail = 0
var/unacidable = 0 //universal "unacidabliness" var, here so you can use it in any obj.
animate_movement = 2
var/throwforce = 0
var/in_use = 0 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
var/damtype = "brute"
var/force = 0
var/burn_state = FIRE_PROOF // LAVA_PROOF | FIRE_PROOF | FLAMMABLE | ON_FIRE
var/burntime = 10 //How long it takes to burn to ashes, in seconds
var/burn_world_time //What world time the object will burn up completely
var/being_shocked = 0
var/on_blueprints = FALSE //Are we visible on the station blueprints at roundstart?
var/force_blueprints = FALSE //forces the obj to be on the blueprints, regardless of when it was created.
/obj/New()
..()
if(on_blueprints && isturf(loc))
var/turf/T = loc
if(force_blueprints)
T.add_blueprints(src)
else
T.add_blueprints_preround(src)
/obj/Destroy()
if(!istype(src, /obj/machinery))
SSobj.processing.Remove(src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists
SStgui.close_uis(src)
return ..()
/obj/assume_air(datum/gas_mixture/giver)
if(loc)
return loc.assume_air(giver)
else
return null
/obj/remove_air(amount)
if(loc)
return loc.remove_air(amount)
else
return null
/obj/return_air()
if(loc)
return loc.return_air()
else
return null
/obj/proc/handle_internal_lifeform(mob/lifeform_inside_me, breath_request)
//Return: (NONSTANDARD)
// null if object handles breathing logic for lifeform
// datum/air_group to tell lifeform to process using that breath return
//DEFAULT: Take air from turf to give to have mob process
if(breath_request>0)
var/datum/gas_mixture/environment = return_air()
var/breath_percentage = BREATH_VOLUME / environment.return_volume()
return remove_air(environment.total_moles() * breath_percentage)
else
return null
/obj/proc/updateUsrDialog()
if(in_use)
var/is_in_use = 0
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = 1
src.attack_hand(M)
if (istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot) || IsAdminGhost(usr))
if (!(usr in nearby))
if (usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
is_in_use = 1
src.attack_ai(usr)
// check for TK users
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(!(usr in nearby))
if(usr.client && usr.machine==src)
if(H.dna.check_mutation(TK))
is_in_use = 1
src.attack_hand(usr)
in_use = is_in_use
/obj/proc/updateDialog()
// Check that people are actually using the machine. If not, don't update anymore.
if(in_use)
var/list/nearby = viewers(1, src)
var/is_in_use = 0
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = 1
src.interact(M)
var/ai_in_use = AutoUpdateAI(src)
if(!ai_in_use && !is_in_use)
in_use = 0
/obj/attack_ghost(mob/user)
if(ui_interact(user) != -1)
return
..()
/obj/proc/container_resist()
return
/obj/proc/update_icon()
return
/mob/proc/unset_machine()
if(machine)
machine.on_unset_machine(src)
machine = null
//called when the user unsets the machine.
/atom/movable/proc/on_unset_machine(mob/user)
return
/mob/proc/set_machine(obj/O)
if(src.machine)
unset_machine()
src.machine = O
if(istype(O))
O.in_use = 1
/obj/item/proc/updateSelfDialog()
var/mob/M = src.loc
if(istype(M) && M.client && M.machine == src)
src.attack_self(M)
/obj/proc/alter_health()
return 1
/obj/proc/hide(h)
return
/obj/ex_act(severity, target)
if(severity == 1 || target == src)
qdel(src)
else if(severity == 2)
if(prob(50))
qdel(src)
if(!qdeleted(src))
..()
//If a mob logouts/logins in side of an object you can use this proc
/obj/proc/on_log()
..()
if(isobj(loc))
var/obj/Loc=loc
Loc.on_log()
/obj/singularity_act()
ex_act(1)
if(src && !qdeleted(src))
qdel(src)
return 2
/obj/singularity_pull(S, current_size)
if(!anchored || current_size >= STAGE_FIVE)
step_towards(src,S)
/obj/proc/Deconstruct()
qdel(src)
/obj/get_spans()
return ..() | SPAN_ROBOT
/obj/storage_contents_dump_act(obj/item/weapon/storage/src_object, mob/user)
var/turf/T = get_turf(src)
return T.storage_contents_dump_act(src_object, user)
/obj/fire_act(global_overlay=1)
if(!burn_state)
burn_state = ON_FIRE
SSobj.burning += src
burn_world_time = world.time + burntime*rand(10,20)
if(global_overlay)
add_overlay(fire_overlay)
return 1
/obj/proc/burn()
empty_object_contents(1, src.loc)
var/obj/effect/decal/cleanable/ash/A = new(src.loc)
A.desc = "Looks like this used to be a [name] some time ago."
SSobj.burning -= src
qdel(src)
/obj/proc/extinguish()
if(burn_state == ON_FIRE)
burn_state = FLAMMABLE
overlays -= fire_overlay
SSobj.burning -= src
/obj/proc/empty_object_contents(burn = 0, new_loc = src.loc)
for(var/obj/item/Item in contents) //Empty out the contents
Item.loc = new_loc
if(burn)
Item.fire_act() //Set them on fire, too
/obj/proc/tesla_act(var/power)
being_shocked = 1
var/power_bounced = power / 2
tesla_zap(src, 3, power_bounced)
addtimer(src, "reset_shocked", 10)
/obj/proc/reset_shocked()
being_shocked = 0
/obj/proc/CanAStarPass()
. = !density