Merge branch 'dev' into ofChemistryAndStuff

Conflicts:
	code/modules/reagents/Chemistry-Recipes.dm
This commit is contained in:
Kelenius
2015-04-28 19:22:35 +03:00
27 changed files with 398 additions and 143 deletions

View File

@@ -0,0 +1,54 @@
/datum/event/apc_damage
var/apcSelectionRange = 25
/datum/event/apc_damage/start()
var/obj/machinery/power/apc/A = acquire_random_apc()
var/severity_range = 0
switch(severity)
if(EVENT_LEVEL_MUNDANE)
severity_range = 0
if(EVENT_LEVEL_MODERATE)
severity_range = 7
if(EVENT_LEVEL_MAJOR)
severity_range = 15
for(var/obj/machinery/power/apc/apc in range(severity_range,A))
if(is_valid_apc(apc))
apc.emagged = 1
apc.update_icon()
/datum/event/apc_damage/proc/acquire_random_apc()
var/list/possibleEpicentres = list()
var/list/apcs = list()
for(var/obj/effect/landmark/newEpicentre in landmarks_list)
if(newEpicentre.name == "lightsout")
possibleEpicentres += newEpicentre
if(!possibleEpicentres.len)
return
var/epicentre = pick(possibleEpicentres)
for(var/obj/machinery/power/apc/apc in range(epicentre,apcSelectionRange))
if(is_valid_apc(apc))
apcs += apc
// Greatly increase the chance for APCs in maintenance areas to be selected
var/area/A = get_area(apc)
if(istype(A,/area/maintenance))
apcs += apc
apcs += apc
if(!apcs.len)
return
return pick(apcs)
/datum/event/apc_damage/proc/is_valid_apc(var/obj/machinery/power/apc/apc)
// Type must be exactly a basic APC.
// This generally prevents affecting APCs in critical areas (AI core, engine room, etc.) as they often use higher capacity subtypes.
if(apc.type != /obj/machinery/power/apc)
return 0
var/turf/T = get_turf(apc)
return !apc.emagged && T && (T.z in config.player_levels)

View File

@@ -0,0 +1,38 @@
/datum/event/camera_damage/start()
var/obj/machinery/camera/C = acquire_random_camera()
if(!C)
return
var/severity_range = 0
switch(severity)
if(EVENT_LEVEL_MUNDANE)
severity_range = 0
if(EVENT_LEVEL_MODERATE)
severity_range = 7
if(EVENT_LEVEL_MAJOR)
severity_range = 15
for(var/obj/machinery/camera/cam in range(severity_range,C))
if(is_valid_camera(cam))
if(prob(2*severity))
cam.destroy()
else
cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0)
if(prob(5*severity))
cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0)
/datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
if(!cameranet.cameras.len)
return
if(!remaining_attempts)
return
var/obj/machinery/camera/C = pick(cameranet.cameras)
if(is_valid_camera(C))
return C
return acquire_random_camera(remaining_attempts--)
/datum/event/camera_damage/proc/is_valid_camera(var/obj/machinery/camera/C)
// Only return a functional camera, not installed in a silicon, and that exists somewhere players have access
var/turf/T = get_turf(C)
return T && C.can_use() && !istype(C.loc, /mob/living/silicon) && (T.z in config.player_levels)

View File

@@ -12,9 +12,9 @@
A << "<br>"
if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts.
command_announcement.Announce(alert, new_sound = sound('sound/misc/interference.ogg', volume=50))
command_announcement.Announce(alert, new_sound = sound('sound/misc/interference.ogg', volume=25))
/datum/event/communications_blackout/start()
for(var/obj/machinery/telecomms/T in telecomms_list)
T.emp_act(1)
T.emp_act(1)

View File

@@ -25,4 +25,4 @@
for(var/obj/effect/landmark/epicentre in epicentreList)
for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange))
apc.overload_lighting()
apc.overload_lighting()

View File

@@ -127,11 +127,13 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
available_events = list(
// Severity level, event name, even type, base weight, role weights, one shot, min weight, max weight. Last two only used if set and non-zero
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Nothing", /datum/event/nothing, 100),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "APC Damage", /datum/event/apc_damage, 20, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brand Intelligence",/datum/event/brand_intelligence,20, list(ASSIGNMENT_JANITOR = 25), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Damage", /datum/event/camera_damage, 20, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Hacker", /datum/event/money_hacker, 0, list(ASSIGNMENT_ANY = 4), 1, 10, 25),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mundane News", /datum/event/mundane_news, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "PDA Spam", /datum/event/pda_spam, 0, list(ASSIGNMENT_ANY = 4), 0, 25, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Space Dust", /datum/event/dust , 30, list(ASSIGNMENT_ENGINEER = 5), 0, 0, 50),

View File

@@ -0,0 +1,133 @@
/obj/machinery/beehive
name = "beehive"
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "apiary"
density = 1
anchored = 1
var/closed = 0
var/bee_count = 0 // A real hive has 20k - 80k bees... we tone it down
var/smoked = 0
var/honeycombs = 0
var/frames = 0
var/maxFrames = 5
/obj/machinery/beehive/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/weapon/crowbar))
closed = !closed
user.visible_message("<span class='notice'>[user] [closed ? "closes" : "opens"] \the [src].</span>", "<span class='notice'>You [closed ? "close" : "open"] \the [src]")
else if(istype(I, /obj/item/weapon/wrench))
anchored = !anchored
user.visible_message("<span class='notice'>[user] [closed ? "wrenches" : "unwrenches"] \the [src].</span>", "<span class='notice'>You [closed ? "wrench" : "unwrench"] \the [src]")
else if(istype(I, /obj/item/bee_smoker))
if(!closed)
user << "<span class='notice'>You need to open \the [src] with a crowbar before smoking the bees.</span>"
return
user.visible_message("<span class='notice'>[user] smokes the bees in \the [src].</span>", "<span class='notice'>You smoke the bees in \the [src].</span>")
smoked = 30
else if(istype(I, /obj/item/honey_frame))
if(closed)
user << "<span class='notice'>You need to open \the [src] with a crowbar before inserting \the [I].</span>"
return
if(frames >= maxFrames)
user << "<span class='notice'>There is no place for an another frame.</span>"
return
var/obj/item/honey_frame/H = I
if(H.honey)
user << "<span class='notice'>\The [I] is full with beeswax and honey, empty it in the extractor first.</span>"
return
++frames
user.visible_message("<span class='notice'>[user] loads \the [I] into \the [src].</span>", "<span class='notice'>You load \the [I] into \the [src].</span>")
qdel(I)
/obj/machinery/beehive/attack_hand(var/mob/user)
if(!closed)
if(honeycombs < 1)
user << "<span class='notice'>There are no filled honeycombs.</span>"
return
user.visible_message("<span class='notice'>[user] starts taking the honeycombs out of \the [src].", "<span class='notice'>You start taking the honeycombs out of \the [src]...")
while(honeycombs > 1 && do_after(user, 30))
new /obj/item/honey_frame/filled(loc)
--honeycombs
--frames
user << "<span class='notice'>You take all filled honeycombs out.</span>"
/obj/machinery/beehive/process()
if(closed && !smoked)
pollinate_flowers()
smoked = max(0, smoked - 1)
/obj/machinery/beehive/proc/pollinate_flowers()
for(var/obj/machinery/portable_atmospherics/hydroponics/H in view(7, src))
if(H.seed && !H.dead)
H.health += 0.05
honeycombs = max(honeycombs + 0.01, frames) // 100/tray amount ticks per frame, each 20 units of honey
/obj/machinery/honey_extractor
name = "honey extractor"
desc = "A machine used to turn honeycombs on the frame into honey and wax."
icon = 'icons/obj/virology.dmi'
icon_state = "centrifuge"
var/processing = 0
var/honey = 0
/obj/machinery/honey_extractor/attackby(var/obj/item/I, var/mob/user)
if(processing)
user << "<span class='notice'>\The [src] is currently spinning, wait until it's finished.</span>"
return
else if(istype(I, /obj/item/honey_frame))
var/obj/item/honey_frame/H = I
if(!H.honey)
user << "<span class='notice'>\The [H] is empty, put it into a beehive.</span>"
return
user.visible_message("<span class='notice'>[user] loads \the [H] into \the [src] and turns it on.</span>", "<span class='notice'>You load \the [H] into \the [src] and turn it on.</span>")
processing = H.honey
qdel(H)
spawn(50)
new /obj/item/honey_frame(loc)
//new /obj/item/stack/wax(loc)
honey += processing
processing = 0
else if(istype(I, /obj/item/weapon/reagent_containers/glass))
var/obj/item/weapon/reagent_containers/glass/G = I
var/transferred = min(G.reagents.maximum_volume - G.reagents.total_volume, honey)
G.reagents.add_reagent("honey", transferred)
honey -= transferred
user.visible_message("<span class='notice'>[user] collects honey from \the [src] into \the [G].</span>", "<span class='notice'>You collect [transferred] units of honey from \the [src] into the [G].</span>")
return 1
/obj/item/bee_smoker
name = "bee smoker"
desc = "A device used to calm down bees before harvesting honey."
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "apiary"
w_class = 2
/obj/item/honey_frame
name = "beehive frame"
desc = "A frame for the beehive that the bees will fill with honeycombs."
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "apiary"
w_class = 2
var/honey = 0
/obj/item/honey_frame/filled
name = "filled beehive frame"
desc = "A frame for the beehive that the bees have filled with honeycombs."
honey = 20
/obj/item/beehive_assembly
name = "beehive assembly"
desc = "Contains everything you need to build a beehive. Cannot be disassembled once deployed."
icon = 'icons/obj/apiary_bees_etc.dmi'
icon_state = "apiary"
/obj/item/beehive_assembly/attack_self(var/mob/user)
new /obj/machinery/beehive(get_turf(user))
qdel(src)
/obj/item/bee_pack
name = "bee pack"
desc = "A stasis-pack that contains a queen bee and some workers. Put it into the beehive to wake them up."

View File

@@ -231,12 +231,15 @@
S.remove_from_storage(O, src)
O.loc = src
var/newID = 0
for (var/datum/seed_pile/N in piles)
if (N.matches(O))
++N.amount
N.seeds += (O)
return
else if(N.ID >= newID)
newID = N.ID + 1
piles += new /datum/seed_pile(O, piles.len)
piles += new /datum/seed_pile(O, newID)
return

View File

@@ -10,6 +10,10 @@
sleep(1)
for(var/obj/item/I in src)
drop_from_inventory(I)
I.throw_at(get_edge_target_turf(src,pick(alldirs)), rand(1,3), round(30/I.w_class))
..(species.gibbed_anim)
gibs(loc, viruses, dna, null, species.flesh_color, species.blood_color)

View File

@@ -22,6 +22,7 @@
var/info_links //A different version of the paper which includes html links at fields and EOF
var/stamps //The (text for the) stamps on the paper.
var/fields //Amount of user created fields
var/free_space = MAX_PAPER_MESSAGE_LEN
var/list/stamped
var/list/ico[0] //Icons and
var/list/offset_x[0] //offsets stored for later
@@ -51,6 +52,7 @@
spawn(2)
update_icon()
update_space(info)
updateinfolinks()
return
@@ -62,6 +64,12 @@
return
icon_state = "paper"
/obj/item/weapon/paper/proc/update_space(var/new_text)
if(!new_text)
return
free_space -= length(strip_html_properly(new_text, 0))
/obj/item/weapon/paper/examine(mob/user)
..()
if(in_range(user, src) || istype(user, /mob/dead/observer))
@@ -188,6 +196,7 @@
/obj/item/weapon/paper/proc/clearpaper()
info = null
stamps = null
free_space = MAX_PAPER_MESSAGE_LEN
stamped = list()
overlays.Cut()
updateinfolinks()
@@ -327,12 +336,11 @@
var/id = href_list["write"]
//var/t = strip_html_simple(input(usr, "What text do you wish to add to " + (id=="end" ? "the end of the paper" : "field "+id) + "?", "[name]", null),8192) as message
var/textlimit = MAX_PAPER_MESSAGE_LEN - length(info)
if(textlimit <= 0)
if(free_space <= 0)
usr << "<span class='info'>There isn't enough space left on \the [src] to write anything.</span>"
return
var/t = sanitize(input("Enter what you want to write:", "Write", null, null) as message, textlimit, extra = 0)
var/t = strip_html_properly(input("Enter what you want to write:", "Write", null, null) as message)
if(!t)
return
@@ -378,6 +386,8 @@
info += t // Oh, he wants to edit to the end of the file, let him.
updateinfolinks()
update_space(t)
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info_links][stamps]</BODY></HTML>", "window=[name]") // Update the window
update_icon()

View File

@@ -9,7 +9,7 @@
#define LIGHT_BROKEN 2
#define LIGHT_BURNED 3
#define LIGHT_BULB_TEMPERATURE 400 //K - used value for a 60W bulb
/obj/item/light_fixture_frame
name = "light fixture frame"
@@ -487,11 +487,13 @@
var/mob/living/carbon/human/H = user
if(istype(H))
if(H.gloves)
if(H.species.heat_level_1 > LIGHT_BULB_TEMPERATURE)
prot = 1
else if(H.gloves)
var/obj/item/clothing/gloves/G = H.gloves
if(G.max_heat_protection_temperature)
prot = (G.max_heat_protection_temperature > 360)
if(G.max_heat_protection_temperature > LIGHT_BULB_TEMPERATURE)
prot = 1
else
prot = 1

View File

@@ -446,9 +446,8 @@
result_amount = 1
/datum/chemical_reaction/phoronsolidification/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
new /obj/item/stack/sheet/mineral/phoron(location)
return
new /obj/item/stack/sheet/mineral/phoron(get_turf(holder.my_atom), created_volume)
return
/datum/chemical_reaction/plastication
name = "Plastic"
@@ -595,7 +594,7 @@
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
M << "\red The solution spews out foam!"
M << "<span class='warning'>The solution spews out foam!</span>"
var/datum/effect/effect/system/foam_spread/s = new()
s.set_up(created_volume, location, holder, 0)
@@ -614,7 +613,7 @@
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
M << "\red The solution spews out a metalic foam!"
M << "<span class='warning'>The solution spews out a metalic foam!</span>"
var/datum/effect/effect/system/foam_spread/s = new()
s.set_up(created_volume, location, holder, 1)
@@ -632,7 +631,7 @@
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
M << "\red The solution spews out a metalic foam!"
M << "<span class='warning'>The solution spews out a metalic foam!</span>"
var/datum/effect/effect/system/foam_spread/s = new()
s.set_up(created_volume, location, holder, 2)
@@ -1272,7 +1271,8 @@
/datum/chemical_reaction/cheesewheel/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
new /obj/item/weapon/reagent_containers/food/snacks/sliceable/cheesewheel(location)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/weapon/reagent_containers/food/snacks/sliceable/cheesewheel(location)
return
/datum/chemical_reaction/meatball
@@ -1282,8 +1282,10 @@
required_reagents = list("protein" = 3, "flour" = 5)
result_amount = 3
/datum/chemical_reaction/meatball/on_reaction(var/datum/reagents/holder, var/created_volume)
new /obj/item/weapon/reagent_containers/food/snacks/meatball(get_turf(holder.my_atom))
/datum/chemical_reaction/meatball/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/weapon/reagent_containers/food/snacks/meatball(location)
return
/datum/chemical_reaction/dough
@@ -1293,8 +1295,10 @@
required_reagents = list("egg" = 3, "flour" = 10)
result_amount = 1
/datum/chemical_reaction/dough/on_reaction(var/datum/reagents/holder, var/created_volume)
new /obj/item/weapon/reagent_containers/food/snacks/dough(get_turf(holder.my_atom))
/datum/chemical_reaction/dough/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/weapon/reagent_containers/food/snacks/dough(location)
return
/datum/chemical_reaction/syntiflesh
@@ -1306,7 +1310,8 @@
/datum/chemical_reaction/syntiflesh/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
new /obj/item/weapon/reagent_containers/food/snacks/meat/syntiflesh(location)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/weapon/reagent_containers/food/snacks/meat/syntiflesh(location)
return
/datum/chemical_reaction/hot_ramen