Adds floor lamp, benches, new tank sprites, and cup dispenser on water coolers.

This commit is contained in:
SinTwo
2016-06-19 22:28:01 -04:00
parent fe7c079747
commit 86e500d25c
12 changed files with 547 additions and 16 deletions

View File

@@ -26,6 +26,8 @@
..()
if (fixture_type == "bulb")
icon_state = "bulb-construct-stage1"
if (fixture_type == "flamp")
icon_state = "flamp-construct-stage1"
/obj/machinery/light_construct/examine(mob/user)
if(!..(user, 2))
@@ -71,6 +73,8 @@
src.icon_state = "tube-construct-stage1"
if("bulb")
src.icon_state = "bulb-construct-stage1"
if("flamp")
src.icon_state = "flamp-construct-stage1"
new /obj/item/stack/cable_coil(get_turf(src.loc), 1, "red")
user.visible_message("[user.name] removes the wiring from [src].", \
"You remove the wiring from [src].", "You hear a noise.")
@@ -86,6 +90,8 @@
src.icon_state = "tube-construct-stage2"
if("bulb")
src.icon_state = "bulb-construct-stage2"
if("flamp")
src.icon_state = "flamp-construct-stage2"
src.stage = 2
user.visible_message("[user.name] adds wires to [src].", \
"You add wires to [src].")
@@ -98,6 +104,8 @@
src.icon_state = "tube-empty"
if("bulb")
src.icon_state = "bulb-empty"
if("flamp")
src.icon_state = "flamp-empty"
src.stage = 3
user.visible_message("[user.name] closes [src]'s casing.", \
"You close [src]'s casing.", "You hear a noise.")
@@ -109,6 +117,8 @@
newlight = new /obj/machinery/light/built(src.loc)
if ("bulb")
newlight = new /obj/machinery/light/small/built(src.loc)
if ("flamp")
newlight = new /obj/machinery/light/flamp/built(src.loc)
newlight.dir = src.dir
src.transfer_fingerprints_to(newlight)
@@ -127,6 +137,17 @@
fixture_type = "bulb"
sheets_refunded = 1
/obj/machinery/light_construct/flamp
name = "floor light fixture frame"
desc = "A floor light fixture under construction."
icon = 'icons/obj/lighting.dmi'
icon_state = "flamp-construct-stage1"
anchored = 0
layer = OBJ_LAYER
stage = 1
fixture_type = "flamp"
sheets_refunded = 2
// the standard tube light fixture
/obj/machinery/light
name = "light fixture"
@@ -141,7 +162,6 @@
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
var/brightness_range = 10 // luminosity when on, also used in power calculation
var/brightness_power = 3
var/brightness_color = null
@@ -166,6 +186,18 @@
desc = "A small lighting fixture."
light_type = /obj/item/weapon/light/bulb
/obj/machinery/light/flamp
icon_state = "flamp1"
base_state = "flamp"
fitting = "bulb"
brightness_range = 5
brightness_power = 2
layer = OBJ_LAYER
brightness_color = "#FFF4E5"
desc = "A floor lamp."
light_type = /obj/item/weapon/light/bulb
var/lamp_shade = 1
/obj/machinery/light/small/emergency
brightness_range = 6
brightness_power = 2
@@ -188,6 +220,12 @@
update(0)
..()
/obj/machinery/light/flamp/built/New()
status = LIGHT_EMPTY
lamp_shade = 0
update(0)
..()
// create a new lighting fixture
/obj/machinery/light/New()
..()
@@ -228,9 +266,29 @@
on = 0
return
/obj/machinery/light/flamp/update_icon()
if(lamp_shade)
base_state = "flampshade"
switch(status) // set icon_states
if(LIGHT_OK)
icon_state = "[base_state][on]"
if(LIGHT_EMPTY)
on = 0
icon_state = "[base_state][on]"
if(LIGHT_BURNED)
on = 0
icon_state = "[base_state][on]"
if(LIGHT_BROKEN)
on = 0
icon_state = "[base_state][on]"
return
else
base_state = "flamp"
..()
// update the icon_state and luminosity of the light depending on its state
/obj/machinery/light/proc/update(var/trigger = 1)
update_icon()
if(on)
if(light_range != brightness_range || light_power != brightness_power || light_color != brightness_color)
@@ -245,7 +303,7 @@
else if( prob( min(60, switchcount*switchcount*0.01) ) )
if(status == LIGHT_OK && trigger)
status = LIGHT_BURNED
icon_state = "[base_state]-burned"
update_icon()
on = 0
set_light(0)
else
@@ -256,8 +314,7 @@
set_light(0)
active_power_usage = light_range * light_power
if(on != on_gs)
on_gs = on
/obj/machinery/light/attack_generic(var/mob/user, var/damage)
if(!damage)
@@ -373,6 +430,11 @@
if("bulb")
newlight = new /obj/machinery/light_construct/small(src.loc)
newlight.icon_state = "bulb-construct-stage2"
if("flamp")
newlight = new /obj/machinery/light_construct/flamp(src.loc)
newlight.icon_state = "flamp-construct-stage2"
newlight.dir = src.dir
newlight.stage = 2
newlight.fingerprints = src.fingerprints
@@ -390,6 +452,25 @@
if (prob(75))
electrocute_mob(user, get_area(src), src, rand(0.7,1.0))
/obj/machinery/light/flamp/attackby(obj/item/W, mob/user)
if(!lamp_shade)
if(istype(W, /obj/item/weapon/lampshade))
lamp_shade = 1
qdel(W)
update_icon()
return
else
if(istype(W, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
user.visible_message("[user.name] removes [src]'s lamp shade.", \
"You remove [src]'s lamp shade.", "You hear a noise.")
lamp_shade = 0
new /obj/item/weapon/lampshade(src.loc)
update_icon()
return
..()
// returns whether this light has power
// true if area has power and lightswitch is on
@@ -397,6 +478,13 @@
var/area/A = get_area(src)
return A && A.lightswitch && (!A.requires_power || A.power_light)
/obj/machinery/light/flamp/has_power()
var/area/A = get_area(src)
if(lamp_shade)
return A && (!A.requires_power || A.power_light)
else
return A && A.lightswitch && (!A.requires_power || A.power_light)
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
if(flickering) return
flickering = 1
@@ -417,6 +505,10 @@
src.flicker(1)
return
/obj/machinery/light/flamp/attack_ai(mob/user)
attack_hand()
return
// attack with hand - remove tube/bulb
// if hands aren't protected and the light is on, burn the player
/obj/machinery/light/attack_hand(mob/user)
@@ -481,6 +573,21 @@
status = LIGHT_EMPTY
update()
/obj/machinery/light/flamp/attack_hand(mob/user)
if(lamp_shade)
if(status == LIGHT_EMPTY)
user << "There is no [fitting] in this light."
return
if(on)
on = 0
update()
else
on = has_power()
update()
else
..()
/obj/machinery/light/attack_tk(mob/user)
if(status == LIGHT_EMPTY)
@@ -708,3 +815,11 @@
sharp = 1
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
update()
//Lamp Shade
/obj/item/weapon/lampshade
name = "lamp shade"
desc = "A lamp shade for a lamp."
icon = 'icons/obj/lighting.dmi'
icon_state = "lampshade"
w_class = 1

View File

@@ -195,6 +195,7 @@
possible_transfer_amounts = null
volume = 10
center_of_mass = list("x"=16, "y"=12)
/obj/item/weapon/reagent_containers/food/drinks/sillycup/New()
..()
@@ -204,6 +205,16 @@
else
icon_state = "water_cup_e"
/obj/item/weapon/reagent_containers/food/drinks/sillycup/MouseDrop(obj/over_object as obj)
if(!reagents.total_volume)
if(istype(over_object, /obj/structure/reagent_dispensers/water_cooler))
var/obj/structure/reagent_dispensers/water_cooler/W = over_object
if(W.cupholder && W.cups < 10)
W.cups++
qdel(src)
W.update_icon()
else
return ..()
//////////////////////////drinkingglass and shaker//
//Note by Darem: This code handles the mixing of drinks. New drinks go in three places: In Chemistry-Reagents.dm (for the drink

View File

@@ -203,13 +203,19 @@
possible_transfer_amounts = null
anchored = 1
var/bottle = 0
var/cups = 0
var/cupholder = 0
/obj/structure/reagent_dispensers/water_cooler/full
bottle = 1
cupholder = 1
cups = 10
/obj/structure/reagent_dispensers/water_cooler/New()
if(bottle == 1)
if(bottle)
..()
reagents.add_reagent("water",120)
else
icon_state = "water_cooler_0"
update_icon()
/obj/structure/reagent_dispensers/water_cooler/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/weapon/wrench))
@@ -224,7 +230,7 @@
G.reagents.add_reagent(R.id, total_reagent)
reagents.clear_reagents()
bottle = 0
icon_state = "water_cooler_0"
update_icon()
else
if(anchored)
user.visible_message("\The [user] begins unsecuring \the [src] from the floor.", "You start unsecuring \the [src] from the floor.")
@@ -237,11 +243,24 @@
return
if(istype(I, /obj/item/weapon/screwdriver))
if(!bottle)
if(cupholder)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
user << "<span class='notice'>You take the water-cooler apart.</span>"
new /obj/item/stack/material/plastic( src.loc, 4 )
qdel(src)
user << "<span class='notice'>You take the cup dispenser off.</span>"
new /obj/item/stack/material/plastic( src.loc )
if(cups)
for(var/i = 0 to cups)
new /obj/item/weapon/reagent_containers/food/drinks/sillycup(src.loc)
cups = 0
cupholder = 0
update_icon()
return
if(!bottle && !cupholder)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
user << "<span class='notice'>You start taking the water-cooler apart.</span>"
if(do_after(user, 20))
user << "<span class='notice'>You take the water-cooler apart.</span>"
new /obj/item/stack/material/plastic( src.loc, 4 )
qdel(src)
return
if(istype(I, /obj/item/weapon/reagent_containers/glass/cooler_bottle))
@@ -252,7 +271,7 @@
user << "<span class='notice'>You start to screw the bottle onto the water-cooler.</span>"
if(do_after(user, 20))
bottle = 1
icon_state = "water_cooler"
update_icon()
user << "<span class='notice'>You screw the bottle onto the water-cooler but accidently spill some!</span>" //you spill some because it for somereason transfers 5 units to the bottle after it gets attached but before it's deleted...
for(var/datum/reagent/R in G.reagents.reagent_list)
var/total_reagent = G.reagents.get_reagent_amount(R.id)
@@ -263,8 +282,46 @@
else
user << "<span class='warning'>There is already a bottle there!</span>"
return
else
return ..()
if(istype(I, /obj/item/stack/material/plastic))
if(!cupholder)
if(anchored)
var/obj/item/stack/material/plastic/P = I
src.add_fingerprint(user)
user << "<span class='notice'>You start to attach a cup dispenser onto the water-cooler.</span>"
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if (P.use(1))
user << "<span class='notice'>You attach a cup dispenser onto the water-cooler.</span>"
cupholder = 1
update_icon()
else
user << "<span class='warning'>You need to wrench down the cooler first.</span>"
else
user << "<span class='warning'>There is already a cup dispenser there!</span>"
return
/obj/structure/reagent_dispensers/water_cooler/attack_hand(mob/user)
if(cups)
new /obj/item/weapon/reagent_containers/food/drinks/sillycup(src.loc)
cups--
update_icon()
return
/obj/structure/reagent_dispensers/water_cooler/update_icon()
icon_state = "water_cooler"
overlays.Cut()
var/image/I
if(bottle)
I = image(icon, "water_cooler_bottle")
overlays += I
if(cupholder)
I = image(icon, "water_cooler_cupholder")
overlays += I
if(cups)
I = image(icon, "water_cooler_cups")
overlays += I
return
/obj/structure/reagent_dispensers/beerkeg
name = "beer keg"

View File

@@ -3,6 +3,9 @@
for(var/obj/structure/table/T in view(src, 1))
T.update_connections()
T.update_icon()
for(var/obj/structure/bench/T in view(src, 1))
T.update_connections()
T.update_icon()
/obj/structure/window/Destroy()
var/oldloc = loc
@@ -10,6 +13,9 @@
for(var/obj/structure/table/T in view(oldloc, 1))
T.update_connections()
T.update_icon()
for(var/obj/structure/bench/T in view(oldloc, 1))
T.update_connections()
T.update_icon()
loc=oldloc
..()
@@ -18,5 +24,8 @@
. = ..()
if(loc != oldloc)
for(var/obj/structure/table/T in view(oldloc, 1) | view(loc, 1))
T.update_connections()
T.update_icon()
for(var/obj/structure/bench/T in view(oldloc, 1) | view(loc, 1))
T.update_connections()
T.update_icon()