Revert "12/21 modernizations from TG live"
This commit is contained in:
+108
-109
@@ -16,38 +16,34 @@
|
||||
desc = "Used for building lights."
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "tube-construct-item"
|
||||
result_path = /obj/structure/light_construct
|
||||
result_path = /obj/machinery/light_construct
|
||||
inverse = 1
|
||||
|
||||
/obj/item/wallframe/light_fixture/small
|
||||
name = "small light fixture frame"
|
||||
icon_state = "bulb-construct-item"
|
||||
result_path = /obj/structure/light_construct/small
|
||||
result_path = /obj/machinery/light_construct/small
|
||||
materials = list(MAT_METAL=MINERAL_MATERIAL_AMOUNT)
|
||||
|
||||
|
||||
/obj/structure/light_construct
|
||||
/obj/machinery/light_construct
|
||||
name = "light fixture frame"
|
||||
desc = "A light fixture under construction."
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "tube-construct-stage1"
|
||||
anchored = 1
|
||||
layer = WALL_OBJ_LAYER
|
||||
obj_integrity = 200
|
||||
max_integrity = 200
|
||||
armor = list(melee = 50, bullet = 10, laser = 10, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 80, acid = 50)
|
||||
|
||||
var/stage = 1
|
||||
var/fixture_type = "tube"
|
||||
var/sheets_refunded = 2
|
||||
var/obj/machinery/light/newlight = null
|
||||
|
||||
/obj/structure/light_construct/New(loc, ndir, building)
|
||||
/obj/machinery/light_construct/New(loc, ndir, building)
|
||||
..()
|
||||
if(building)
|
||||
setDir(ndir)
|
||||
|
||||
/obj/structure/light_construct/examine(mob/user)
|
||||
/obj/machinery/light_construct/examine(mob/user)
|
||||
..()
|
||||
switch(src.stage)
|
||||
if(1)
|
||||
@@ -57,14 +53,14 @@
|
||||
if(3)
|
||||
user << "The casing is closed."
|
||||
|
||||
/obj/structure/light_construct/attackby(obj/item/weapon/W, mob/user, params)
|
||||
/obj/machinery/light_construct/attackby(obj/item/weapon/W, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
switch(stage)
|
||||
if(1)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
playsound(src.loc, W.usesound, 75, 1)
|
||||
usr << "<span class='notice'>You begin deconstructing [src]...</span>"
|
||||
if (!do_after(usr, 30*W.toolspeed, target = src))
|
||||
if (!do_after(usr, 30/W.toolspeed, target = src))
|
||||
return
|
||||
new /obj/item/stack/sheet/metal( get_turf(src.loc), sheets_refunded )
|
||||
user.visible_message("[user.name] deconstructs [src].", \
|
||||
@@ -120,24 +116,13 @@
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/structure/light_construct/blob_act(obj/structure/blob/B)
|
||||
if(B && B.loc == loc)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/structure/light_construct/deconstruct(disassembled = TRUE)
|
||||
if(!(flags & NODECONSTRUCT))
|
||||
new /obj/item/stack/sheet/metal(loc, sheets_refunded)
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/light_construct/small
|
||||
/obj/machinery/light_construct/small
|
||||
name = "small light fixture frame"
|
||||
icon_state = "bulb-construct-stage1"
|
||||
fixture_type = "bulb"
|
||||
sheets_refunded = 1
|
||||
|
||||
|
||||
|
||||
// the standard tube light fixture
|
||||
/obj/machinery/light
|
||||
name = "light fixture"
|
||||
@@ -147,8 +132,6 @@
|
||||
desc = "A lighting fixture."
|
||||
anchored = 1
|
||||
layer = WALL_OBJ_LAYER
|
||||
obj_integrity = 100
|
||||
max_integrity = 100
|
||||
use_power = 2
|
||||
idle_power_usage = 2
|
||||
active_power_usage = 20
|
||||
@@ -165,6 +148,7 @@
|
||||
// this is used to calc the probability the light burns out
|
||||
|
||||
var/rigged = 0 // true if rigged to explode
|
||||
var/health = 20
|
||||
|
||||
// the smaller bulb light fixture
|
||||
|
||||
@@ -175,12 +159,12 @@
|
||||
brightness = 4
|
||||
desc = "A small lighting fixture."
|
||||
light_type = /obj/item/weapon/light/bulb
|
||||
|
||||
health = 15
|
||||
|
||||
|
||||
/obj/machinery/light/Move()
|
||||
if(status != LIGHT_BROKEN)
|
||||
break_light_tube(1)
|
||||
broken(1)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/light/built/New()
|
||||
@@ -202,11 +186,11 @@
|
||||
if("tube")
|
||||
brightness = 8
|
||||
if(prob(2))
|
||||
break_light_tube(1)
|
||||
broken(1)
|
||||
if("bulb")
|
||||
brightness = 4
|
||||
if(prob(5))
|
||||
break_light_tube(1)
|
||||
broken(1)
|
||||
spawn(1)
|
||||
update(0)
|
||||
|
||||
@@ -238,20 +222,23 @@
|
||||
|
||||
update_icon()
|
||||
if(on)
|
||||
if(!light || light.luminosity != brightness)
|
||||
if(!light || light.light_range != brightness)
|
||||
switchcount++
|
||||
if(rigged)
|
||||
if(status == LIGHT_OK && trigger)
|
||||
explode()
|
||||
else if( prob( min(60, switchcount*switchcount*0.01) ) )
|
||||
if(trigger)
|
||||
burn_out()
|
||||
if(status == LIGHT_OK && trigger)
|
||||
status = LIGHT_BURNED
|
||||
icon_state = "[base_state]-burned"
|
||||
on = 0
|
||||
set_light(0)
|
||||
else
|
||||
use_power = 2
|
||||
SetLuminosity(brightness)
|
||||
set_light(brightness)
|
||||
else
|
||||
use_power = 1
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
active_power_usage = (brightness * 10)
|
||||
if(on != on_gs)
|
||||
@@ -263,13 +250,6 @@
|
||||
removeStaticPower(static_power_used, STATIC_LIGHT)
|
||||
|
||||
|
||||
/obj/machinery/light/proc/burn_out()
|
||||
if(status == LIGHT_OK)
|
||||
status = LIGHT_BURNED
|
||||
icon_state = "[base_state]-burned"
|
||||
on = 0
|
||||
SetLuminosity(0)
|
||||
|
||||
// attempt to set the light's on/off status
|
||||
// will not switch on if broken/burned/empty
|
||||
/obj/machinery/light/proc/seton(s)
|
||||
@@ -331,7 +311,19 @@
|
||||
playsound(src.loc, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] opens [src]'s casing.", \
|
||||
"<span class='notice'>You open [src]'s casing.</span>", "<span class='italics'>You hear a noise.</span>")
|
||||
deconstruct()
|
||||
var/obj/machinery/light_construct/newlight = null
|
||||
switch(fitting)
|
||||
if("tube")
|
||||
newlight = new /obj/machinery/light_construct(src.loc)
|
||||
newlight.icon_state = "tube-construct-stage2"
|
||||
|
||||
if("bulb")
|
||||
newlight = new /obj/machinery/light_construct/small(src.loc)
|
||||
newlight.icon_state = "bulb-construct-stage2"
|
||||
newlight.setDir(src.dir)
|
||||
newlight.stage = 2
|
||||
transfer_fingerprints_to(newlight)
|
||||
qdel(src)
|
||||
else
|
||||
user << "<span class='userdanger'>You stick \the [W] into the light socket!</span>"
|
||||
if(has_power() && (W.flags & CONDUCT))
|
||||
@@ -339,64 +331,36 @@
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
if (prob(75))
|
||||
electrocute_mob(user, get_area(src), src, rand(0.7,1.0), TRUE)
|
||||
electrocute_mob(user, get_area(src), src, rand(0.7,1.0))
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/light/deconstruct(disassembled = TRUE)
|
||||
if(!(flags & NODECONSTRUCT))
|
||||
var/obj/structure/light_construct/newlight = null
|
||||
var/cur_stage = 2
|
||||
if(!disassembled)
|
||||
cur_stage = 1
|
||||
switch(fitting)
|
||||
if("tube")
|
||||
newlight = new /obj/structure/light_construct(src.loc)
|
||||
newlight.icon_state = "tube-construct-stage[cur_stage]"
|
||||
|
||||
if("bulb")
|
||||
newlight = new /obj/structure/light_construct/small(src.loc)
|
||||
newlight.icon_state = "bulb-construct-stage[cur_stage]"
|
||||
newlight.setDir(src.dir)
|
||||
newlight.stage = cur_stage
|
||||
if(!disassembled)
|
||||
newlight.obj_integrity = newlight.max_integrity * 0.5
|
||||
if(status != LIGHT_BROKEN)
|
||||
break_light_tube()
|
||||
if(status != LIGHT_EMPTY)
|
||||
drop_light_tube()
|
||||
new /obj/item/stack/cable_coil(loc, 1, "red")
|
||||
transfer_fingerprints_to(newlight)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/light/attacked_by(obj/item/I, mob/living/user)
|
||||
..()
|
||||
if(status == LIGHT_BROKEN || status == LIGHT_EMPTY)
|
||||
if(on && (I.flags & CONDUCT))
|
||||
if(prob(12))
|
||||
electrocute_mob(user, get_area(src), src, 0.3, TRUE)
|
||||
electrocute_mob(user, get_area(src), src, 0.3)
|
||||
|
||||
/obj/machinery/light/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1)
|
||||
. = ..()
|
||||
if(. && !qdeleted(src))
|
||||
if(prob(damage_amount * 5))
|
||||
break_light_tube()
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/machinery/light/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
/obj/machinery/light/take_damage(damage, damage_type = BRUTE, sound_effect = 1)
|
||||
switch(damage_type)
|
||||
if(BRUTE)
|
||||
switch(status)
|
||||
if(LIGHT_EMPTY)
|
||||
playsound(loc, 'sound/weapons/smash.ogg', 50, 1)
|
||||
if(LIGHT_BROKEN)
|
||||
playsound(loc, 'sound/effects/hit_on_shattered_glass.ogg', 90, 1)
|
||||
else
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 90, 1)
|
||||
if(sound_effect)
|
||||
switch(status)
|
||||
if(LIGHT_EMPTY)
|
||||
playsound(loc, 'sound/weapons/smash.ogg', 50, 1)
|
||||
if(LIGHT_BROKEN)
|
||||
playsound(loc, 'sound/effects/hit_on_shattered_glass.ogg', 90, 1)
|
||||
else
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 90, 1)
|
||||
if(BURN)
|
||||
playsound(src.loc, 'sound/items/Welder.ogg', 100, 1)
|
||||
if(sound_effect)
|
||||
playsound(src.loc, 'sound/items/Welder.ogg', 100, 1)
|
||||
else
|
||||
return
|
||||
health -= damage
|
||||
if(health <= 0)
|
||||
broken()
|
||||
|
||||
|
||||
// returns whether this light has power
|
||||
@@ -425,6 +389,20 @@
|
||||
src.flicker(1)
|
||||
return
|
||||
|
||||
/obj/machinery/light/bullet_act(obj/item/projectile/P)
|
||||
. = ..()
|
||||
take_damage(P.damage, P.damage_type, 0)
|
||||
|
||||
/obj/machinery/light/hitby(AM as mob|obj)
|
||||
..()
|
||||
var/tforce = 0
|
||||
if(ismob(AM))
|
||||
tforce = 40
|
||||
else if(isobj(AM))
|
||||
var/obj/item/I = AM
|
||||
tforce = I.throwforce
|
||||
take_damage(tforce)
|
||||
|
||||
// attack with hand - remove tube/bulb
|
||||
// if hands aren't protected and the light is on, burn the player
|
||||
|
||||
@@ -457,16 +435,14 @@
|
||||
else
|
||||
user << "<span class='warning'>You try to remove the light [fitting], but you burn your hand on it!</span>"
|
||||
|
||||
var/obj/item/bodypart/affecting = H.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm")
|
||||
if(affecting && affecting.receive_damage( 0, 5 )) // 5 burn damage
|
||||
H.update_damage_overlays()
|
||||
var/obj/item/bodypart/affecting = H.get_bodypart("[user.hand ? "l" : "r" ]_arm")
|
||||
if(affecting && affecting.take_damage( 0, 5 )) // 5 burn damage
|
||||
H.update_damage_overlays(0)
|
||||
H.updatehealth()
|
||||
return // if burned, don't remove the light
|
||||
else
|
||||
user << "<span class='notice'>You remove the light [fitting].</span>"
|
||||
// create a light tube/bulb item and put it in the user's hand
|
||||
drop_light_tube(user)
|
||||
|
||||
/obj/machinery/light/proc/drop_light_tube(mob/user)
|
||||
var/obj/item/weapon/light/L = new light_type()
|
||||
L.status = status
|
||||
L.rigged = rigged
|
||||
@@ -477,11 +453,10 @@
|
||||
switchcount = 0
|
||||
|
||||
L.update()
|
||||
L.forceMove(loc)
|
||||
L.add_fingerprint(user)
|
||||
L.loc = loc
|
||||
|
||||
if(user) //puts it in our active hand
|
||||
L.add_fingerprint(user)
|
||||
user.put_in_active_hand(L)
|
||||
user.put_in_active_hand(L) //puts it in our active hand
|
||||
|
||||
status = LIGHT_EMPTY
|
||||
update()
|
||||
@@ -493,13 +468,26 @@
|
||||
|
||||
user << "<span class='notice'>You telekinetically remove the light [fitting].</span>"
|
||||
// create a light tube/bulb item and put it in the user's hand
|
||||
drop_light_tube()
|
||||
var/obj/item/weapon/light/L = new light_type()
|
||||
L.status = status
|
||||
L.rigged = rigged
|
||||
L.brightness = brightness
|
||||
|
||||
// light item inherits the switchcount, then zero it
|
||||
L.switchcount = switchcount
|
||||
switchcount = 0
|
||||
|
||||
L.update()
|
||||
L.add_fingerprint(user)
|
||||
L.loc = loc
|
||||
|
||||
status = LIGHT_EMPTY
|
||||
update()
|
||||
|
||||
// break the light and make sparks if was on
|
||||
|
||||
/obj/machinery/light/proc/break_light_tube(skip_sound_and_sparks = 0)
|
||||
if(status == LIGHT_EMPTY || status == LIGHT_BROKEN)
|
||||
/obj/machinery/light/proc/broken(skip_sound_and_sparks = 0)
|
||||
if(status == LIGHT_EMPTY)
|
||||
return
|
||||
|
||||
if(!skip_sound_and_sparks)
|
||||
@@ -520,10 +508,19 @@
|
||||
on = 1
|
||||
update()
|
||||
|
||||
/obj/machinery/light/tesla_act(power, explosive = FALSE)
|
||||
if(explosive)
|
||||
explosion(src.loc,0,0,0,flame_range = 5, adminlog = 0)
|
||||
qdel(src)
|
||||
// explosion effect
|
||||
// destroy the whole light fixture or just shatter it
|
||||
|
||||
/obj/machinery/light/ex_act(severity, target)
|
||||
..()
|
||||
if(!qdeleted(src))
|
||||
switch(severity)
|
||||
if(2)
|
||||
if(prob(50))
|
||||
broken()
|
||||
if(3)
|
||||
if(prob(25))
|
||||
broken()
|
||||
|
||||
// called when area power state changes
|
||||
/obj/machinery/light/power_change()
|
||||
@@ -535,14 +532,14 @@
|
||||
|
||||
/obj/machinery/light/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
if(prob(max(0, exposed_temperature - 673))) //0% at <400C, 100% at >500C
|
||||
break_light_tube()
|
||||
broken()
|
||||
|
||||
// explode the light
|
||||
|
||||
/obj/machinery/light/proc/explode()
|
||||
set waitfor = 0
|
||||
var/turf/T = get_turf(src.loc)
|
||||
break_light_tube() // break it first to give a warning
|
||||
broken() // break it first to give a warning
|
||||
sleep(2)
|
||||
explosion(T, 0, 0, 2, 2)
|
||||
sleep(1)
|
||||
@@ -556,11 +553,11 @@
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
force = 2
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
w_class = 1
|
||||
var/status = 0 // LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
|
||||
var/base_state
|
||||
var/switchcount = 0 // number of times switched
|
||||
materials = list(MAT_GLASS=100)
|
||||
materials = list(MAT_METAL=60)
|
||||
var/rigged = 0 // true if rigged to explode
|
||||
var/brightness = 2 //how much light it gives off
|
||||
|
||||
@@ -570,6 +567,7 @@
|
||||
icon_state = "ltube"
|
||||
base_state = "ltube"
|
||||
item_state = "c_tube"
|
||||
materials = list(MAT_GLASS=100)
|
||||
brightness = 8
|
||||
|
||||
/obj/item/weapon/light/bulb
|
||||
@@ -578,6 +576,7 @@
|
||||
icon_state = "lbulb"
|
||||
base_state = "lbulb"
|
||||
item_state = "contvapour"
|
||||
materials = list(MAT_GLASS=100)
|
||||
brightness = 4
|
||||
|
||||
/obj/item/weapon/light/throw_impact(atom/hit_atom)
|
||||
|
||||
Reference in New Issue
Block a user