Spray bottles now use a "stream" mode toggled by clicking the bottle.

The stream mode launches a chem puff that does not react with objects or turfs on its trajectory, it only reacts with standing mobs in its way, the puff doesn't go through the mob and is immediately deleted after reacting, or with the things on the last tile it can reach.
This mode is the initial mode for the nukeops chemsprayer (but the mode can still be toggled if you want to spray things on many tiles). Also the chemsprayer always spray 10 units per use now, and its range in spray mode is reduced to 4 tiles (so player aren't confused by the puff doing nothing when they aim very far and the amount transfered to each tile encountered is very low(amount is divided by range))
Fixes the chem puff appearing behind mobs it passes through.
This commit is contained in:
phil235
2016-02-18 20:55:40 +01:00
parent 3c8652e346
commit eaef2e842a
2 changed files with 43 additions and 23 deletions
+2 -1
View File
@@ -14,4 +14,5 @@
/obj/effect/decal/chempuff
name = "chemicals"
icon = 'icons/obj/chempuff.dmi'
pass_flags = PASSTABLE | PASSGRILLE
pass_flags = PASSTABLE | PASSGRILLE
layer = 5
@@ -10,8 +10,11 @@
w_class = 2
throw_speed = 3
throw_range = 7
var/spray_maxrange = 3 //what the sprayer will set spray_currentrange to in the attack_self.
var/spray_currentrange = 3 //the range of tiles the sprayer will reach when in fixed mode.
var/stream_mode = 0 //whether we use the more focused mode
var/current_range = 3 //the range of tiles the sprayer will reach.
var/spray_range = 3 //the range of tiles the sprayer will reach when in spray mode.
var/stream_range = 1 //the range of tiles the sprayer will reach when in stream mode.
var/stream_amount = 10 //the amount of reagents transfered when in stream mode.
amount_per_transfer_from_this = 5
volume = 250
possible_transfer_amounts = list()
@@ -61,16 +64,21 @@
/obj/item/weapon/reagent_containers/spray/proc/spray(atom/A)
var/range = max(min(spray_currentrange, get_dist(src, A)), 1)
var/range = max(min(spray_range, get_dist(src, A)), 1)
var/obj/effect/decal/chempuff/D = new /obj/effect/decal/chempuff(get_turf(src))
D.create_reagents(amount_per_transfer_from_this)
reagents.trans_to(D, amount_per_transfer_from_this, 1/range)
D.color = mix_color_from_reagents(D.reagents.reagent_list)
var/puff_reagent_left = range //how many turf, mob or dense objet we can react with before we consider the chem puff consumed
if(stream_mode)
reagents.trans_to(D, amount_per_transfer_from_this)
puff_reagent_left = 1
else
reagents.trans_to(D, amount_per_transfer_from_this, 1/range)
D.color = mix_color_from_reagents(D.reagents.reagent_list)
var/wait_step = max(round(2+3/range), 2)
spawn(0)
var/range_left = range
for(var/i=0, i<range, i++)
range_left--
step_towards(D,A)
sleep(wait_step)
@@ -79,11 +87,21 @@
continue
if(puff_reagent_left <= 0)
break
D.reagents.reaction(T, VAPOR)
if(ismob(T)) //mobs are obstacles that consume part of the puff, shortening its range.
puff_reagent_left -= 1
if(puff_reagent_left > 0)
if(stream_mode)
if(ismob(T))
var/mob/M = T
if(!M.lying || !range_left)
D.reagents.reaction(M, VAPOR)
puff_reagent_left -= 1
else if(!range_left)
D.reagents.reaction(T, VAPOR)
else
D.reagents.reaction(T, VAPOR)
if(ismob(T))
puff_reagent_left -= 1
if(puff_reagent_left > 0 && (!stream_mode || !range_left))
D.reagents.reaction(get_turf(D), VAPOR)
puff_reagent_left -= 1
@@ -93,10 +111,14 @@
qdel(D)
/obj/item/weapon/reagent_containers/spray/attack_self(mob/user)
amount_per_transfer_from_this = (amount_per_transfer_from_this == 10 ? 5 : 10)
spray_currentrange = (spray_currentrange == 1 ? spray_maxrange : 1)
user << "<span class='notice'>You [amount_per_transfer_from_this == 10 ? "remove" : "fix"] the nozzle. You'll now use [amount_per_transfer_from_this] units per spray.</span>"
stream_mode = !stream_mode
if(stream_mode)
amount_per_transfer_from_this = stream_amount
current_range = stream_range
else
amount_per_transfer_from_this = initial(amount_per_transfer_from_this)
current_range = spray_range
user << "<span class='notice'>You switch the nozzle setting to [stream_mode ? "\"stream\"":"\"spray\""]. You'll now use [amount_per_transfer_from_this] units per use.</span>"
/obj/item/weapon/reagent_containers/spray/verb/empty()
@@ -126,7 +148,7 @@
icon_state = "pepperspray"
item_state = "pepperspray"
volume = 40
spray_maxrange = 4
stream_range = 4
amount_per_transfer_from_this = 5
list_reagents = list("condensedcapsaicin" = 40)
@@ -153,8 +175,10 @@
item_state = "chemsprayer"
throwforce = 0
w_class = 3
spray_maxrange = 7
spray_currentrange = 7
stream_mode = 1
current_range = 7
spray_range = 4
stream_range = 7
amount_per_transfer_from_this = 10
volume = 600
origin_tech = "combat=3;materials=3;engineering=3"
@@ -172,11 +196,6 @@
return
..(the_targets[i])
/obj/item/weapon/reagent_containers/spray/chemsprayer/attack_self(mob/user)
amount_per_transfer_from_this = (amount_per_transfer_from_this == 10 ? 5 : 10)
user << "<span class='notice'>You adjust the output switch. You'll now use [amount_per_transfer_from_this] units per spray.</span>"
/obj/item/weapon/reagent_containers/spray/chemsprayer/bioterror
list_reagents = list("sodium_thiopental" = 100, "coniine" = 100, "venom" = 100, "condensedcapsaicin" = 100, "initropidril" = 100, "polonium" = 100)