Merge branch 'master' of https://github.com/PolarisSS13/Polaris into steals_more_armor

This commit is contained in:
Anewbe
2018-02-21 23:33:17 -06:00
134 changed files with 3176 additions and 1889 deletions
+181 -3
View File
@@ -10,6 +10,8 @@
var/next_fuel_consumption = 0 // world.time of when next item in fuel list gets eatten to sustain the fire.
var/grill = FALSE
var/material/material
var/set_temperature = T0C + 30 //K
var/heating_power = 80000
/obj/structure/bonfire/New(newloc, material_name)
..(newloc)
@@ -186,9 +188,9 @@
if(burning)
var/state
switch(get_fuel_amount())
if(0 to 4)
if(0 to 4.5)
state = "bonfire_warm"
if(5 to 10)
if(4.6 to 10)
state = "bonfire_hot"
var/image/I = image(icon, state)
I.appearance_flags = RESET_COLOR
@@ -223,6 +225,23 @@
if(!grill)
burn()
if(burning)
var/W = get_fuel_amount()
if(W >= 5)
var/datum/gas_mixture/env = loc.return_air()
if(env && abs(env.temperature - set_temperature) > 0.1)
var/transfer_moles = 0.25 * env.total_moles
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_transfer = removed.get_thermal_energy_change(set_temperature)
if(heat_transfer > 0)
heat_transfer = min(heat_transfer , heating_power)
removed.add_thermal_energy(heat_transfer)
env.merge(removed)
/obj/structure/bonfire/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
ignite()
@@ -235,4 +254,163 @@
M.pixel_y += 13
else // Just unbuckled someone
M.pixel_y -= 13
update_icon()
update_icon()
/obj/structure/fireplace //more like a space heater than a bonfire. A cozier alternative to both.
name = "fireplace"
desc = "The sound of the crackling hearth reminds you of home."
icon = 'icons/obj/structures.dmi'
icon_state = "fireplace"
density = TRUE
anchored = TRUE
var/burning = FALSE
var/next_fuel_consumption = 0
var/set_temperature = T0C + 20 //K
var/heating_power = 40000
/obj/structure/fireplace/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/stack/material/wood) || istype(W, /obj/item/stack/material/log) )
add_fuel(W, user)
else if(W.is_hot())
ignite()
else
return ..()
/obj/structure/fireplace/attack_hand(mob/user)
if(get_fuel_amount())
remove_fuel(user)
/obj/structure/fireplace/proc/get_fuel_amount()
var/F = 0
for(var/A in contents)
if(istype(A, /obj/item/stack/material/wood))
F += 0.5
if(istype(A, /obj/item/stack/material/log))
F += 1.0
return F
/obj/structure/fireplace/proc/remove_fuel(mob/user)
if(get_fuel_amount())
var/atom/movable/AM = pop(contents)
AM.forceMove(get_turf(src))
to_chat(user, "<span class='notice'>You take \the [AM] out of \the [src] before it has a chance to burn away.</span>")
update_icon()
/obj/structure/fireplace/proc/add_fuel(atom/movable/new_fuel, mob/user)
if(get_fuel_amount() >= 10)
to_chat(user, "<span class='warning'>\The [src] already has enough fuel!</span>")
return FALSE
if(istype(new_fuel, /obj/item/stack/material/wood) || istype(new_fuel, /obj/item/stack/material/log) )
var/obj/item/stack/F = new_fuel
var/obj/item/stack/S = F.split(1)
if(S)
S.forceMove(src)
to_chat(user, "<span class='warning'>You add \the [new_fuel] to \the [src].</span>")
update_icon()
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>\The [src] needs raw wood to burn, \a [new_fuel] won't work.</span>")
return FALSE
/obj/structure/fireplace/proc/consume_fuel(var/obj/item/stack/consumed_fuel)
if(!istype(consumed_fuel))
qdel(consumed_fuel) // Don't know, don't care.
return FALSE
if(istype(consumed_fuel, /obj/item/stack/material/log))
next_fuel_consumption = world.time + 2 MINUTES
qdel(consumed_fuel)
update_icon()
return TRUE
else if(istype(consumed_fuel, /obj/item/stack/material/wood)) // One log makes two planks of wood.
next_fuel_consumption = world.time + 1 MINUTE
qdel(consumed_fuel)
update_icon()
return TRUE
return FALSE
/obj/structure/fireplace/proc/check_oxygen()
var/datum/gas_mixture/G = loc.return_air()
if(G.gas["oxygen"] < 1)
return FALSE
return TRUE
/obj/structure/fireplace/proc/extinguish()
if(burning)
burning = FALSE
update_icon()
processing_objects -= src
visible_message("<span class='notice'>\The [src] stops burning.</span>")
/obj/structure/fireplace/proc/ignite()
if(!burning && get_fuel_amount())
burning = TRUE
update_icon()
processing_objects += src
visible_message("<span class='warning'>\The [src] starts burning!</span>")
/obj/structure/fireplace/proc/burn()
var/turf/current_location = get_turf(src)
current_location.hotspot_expose(1000, 500)
for(var/A in current_location)
if(A == src)
continue
if(isobj(A))
var/obj/O = A
O.fire_act(null, 1000, 500)
/obj/structure/fireplace/update_icon()
overlays.Cut()
if(burning)
var/state
switch(get_fuel_amount())
if(0 to 3.5)
state = "fireplace_warm"
if(3.6 to 6.5)
state = "fireplace_hot"
if(6.6 to 10)
state = "fireplace_intense" //don't need to throw a corpse inside to make it burn hotter.
var/image/I = image(icon, state)
I.appearance_flags = RESET_COLOR
overlays += I
var/light_strength = max(get_fuel_amount() / 2, 2)
set_light(light_strength, light_strength, "#FF9933")
else
set_light(0)
/obj/structure/fireplace/process()
if(!check_oxygen())
extinguish()
return
if(world.time >= next_fuel_consumption)
if(!consume_fuel(pop(contents)))
extinguish()
return
if(burning)
var/W = get_fuel_amount()
if(W >= 5)
var/datum/gas_mixture/env = loc.return_air()
if(env && abs(env.temperature - set_temperature) > 0.1)
var/transfer_moles = 0.25 * env.total_moles
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_transfer = removed.get_thermal_energy_change(set_temperature)
if(heat_transfer > 0)
heat_transfer = min(heat_transfer , heating_power)
removed.add_thermal_energy(heat_transfer)
env.merge(removed)
/obj/structure/fireplace/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
ignite()
/obj/structure/fireplace/water_act(amount)
if(prob(amount * 10))
extinguish()
@@ -85,7 +85,7 @@
new /obj/item/weapon/storage/backpack/industrial(src)
else
new /obj/item/weapon/storage/backpack/satchel/eng(src)
new /obj/item/device/radio/headset/headset_cargo(src)
new /obj/item/device/radio/headset/headset_mine(src)
new /obj/item/clothing/under/rank/miner(src)
new /obj/item/clothing/gloves/black(src)
new /obj/item/clothing/shoes/black(src)
@@ -18,6 +18,10 @@
return ..()
if(is_stump)
if(istype(W,/obj/item/weapon/shovel))
if(do_after(user, 5 SECONDS))
visible_message("<span class='notice'>\The [user] digs up \the [src] stump with \the [W].</span>")
qdel(src)
return
visible_message("<span class='danger'>\The [user] hits \the [src] with \the [W]!</span>")
+105
View File
@@ -0,0 +1,105 @@
/obj/machinery/holoplant
name = "holoplant"
desc = "One of those Ward-Takahashi holoplants! Give your space a bit of the comfort of being outdoors, by buying this blue buddy. A rugged case guarantees that your flower will outlive you, and variety of plant types won't let you to get bored along the way!"
icon = 'icons/obj/holoplants.dmi'
icon_state = "holopot"
light_color = "#3C94C5"
anchored = TRUE
idle_power_usage = 0
active_power_usage = 5
var/interference = FALSE
var/icon/plant = null
var/global/list/possible_plants = list(
"plant-1",
"plant-10",
"plant-09",
"plant-15",
"plant-13"
)
/obj/machinery/holoplant/initialize()
. = ..()
activate()
/obj/machinery/holoplant/attack_hand(var/mob/living/user)
if(!istype(user) || interference)
return
if(!anchored)
to_chat(user,"<span class='warning'>\The [src] must be anchored before activation!</span>")
return
if(!plant)
activate()
else
deactivate()
/obj/machinery/holoplant/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(default_unfasten_wrench(user, O, 10))
deactivate()
return
. = ..()
/obj/machinery/holoplant/proc/activate()
if(!anchored || stat & (NOPOWER|BROKEN))
return
plant = prepare_icon(emagged ? "emagged" : null)
overlays += plant
set_light(2)
use_power = 2
/obj/machinery/holoplant/proc/deactivate()
overlays -= plant
qdel_null(plant)
set_light(0)
use_power = 0
/obj/machinery/holoplant/power_change()
..()
if(stat & NOPOWER)
deactivate()
else
activate()
/obj/machinery/holoplant/proc/flicker()
interference = TRUE
spawn(0)
overlays -= plant
set_light(0)
sleep(rand(2,4))
overlays += plant
set_light(2)
sleep(rand(2,4))
overlays -= plant
set_light(0)
sleep(rand(2,4))
overlays += plant
set_light(2)
interference = FALSE
/obj/machinery/holoplant/proc/prepare_icon(var/state)
if(!state)
state = pick(possible_plants)
var/plant_icon = icon(icon, state)
return getHologramIcon(plant_icon, 0)
/obj/machinery/holoplant/emag_act()
if(emagged)
return
emagged = TRUE
if(plant)
deactivate()
activate()
/obj/machinery/holoplant/Crossed(var/mob/living/L)
if(!interference && plant && istype(L))
flicker()
/obj/machinery/holoplant/shipped
anchored = FALSE
/obj/machinery/holoplant/shipped/initialize()
. = ..()
+54
View File
@@ -294,6 +294,21 @@
if(is_fulltile())
mats.amount = 4
qdel(src)
else if(iscoil(W) && reinf && state == 0 && !istype(src, /obj/structure/window/reinforced/polarized))
var/obj/item/stack/cable_coil/C = W
if (C.use(1))
playsound(src.loc, 'sound/effects/sparks1.ogg', 75, 1)
user.visible_message( \
"<span class='notice'>\The [user] begins to wire \the [src] for electrochromic tinting.</span>", \
"<span class='notice'>You begin to wire \the [src] for electrochromic tinting.</span>", \
"You hear sparks.")
if(do_after(user, 20 * C.toolspeed, src) && state == 0)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
var/obj/structure/window/reinforced/polarized/P = new(loc, dir)
P.health = health
P.state = state
P.anchored = anchored
qdel(src)
else if(istype(W,/obj/item/frame) && anchored)
var/obj/item/frame/F = W
F.try_build(src)
@@ -551,6 +566,28 @@
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
var/id
/obj/structure/window/reinforced/polarized/full
dir = SOUTHWEST
icon_state = "fwindow"
maxhealth = 80
/obj/structure/window/reinforced/polarized/attackby(obj/item/W as obj, mob/user as mob)
if(ismultitool(W) && !anchored) // Only allow programming if unanchored!
var/obj/item/device/multitool/MT = W
// First check if they have a windowtint button buffered
if(istype(MT.connectable, /obj/machinery/button/windowtint))
var/obj/machinery/button/windowtint/buffered_button = MT.connectable
src.id = buffered_button.id
to_chat(user, "<span class='notice'>\The [src] is linked to \the [buffered_button].</span>")
return TRUE
// Otherwise fall back to asking them
var/t = sanitizeSafe(input(user, "Enter the ID for the window.", src.name, null), MAX_NAME_LEN)
if (!t && user.get_active_hand() != W && in_range(src, user))
src.id = t
to_chat(user, "<span class='notice'>The new ID of \the [src] is [id]</span>")
return TRUE
. = ..()
/obj/structure/window/reinforced/polarized/proc/toggle()
if(opacity)
animate(src, color="#FFFFFF", time=5)
@@ -593,3 +630,20 @@
/obj/machinery/button/windowtint/update_icon()
icon_state = "light[active]"
/obj/machinery/button/windowtint/attackby(obj/item/W as obj, mob/user as mob)
if(ismultitool(W))
var/obj/item/device/multitool/MT = W
if(!id)
// If no ID is set yet (newly built button?) let them select an ID for first-time use!
var/t = sanitizeSafe(input(user, "Enter an ID for \the [src].", src.name, null), MAX_NAME_LEN)
if (t && user.get_active_hand() != W && in_range(src, user))
src.id = t
to_chat(user, "<span class='notice'>The new ID of \the [src] is [id]</span>")
if(id)
// It already has an ID (or they just set one), buffer it for copying to windows.
to_chat(user, "<span class='notice'>You store \the [src] in \the [MT]'s buffer!</span>")
MT.connectable = src
MT.update_icon()
return TRUE
. = ..()