Merge pull request #7672 from Fox-McCloud/syndicate-bomb-refactor

Refactors Syndicate Bombs and Adds Chemical Bombs
This commit is contained in:
tigercat2000
2017-07-04 11:53:55 -07:00
committed by GitHub
14 changed files with 627 additions and 220 deletions
+22 -5
View File
@@ -9,15 +9,19 @@
var/atom/attached_to
color = "#ff0000"
var/text_size = 4
var/started = 0
var/started = FALSE
invisibility = INVISIBILITY_OBSERVER
anchored = 1
layer = 5
anchored = TRUE
layer = GHOST_LAYER
/obj/effect/countdown/New(atom/A)
. = ..()
attach(A)
/obj/effect/countdown/examine(mob/user)
. = ..()
to_chat(user, "This countdown is displaying: [displayed_text]")
/obj/effect/countdown/proc/attach(atom/A)
attached_to = A
loc = get_turf(A)
@@ -25,13 +29,13 @@
/obj/effect/countdown/proc/start()
if(!started)
fast_processing += src
started = 1
started = TRUE
/obj/effect/countdown/proc/stop()
if(started)
maptext = null
fast_processing -= src
started = 0
started = FALSE
/obj/effect/countdown/proc/get_value()
// Get the value from our atom
@@ -56,6 +60,19 @@
fast_processing -= src
return ..()
/obj/effect/countdown/ex_act(severity) //immune to explosions
return
/obj/effect/countdown/syndicatebomb
name = "syndicate bomb countdown"
/obj/effect/countdown/syndicatebomb/get_value()
var/obj/machinery/syndicatebomb/S = attached_to
if(!istype(S))
return
else if(S.active)
return S.seconds_remaining()
/obj/effect/countdown/clonepod
name = "cloning pod countdown"
text_size = 1
+24
View File
@@ -324,6 +324,30 @@
/obj/item/stack/rods = 1)
category = CAT_MISC
/datum/crafting_recipe/chemical_payload
name = "Chemical Payload (C4)"
result = /obj/item/weapon/bombcore/chemical
reqs = list(
/obj/item/weapon/stock_parts/matter_bin = 1,
/obj/item/weapon/grenade/plastic/c4 = 1,
/obj/item/weapon/grenade/chem_grenade = 2
)
parts = list(/obj/item/weapon/stock_parts/matter_bin = 1, /obj/item/weapon/grenade/chem_grenade = 2)
time = 30
category = CAT_WEAPON
/datum/crafting_recipe/chemical_payload2
name = "Chemical Payload (gibtonite)"
result = /obj/item/weapon/bombcore/chemical
reqs = list(
/obj/item/weapon/stock_parts/matter_bin = 1,
/obj/item/weapon/twohanded/required/gibtonite = 1,
/obj/item/weapon/grenade/chem_grenade = 2
)
parts = list(/obj/item/weapon/stock_parts/matter_bin = 1, /obj/item/weapon/grenade/chem_grenade = 2)
time = 50
category = CAT_WEAPON
/datum/crafting_recipe/bonfire
name = "Bonfire"
time = 60
+78
View File
@@ -0,0 +1,78 @@
// Replaces chemgrenade stuff, allowing reagent explosions to be called from anywhere.
// It should be called using a location, the range, and a list of reagents involved.
// Threatscale is a multiplier for the 'threat' of the grenade. If you're increasing the affected range drastically, you might want to improve this.
// Extra heat affects the temperature of the mixture, and may cause it to react in different ways.
/proc/chem_splash(turf/epicenter, affected_range = 3, list/datum/reagents/reactants = list(), extra_heat = 0, threatscale = 1, adminlog = 1)
if(!isturf(epicenter) || !reactants.len || threatscale <= 0)
return
var/has_reagents
var/total_reagents
for(var/datum/reagents/R in reactants)
if(R.total_volume)
has_reagents = 1
total_reagents += R.total_volume
if(!has_reagents)
return
var/datum/reagents/splash_holder = new/datum/reagents(total_reagents*threatscale)
splash_holder.my_atom = epicenter // For some reason this is setting my_atom to null, and causing runtime errors.
var/total_temp = 0
for(var/datum/reagents/R in reactants)
R.trans_to(splash_holder, R.total_volume, threatscale, 1, 1)
total_temp += R.chem_temp
splash_holder.chem_temp = (total_temp/reactants.len) + extra_heat // Average temperature of reagents + extra heat.
splash_holder.handle_reactions() // React them now.
if(splash_holder.total_volume && affected_range >= 0) //The possible reactions didnt use up all reagents, so we spread it around.
var/datum/effect/system/steam_spread/steam = new /datum/effect/system/steam_spread()
steam.set_up(10, 0, epicenter)
steam.attach(epicenter)
steam.start()
var/list/viewable = view(affected_range, epicenter)
var/list/accessible = list(epicenter)
for(var/i=1; i<=affected_range; i++)
var/list/turflist = list()
for(var/turf/T in (orange(i, epicenter) - orange(i-1, epicenter)))
turflist |= T
for(var/turf/T in turflist)
if( !(get_dir(T,epicenter) in cardinal) && (abs(T.x - epicenter.x) == abs(T.y - epicenter.y) ))
turflist.Remove(T)
turflist.Add(T) // we move the purely diagonal turfs to the end of the list.
for(var/turf/T in turflist)
if(accessible[T])
continue
for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE))
var/turf/NT = thing
if(!(NT in accessible))
continue
if(!(get_dir(T,NT) in cardinal))
continue
accessible[T] = 1
break
var/list/reactable = accessible
for(var/turf/T in accessible)
for(var/atom/A in T.GetAllContents())
if(!(A in viewable))
continue
reactable |= A
if(extra_heat >= 300)
T.hotspot_expose(extra_heat*2, 5)
if(!reactable.len) //Nothing to react with. Probably means we're in nullspace.
return
for(var/thing in reactable)
var/atom/A = thing
var/distance = max(1,get_dist(A, epicenter))
var/fraction = 0.5/(2 ** distance) //50/25/12/6... for a 200u splash, 25/12/6/3... for a 100u, 12/6/3/1 for a 50u
splash_holder.reaction(A, TOUCH, fraction)
qdel(splash_holder)
return 1
+10 -7
View File
@@ -108,7 +108,7 @@ var/const/INGEST = 2
return the_id
/datum/reagents/proc/trans_to(target, amount=1, multiplier=1, preserve_data=1)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred.
/datum/reagents/proc/trans_to(target, amount=1, multiplier=1, preserve_data=1, no_react = 0)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred.
if(!target)
return
if(total_volume <= 0)
@@ -143,13 +143,14 @@ var/const/INGEST = 2
if(preserve_data)
trans_data = copy_data(current_reagent)
R.add_reagent(current_reagent.id, (current_reagent_transfer * multiplier), trans_data, chem_temp)
R.add_reagent(current_reagent.id, (current_reagent_transfer * multiplier), trans_data, chem_temp, no_react = 1)
remove_reagent(current_reagent.id, current_reagent_transfer)
update_total()
R.update_total()
R.handle_reactions()
handle_reactions()
if(!no_react)
R.handle_reactions()
handle_reactions()
return amount
/datum/reagents/proc/copy_to(obj/target, amount=1, multiplier=1, preserve_data=1, safety = 0)
@@ -537,7 +538,7 @@ var/const/INGEST = 2
var/amt = list_reagents[r_id]
add_reagent(r_id, amt, data)
/datum/reagents/proc/add_reagent(reagent, amount, list/data=null, reagtemp = 300)
/datum/reagents/proc/add_reagent(reagent, amount, list/data=null, reagtemp = 300, no_react = 0)
if(!isnum(amount))
return 1
update_total()
@@ -554,7 +555,8 @@ var/const/INGEST = 2
update_total()
my_atom.on_reagent_change()
R.on_merge(data)
handle_reactions()
if(!no_react)
handle_reactions()
return 0
var/datum/reagent/D = chemical_reagents_list[reagent]
@@ -570,7 +572,8 @@ var/const/INGEST = 2
update_total()
my_atom.on_reagent_change()
handle_reactions()
if(!no_react)
handle_reactions()
return 0
else
warning("[my_atom] attempted to add a reagent called '[reagent]' which doesn't exist. ([usr])")
@@ -40,7 +40,8 @@
/obj/machinery/biogenerator,
/obj/machinery/hydroponics,
/obj/machinery/constructable_frame,
/obj/machinery/icemachine)
/obj/machinery/icemachine,
/obj/item/weapon/bombcore/chemical)
/obj/item/weapon/reagent_containers/glass/New()
..()
+1 -9
View File
@@ -29,6 +29,7 @@
/obj/structure/reagent_dispensers/proc/boom()
visible_message("<span class='danger'>[src] ruptures!</span>")
chem_splash(loc, 5, list(reagents))
qdel(src)
/obj/structure/reagent_dispensers/ex_act(severity)
@@ -53,15 +54,6 @@
desc = "A water tank."
icon_state = "water"
/obj/structure/reagent_dispensers/watertank/boom()
playsound(loc, 'sound/effects/spray2.ogg', 50, 1, -6)
new /obj/effect/effect/water(loc)
for(var/turf/simulated/T in view(5, loc))
T.MakeSlippery()
for(var/mob/living/L in T)
L.adjust_fire_stacks(-20)
..()
/obj/structure/reagent_dispensers/watertank/high
name = "high-capacity water tank"
desc = "A highly-pressurized water tank made to hold gargantuan amounts of water.."
@@ -80,6 +80,36 @@
build_path = /obj/item/weapon/grenade/chem_grenade/large
category = list("Weapons")
/datum/design/pyro_grenade
name = "Pyro Grenade"
desc = "An advanced grenade that is able to self ignite its mixture."
id = "pyro_Grenade"
req_tech = list("combat" = 4, "engineering" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_PLASMA = 500)
build_path = /obj/item/weapon/grenade/chem_grenade/pyro
category = list("Weapons")
/datum/design/cryo_grenade
name = "Cryo Grenade"
desc = "An advanced grenade that rapidly cools its contents upon detonation."
id = "cryo_Grenade"
req_tech = list("combat" = 3, "materials" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_SILVER = 500)
build_path = /obj/item/weapon/grenade/chem_grenade/cryo
category = list("Weapons")
/datum/design/adv_grenade
name = "Advanced Release Grenade"
desc = "An advanced grenade that can be detonated several times, best used with a repeating igniter."
id = "adv_Grenade"
req_tech = list("combat" = 3, "engineering" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 500)
build_path = /obj/item/weapon/grenade/chem_grenade/adv_release
category = list("Weapons")
/datum/design/tele_shield
name = "Telescopic Riot Shield"
desc = "An advanced riot shield made of lightweight materials that collapses for easy storage."