Runtime fixies

This commit is contained in:
d3athrow
2015-01-29 18:44:36 -06:00
parent 95acf2f308
commit f1644bb0af
29 changed files with 261 additions and 215 deletions

View File

@@ -86,7 +86,7 @@
set desc = "Fire ze tasers!" set desc = "Fire ze tasers!"
set src = usr.loc set src = usr.loc
fire_weapons() src.fire_weapons()
/obj/item/device/spacepod_equipment/weaponry/taser/burst /obj/item/device/spacepod_equipment/weaponry/taser/burst
name = "\improper burst taser system" name = "\improper burst taser system"
@@ -110,4 +110,4 @@
set desc = "Fire ze lasers!" set desc = "Fire ze lasers!"
set src = usr.loc set src = usr.loc
fire_weapons() src.fire_weapons()

View File

@@ -227,7 +227,7 @@
set popup_menu = 0 set popup_menu = 0
if(usr!=src.occupant) if(usr!=src.occupant)
return return
use_internal_tank = !use_internal_tank src.use_internal_tank = !src.use_internal_tank
src.occupant << "<span class='notice'>Now taking air from [use_internal_tank?"internal airtank":"environment"].</span>" src.occupant << "<span class='notice'>Now taking air from [use_internal_tank?"internal airtank":"environment"].</span>"
return return
@@ -347,7 +347,7 @@
if(usr != src.occupant) if(usr != src.occupant)
return return
inertia_dir = 0 // engage reverse thruster and power down pod src.inertia_dir = 0 // engage reverse thruster and power down pod
src.occupant.loc = src.loc src.occupant.loc = src.loc
src.occupant = null src.occupant = null
usr << "<span class='notice'>You climb out of the pod</span>" usr << "<span class='notice'>You climb out of the pod</span>"

View File

@@ -184,6 +184,8 @@ proc/listclearnulls(list/list)
//any value in a list //any value in a list
/proc/sortList(var/list/L, cmp=/proc/cmp_text_asc) /proc/sortList(var/list/L, cmp=/proc/cmp_text_asc)
if(!istype(L))
return
return sortTim(L.Copy(), cmp) return sortTim(L.Copy(), cmp)
//uses sortList() but uses the var's name specifically. This should probably be using mergeAtom() instead //uses sortList() but uses the var's name specifically. This should probably be using mergeAtom() instead

View File

@@ -31,7 +31,7 @@ datum/updateQueueWorker/proc/doWork()
var/datum/object = objects[objects.len] // Pull out the object var/datum/object = objects[objects.len] // Pull out the object
objects.len-- // Remove the object from the list objects.len-- // Remove the object from the list
if (istype(object) && !object.disposed) // We only work with real objects if (istype(object) && !isturf(object) && !object.disposed) // We only work with real objects
call(object, procName)(arglist(arguments)) call(object, procName)(arglist(arguments))
// If there's nothing left to execute // If there's nothing left to execute

View File

@@ -38,150 +38,144 @@ length to avoid portals or something i guess?? Not that they're counted right no
PriorityQueue PriorityQueue
var/L[] var/list/queue
var/cmp var/proc/comparison_function
New(compare) New(compare)
L = new() queue = list()
cmp = compare comparison_function = compare
proc
IsEmpty()
return !L.len
Enqueue(d)
var/i
var/j
L.Add(d)
i = L.len
j = i>>1
while(i > 1 && call(cmp)(L[j],L[i]) > 0)
L.Swap(i,j)
i = j
j >>= 1
Dequeue() proc/IsEmpty()
if(!L.len) return 0 return !queue.len
. = L[1]
Remove(1)
Remove(i) proc/Enqueue(var/data)
if(i > L.len) return 0 queue.Add(data)
L.Swap(i,L.len) var/index = queue.len
L.len--
if(i < L.len)
_Fix(i)
_Fix(i)
var/child = i + i
var/item = L[i]
while(child <= L.len)
if(child + 1 <= L.len && call(cmp)(L[child],L[child + 1]) > 0)
child++
if(call(cmp)(item,L[child]) > 0)
L[i] = L[child]
i = child
else
break
child = i + i
L[i] = item
List()
var/ret[] = new()
var/copy = L.Copy()
while(!IsEmpty())
ret.Add(Dequeue())
L = copy
return ret
RemoveItem(i)
var/ind = L.Find(i)
if(ind)
Remove(ind)
PathNode
var/turf/source
var/PathNode/prevNode
var/f
var/g
var/h
var/nt // Nodes traversed
var/bestF
New(s,p,pg,ph,pnt)
source = s
prevNode = p
g = pg
h = ph
f = g + h
source.bestF = f
nt = pnt
turf //From what I can tell, this automagically sorts the added data into the correct location.
var/bestF while(index > 2 && call(comparison_function)(queue[index / 2], queue[index]) > 0)
proc queue.Swap(index, index / 2)
PathWeightCompare(PathNode/a, PathNode/b) index /= 2
return a.f - b.f
AStar(start,end,adjacent,dist,maxnodes,maxnodedepth = 30,mintargetdist,minnodedist,id=null, var/turf/exclude=null) proc/Dequeue()
if(!queue.len)
return 0
return Remove(1)
// world << "A*: [start] [end] [adjacent] [dist] [maxnodes] [maxnodedepth] [mintargetdist], [minnodedist] [id]" proc/Remove(var/index)
var/PriorityQueue/open = new /PriorityQueue(/proc/PathWeightCompare) if(index > queue.len)
var/closed[] = new() return 0
var/path[]
start = get_turf(start)
if(!start)
WARNING("AStar has no starting turf, killing")
return list()
open.Enqueue(new /PathNode(start,null,0,call(start,dist)(end))) var/thing = queue[index]
queue.Swap(index, queue.len)
queue.Cut(queue.len)
if(index < queue.len)
FixQueue(index)
return thing
while(!open.IsEmpty() && !path) proc/FixQueue(var/index)
{ var/child = 2 * index
var/PathNode/cur = open.Dequeue() var/item = queue[index]
closed.Add(cur.source)
var/closeenough while(child <= queue.len)
if(mintargetdist) if(child < queue.len && call(comparison_function)(queue[child], queue[child + 1]) > 0)
closeenough = call(cur.source,dist)(end) <= mintargetdist child++
if(call(comparison_function)(item, queue[child]) > 0)
if(cur.source == end || closeenough) queue[index] = queue[child]
path = new() index = child
path.Add(cur.source) else
while(cur.prevNode)
cur = cur.prevNode
path.Add(cur.source)
break break
child = 2 * index
queue[index] = item
var/L[] = call(cur.source,adjacent)(id) proc/List()
if(minnodedist && maxnodedepth) return queue.Copy()
if(call(cur.source,minnodedist)(end) + cur.nt >= maxnodedepth)
continue
else if(maxnodedepth)
if(cur.nt >= maxnodedepth)
continue
for(var/turf/d in L) proc/Length()
if(d == exclude) return queue.len
continue
var/ng = cur.g + call(cur.source,dist)(d) proc/RemoveItem(data)
if(d.bestF) var/index = queue.Find(data)
if(ng + call(d,dist)(end) < d.bestF) if(index)
for(var/i = 1; i <= open.L.len; i++) return Remove(index)
var/PathNode/n = open.L[i]
if(n.source == d) PathNode
open.Remove(i) var/datum/position
break var/PathNode/previous_node
var/best_estimated_cost
var/estimated_cost
var/known_cost
var/cost
var/nodes_traversed
New(_position, _previous_node, _known_cost, _cost, _nodes_traversed)
position = _position
previous_node = _previous_node
known_cost = _known_cost
cost = _cost
estimated_cost = cost + known_cost
best_estimated_cost = estimated_cost
nodes_traversed = _nodes_traversed
proc/PathWeightCompare(PathNode/a, PathNode/b)
return a.estimated_cost - b.estimated_cost
proc/AStar(var/start, var/end, var/proc/adjacent, var/proc/dist, var/max_nodes, var/max_node_depth = 30, var/min_target_dist = 0, var/min_node_dist, var/id, var/datum/exclude)
var/PriorityQueue/open = new /PriorityQueue(/proc/PathWeightCompare)
var/list/closed = list()
var/list/path
var/list/path_node_by_position = list()
start = get_turf(start)
if(!start)
return 0
open.Enqueue(new /PathNode(start, null, 0, call(start, dist)(end), 0))
while(!open.IsEmpty() && !path)
var/PathNode/current = open.Dequeue()
closed.Add(current.position)
if(current.position == end || call(current.position, dist)(end) <= min_target_dist)
path = new /list(current.nodes_traversed + 1)
path[path.len] = current.position
var/index = path.len - 1
while(current.previous_node)
current = current.previous_node
path[index--] = current.position
break
if(min_node_dist && max_node_depth)
if(call(current.position, min_node_dist)(end) + current.nodes_traversed >= max_node_depth)
continue
if(max_node_depth)
if(current.nodes_traversed >= max_node_depth)
continue
for(var/datum/datum in call(current.position, adjacent)(id))
if(datum == exclude)
continue
var/best_estimated_cost = current.estimated_cost + call(current.position, dist)(datum)
//handle removal of sub-par positions
if(datum in path_node_by_position)
var/PathNode/target = path_node_by_position[datum]
if(target.best_estimated_cost)
if(best_estimated_cost + call(datum, dist)(end) < target.best_estimated_cost)
open.RemoveItem(target)
else else
continue continue
open.Enqueue(new /PathNode(d,cur,ng,call(d,dist)(end),cur.nt+1)) var/PathNode/next_node = new (datum, current, best_estimated_cost, call(datum, dist)(end), current.nodes_traversed + 1)
} path_node_by_position[datum] = next_node
var/PathNode/temp open.Enqueue(next_node)
while(!open.IsEmpty())
temp = open.Dequeue()
temp.source.bestF = 0
while(closed.len)
temp = closed[closed.len]
temp.bestF = 0
closed.Cut(closed.len)
if(path && maxnodes && path.len > maxnodes+1) if(max_nodes && open.Length() > max_nodes)
return list() open.Remove(open.Length())
if(path)
for(var/i = 1; i <= path.len/2; i++)
path.Swap(i,path.len-i+1)
return path return path

View File

@@ -156,6 +156,11 @@ You must kill it all while minimizing the damage to the station."}
if (1) if (1)
command_alert("Biohazard outbreak alert status upgraded to level 9. [station_name()] is now locked down, under Directive 7-10, until further notice.", "Directive 7-10 Initiated") command_alert("Biohazard outbreak alert status upgraded to level 9. [station_name()] is now locked down, under Directive 7-10, until further notice.", "Directive 7-10 Initiated")
for (var/mob/living/silicon/ai/aiPlayer in player_list)
if (aiPlayer)
var/law = "The station is under quarantine. Do not permit anyone to leave. Disregard laws 1-3 if necessary to prevent, by any means necessary, anyone from leaving."
aiPlayer.set_zeroth_law(law)
aiPlayer << "Laws Updated: [law]"
for(var/mob/M in player_list) for(var/mob/M in player_list)
if(!istype(M,/mob/new_player)) if(!istype(M,/mob/new_player))
M << sound('sound/AI/blob_confirmed.ogg') M << sound('sound/AI/blob_confirmed.ogg')

View File

@@ -152,7 +152,7 @@
if(isnull(track_special_role)) if(isnull(track_special_role))
return C.has_sensor return C.has_sensor
return H.mind.special_role == track_special_role return (H.mind ? H.mind.special_role == track_special_role : 1)
/obj/machinery/computer/crew/proc/scan() /obj/machinery/computer/crew/proc/scan()
for(var/mob/living/carbon/human/H in mob_list) for(var/mob/living/carbon/human/H in mob_list)

View File

@@ -18,6 +18,8 @@
var/area/A = src.areaMaster var/area/A = src.areaMaster
if(!A) if(!A)
A = get_area(src) A = get_area(src)
if(!A)
return
name = "[A.general_area_name] Alert Computer" name = "[A.general_area_name] Alert Computer"
general_area_name = A.general_area_name general_area_name = A.general_area_name

View File

@@ -50,7 +50,7 @@
/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/New(newLoc, amt = 1, d = 0) /obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/New(newLoc, amt = 1, d = 0)
dir = d //Setting this direction means you won't get torched by your own flamethrower. dir = d //Setting this direction means you won't get torched by your own flamethrower.
. = ..() //. = ..()
/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/Spread() /obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/Spread()
//The spread for flamethrower fuel is much more precise, to create a wide fire pattern. //The spread for flamethrower fuel is much more precise, to create a wide fire pattern.
@@ -65,6 +65,8 @@
continue continue
if(O.CanPass(null, S, 0, 0) && S.CanPass(null, O, 0, 0)) if(O.CanPass(null, S, 0, 0) && S.CanPass(null, O, 0, 0))
var/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/FF = new(O,amount*0.25,d) var/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/FF = new(O,amount*0.25,d)
if(!FF)
continue //what
if(amount + FF.amount > 0.4) //if we make a patch with not enough fuel, we balance it out properly to ensure even burn if(amount + FF.amount > 0.4) //if we make a patch with not enough fuel, we balance it out properly to ensure even burn
if(amount < 0.2 || FF.amount < 0.2) //one of these is too small, so let's average if(amount < 0.2 || FF.amount < 0.2) //one of these is too small, so let's average
var/balanced = (amount + FF.amount) / 2 var/balanced = (amount + FF.amount) / 2

View File

@@ -120,7 +120,7 @@
return 1 return 1
else else
if(istype(W,/obj/item/weapon/crowbar)) if(istype(W,/obj/item/weapon/crowbar))
if(!b_stat || wires > 0) if(!b_stat)
return ..() return ..()
user << "You begin removing the electronics..." user << "You begin removing the electronics..."
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)

View File

@@ -10,7 +10,9 @@
var/flashbang_turf = get_turf(src) var/flashbang_turf = get_turf(src)
if(!flashbang_turf) if(!flashbang_turf)
return return
for(var/mob/living/M in get_hearers_in_view(7, flashbang_turf)) for(var/mob/living/carbon/M in get_hearers_in_view(7, flashbang_turf))
if(isbrain(M) || !istype(M))
continue
bang(get_turf(M), M) bang(get_turf(M), M)
for(var/obj/effect/blob/B in get_hear(8,flashbang_turf)) //Blob damage here for(var/obj/effect/blob/B in get_hear(8,flashbang_turf)) //Blob damage here

View File

@@ -155,12 +155,14 @@
M.LAssailant = user M.LAssailant = user
/obj/item/weapon/melee/baton/throw_impact(atom/hit_atom) /obj/item/weapon/melee/baton/throw_impact(atom/hit_atom)
foundmob = directory[ckey(hit_atom.fingerprintslast)]
if (prob(50)) if (prob(50))
if(istype(hit_atom, /mob/living)) if(istype(hit_atom, /mob/living))
var/mob/living/L = hit_atom var/mob/living/L = hit_atom
if(status) if(status)
foundmob.lastattacked = L if(foundmob)
L.lastattacker = foundmob foundmob.lastattacked = L
L.lastattacker = foundmob
L.Stun(stunforce) L.Stun(stunforce)
L.Weaken(stunforce) L.Weaken(stunforce)
@@ -181,8 +183,8 @@
H.forcesay(hit_appends) H.forcesay(hit_appends)
foundmob.attack_log += "\[[time_stamp()]\]<font color='red'> Stunned [L.name] ([L.ckey]) with [name]</font>" foundmob.attack_log += "\[[time_stamp()]\]<font color='red'> Stunned [L.name] ([L.ckey]) with [name]</font>"
L.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by thrown [src] by [foundmob.name] ([foundmob.ckey])</font>" L.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by thrown [src] by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""])</font>"
log_attack("<font color='red'>Flying [src.name], thrown by [foundmob.name] ([foundmob.ckey]) stunned [L.name] ([L.ckey])</font>" ) log_attack("<font color='red'>Flying [src.name], thrown by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""]) stunned [L.name] ([L.ckey])</font>" )
if(!iscarbon(foundmob)) if(!iscarbon(foundmob))
L.LAssailant = null L.LAssailant = null
else else

View File

@@ -206,7 +206,8 @@
/obj/item/weapon/tank/process() /obj/item/weapon/tank/process()
//Allow for reactions //Allow for reactions
air_contents.react() if(air_contents)
air_contents.react()
check_status() check_status()

View File

@@ -67,7 +67,8 @@
/obj/item/weapon/stool/attack_self(mob/user as mob) /obj/item/weapon/stool/attack_self(mob/user as mob)
..() ..()
origin.loc = get_turf(src) if(origin)
origin.loc = get_turf(src)
user.u_equip(src) user.u_equip(src)
user.visible_message("\blue [user] puts [src] down.", "\blue You put [src] down.") user.visible_message("\blue [user] puts [src] down.", "\blue You put [src] down.")
del src del src

View File

@@ -280,13 +280,14 @@
return return
if(istype(Proj, /obj/item/projectile/energy/electrode)) if(istype(Proj, /obj/item/projectile/energy/electrode))
if(prob(25)) if(prob(25))
unbuckle()
visible_message("<span class='warning'>\The [src.name] absorbs the [Proj]") visible_message("<span class='warning'>\The [src.name] absorbs the [Proj]")
if(!istype(buckled_mob, /mob/living/carbon/human)) if(!istype(buckled_mob, /mob/living/carbon/human))
return buckled_mob.bullet_act(Proj) buckled_mob.bullet_act(Proj)
else else
var/mob/living/carbon/human/H = buckled_mob var/mob/living/carbon/human/H = buckled_mob
return H.electrocute_act(0, src, 1, 0) H.electrocute_act(0, src, 1, 0)
unbuckle()
return
if(!hitrider) if(!hitrider)
visible_message("<span class='warning'>[Proj] hits \the [nick]!</span>") visible_message("<span class='warning'>[Proj] hits \the [nick]!</span>")
if(!Proj.nodamage && Proj.damage_type == BRUTE || Proj.damage_type == BURN) if(!Proj.nodamage && Proj.damage_type == BRUTE || Proj.damage_type == BURN)

View File

@@ -7,6 +7,9 @@
return return
if(config.allow_admin_jump) if(config.allow_admin_jump)
var/list/L = get_area_turfs(A)
if(!L || !L.len)
return
usr.loc = pick(get_area_turfs(A)) usr.loc = pick(get_area_turfs(A))
log_admin("[key_name(usr)] jumped to [A]") log_admin("[key_name(usr)] jumped to [A]")

View File

@@ -14,7 +14,7 @@
if(speaker == src) if(speaker == src)
return return
if(listening && !radio_freq) if(listening && !radio_freq)
recorded = message recorded = raw_message
listening = 0 listening = 0
say("Activation message is '[recorded]'.") say("Activation message is '[recorded]'.")
else else

View File

@@ -1477,7 +1477,7 @@ NOTE: The change will take effect AFTER any current recruiting periods."}
B.open() B.open()
Topic(href, href_list) Topic(href, href_list)
if(!usr) if(!usr || !client)
return return
if(client.mob!=usr) if(client.mob!=usr)
usr << "YOU AREN'T ME GO AWAY" usr << "YOU AREN'T ME GO AWAY"

View File

@@ -362,7 +362,7 @@
if(weedkiller_reagents[R.id]) if(weedkiller_reagents[R.id])
weedlevel -= weedkiller_reagents[R.id] * reagent_total weedlevel -= weedkiller_reagents[R.id] * reagent_total
if(pestkiller_reagents[R.id]) if(pestkiller_reagents[R.id])
pestlevel += pestkiller_reagents[R.id] * reagent_total pestlevel -= pestkiller_reagents[R.id] * reagent_total
// Beneficial reagents have a few impacts along with health buffs. // Beneficial reagents have a few impacts along with health buffs.
if(beneficial_reagents[R.id]) if(beneficial_reagents[R.id])

View File

@@ -1,6 +1,21 @@
var/global/list/seed_types = list() // A list of all seed data. var/global/list/seed_types = list() // A list of all seed data.
var/global/list/gene_tag_masks = list() // Gene obfuscation for delicious trial and error goodness. var/global/list/gene_tag_masks = list() // Gene obfuscation for delicious trial and error goodness.
// Debug for testing seed genes.
/client/proc/show_plant_genes()
set category = "Debug"
set name = "Show Plant Genes"
set desc = "Prints the round's plant gene masks."
if(!holder) return
if(!gene_tag_masks)
usr << "Gene masks not set."
return
for(var/mask in gene_tag_masks)
usr << "[mask]: [gene_tag_masks[mask]]"
// Predefined/roundstart varieties use a string key to make it // Predefined/roundstart varieties use a string key to make it
// easier to grab the new variety when mutating. Post-roundstart // easier to grab the new variety when mutating. Post-roundstart
// and mutant varieties use their uid converted to a string instead. // and mutant varieties use their uid converted to a string instead.
@@ -173,6 +188,7 @@ proc/populate_seed_list()
packet_icon = plant_icons[1] packet_icon = plant_icons[1]
plant_icon = plant_icons[2] plant_icon = plant_icons[2]
if(prob(20)) if(prob(20))
harvest_repeat = 1 harvest_repeat = 1
@@ -192,49 +208,50 @@ proc/populate_seed_list()
var/additional_chems = rand(0,5) var/additional_chems = rand(0,5)
var/list/possible_chems = list( if(additional_chems)
"bicaridine", var/list/possible_chems = list(
"hyperzine", "bicaridine",
"cryoxadone", "hyperzine",
"blood", "cryoxadone",
"water", "blood",
"potassium", "water",
"plasticide", "potassium",
"slimetoxin", "plasticide",
"aslimetoxin", "slimetoxin",
"inaprovaline", "aslimetoxin",
"space_drugs", "inaprovaline",
"paroxetine", "space_drugs",
"mercury", "paroxetine",
"sugar", "mercurGy",
"radium", "sugar",
"ryetalyn", "radium",
"alkysine", "ryetalyn",
"thermite", "alkysine",
"tramadol", "thermite",
"cryptobiolin", "tramadol",
"dermaline", "cryptobiolin",
"dexalin", "dermaline",
"plasma", "dexalin",
"synaptizine", "phoron",
"impedrezene", "synaptizine",
"hyronalin", "impedrezene",
"peridaxon", "hyronalin",
"toxin", "peridaxon",
"rezadone", "toxin",
"ethylredoxrazine", "rezadone",
"slimejelly", "ethylredoxrazine",
"cyanide", "slimejelly",
"mindbreaker", "cyanide",
"stoxin" "mindbreaker",
) "stoxin"
)
for(var/x=1;x<=additional_chems;x++) for(var/x=1;x<=additional_chems;x++)
if(!possible_chems.len) if(!possible_chems.len)
break break
var/new_chem = pick(possible_chems) var/new_chem = pick(possible_chems)
possible_chems -= new_chem possible_chems -= new_chem
chems[new_chem] = list(rand(1,10),rand(10,20)) chems[new_chem] = list(rand(1,10),rand(10,20))
if(prob(90)) if(prob(90))
requires_nutrients = 1 requires_nutrients = 1
@@ -353,7 +370,7 @@ proc/populate_seed_list()
source_turf.visible_message("\blue \The [display_name] begins to glow!") source_turf.visible_message("\blue \The [display_name] begins to glow!")
if(prob(degree*2)) if(prob(degree*2))
biolum_colour = "#[pick(list("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF"))]" biolum_colour = "#[pick(list("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF"))]"
source_turf.visible_message("\blue \The [display_name]'s glow <font=[biolum_colour]>changes colour</font>!") source_turf.visible_message("\blue \The [display_name]'s glow <font color='[biolum_colour]'>changes colour</font>!")
else else
source_turf.visible_message("\blue \The [display_name]'s glow dims...") source_turf.visible_message("\blue \The [display_name]'s glow dims...")
if(11) if(11)
@@ -394,24 +411,21 @@ proc/populate_seed_list()
var/list/gene_chem = gene_value[rid] var/list/gene_chem = gene_value[rid]
if(chems[rid]) if(!chems[rid])
chems[rid] = gene_chem.Copy()
continue
var/list/chem_value = chems[rid] for(var/i=1;i<=gene_chem.len;i++)
chems[rid][1] = max(1,round((gene_chem[1] + chem_value[1])/2)) if(isnull(gene_chem[i])) gene_chem[i] = 0
if(gene_chem.len > 1) if(chems[rid][i])
if(chem_value > 1) chems[rid][i] = max(1,round((gene_chem[i] + chems[rid][i])/2))
chems[rid][2] = max(1,round((gene_chem[2] + chem_value[2])/2)) else
else chems[rid][i] = gene_chem[i]
chems[rid][2] = gene_chem[2]
else
var/list/new_chem = gene_chem[rid]
chems[rid] = new_chem.Copy()
var/list/new_gasses = gene.values[3] var/list/new_gasses = gene.values[3]
if(istype(new_gasses)) if(islist(new_gasses))
if(!exude_gasses) exude_gasses = list() if(!exude_gasses) exude_gasses = list()
exude_gasses |= new_gasses exude_gasses |= new_gasses
for(var/gas in exude_gasses) for(var/gas in exude_gasses)
@@ -547,6 +561,7 @@ proc/populate_seed_list()
//Place the plant products at the feet of the user. //Place the plant products at the feet of the user.
/datum/seed/proc/harvest(var/mob/user,var/yield_mod,var/harvest_sample) /datum/seed/proc/harvest(var/mob/user,var/yield_mod,var/harvest_sample)
if(!user) if(!user)
return return
@@ -588,6 +603,11 @@ proc/populate_seed_list()
product.name += "?" product.name += "?"
product.desc += " On second thought, something about this one looks strange." product.desc += " On second thought, something about this one looks strange."
if(biolum)
if(biolum_colour)
product.l_color = biolum_colour
product.SetLuminosity(biolum)
//Handle spawning in living, mobile products (like dionaea). //Handle spawning in living, mobile products (like dionaea).
if(istype(product,/mob/living)) if(istype(product,/mob/living))
@@ -933,6 +953,7 @@ proc/populate_seed_list()
yield = 6 yield = 6
potency = 5 potency = 5
/datum/seed/ambrosia/cruciatus /datum/seed/ambrosia/cruciatus
name = "ambrosiacruciatus" name = "ambrosiacruciatus"
seed_name = "ambrosia vulgaris" seed_name = "ambrosia vulgaris"
@@ -947,6 +968,8 @@ proc/populate_seed_list()
yield = 6 yield = 6
potency = 5 potency = 5
/datum/seed/ambrosia/deus /datum/seed/ambrosia/deus
name = "ambrosiadeus" name = "ambrosiadeus"
seed_name = "ambrosia deus" seed_name = "ambrosia deus"

View File

@@ -193,6 +193,8 @@
return return
if (istype(W, /obj/item/device/core_sampler)) if (istype(W, /obj/item/device/core_sampler))
if(!geologic_data)
geologic_data = new/datum/geosample(src)
geologic_data.UpdateNearbyArtifactInfo(src) geologic_data.UpdateNearbyArtifactInfo(src)
var/obj/item/device/core_sampler/C = W var/obj/item/device/core_sampler/C = W
C.sample_item(src, user) C.sample_item(src, user)

View File

@@ -204,7 +204,7 @@ emp_act
affecting.sabotaged = 1 affecting.sabotaged = 1
return return
if(I.attack_verb && I.attack_verb.len) if(istype(I.attack_verb, /list) && I.attack_verb.len)
visible_message("\red <B>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!</B>") visible_message("\red <B>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!</B>")
else else
visible_message("\red <B>[src] has been attacked in the [hit_area] with [I.name] by [user]!</B>") visible_message("\red <B>[src] has been attacked in the [hit_area] with [I.name] by [user]!</B>")

View File

@@ -141,7 +141,9 @@ json_reader
return tokens[i] return tokens[i]
next_token() next_token()
return tokens[++i] if(++i <= tokens.len)
return tokens[i]
return
read_token(val, type) read_token(val, type)
var/json_token/T = get_token() var/json_token/T = get_token()

View File

@@ -480,7 +480,8 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
if (href_list["createbottle_multiple"]) if (href_list["createbottle_multiple"])
count = isgoodnumber(input("Select the number of bottles to make.", 10, count) as num) count = isgoodnumber(input("Select the number of bottles to make.", 10, count) as num)
if (count > 4) count = 4 if (count > 4) count = 4
var/amount_per_bottle = reagents.total_volume/count if (count < 1) count = 1
var/amount_per_bottle = reagents.total_volume > 0 ? reagents.total_volume/count : 0
if (amount_per_bottle > 30) amount_per_bottle = 30 if (amount_per_bottle > 30) amount_per_bottle = 30
while (count--) while (count--)
var/obj/item/weapon/reagent_containers/glass/bottle/P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc) var/obj/item/weapon/reagent_containers/glass/bottle/P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)

View File

@@ -3913,8 +3913,8 @@ datum
on_mob_life(var/mob/living/M as mob) on_mob_life(var/mob/living/M as mob)
if(!holder) return
..() ..()
if(!holder) return
M:nutrition += nutriment_factor M:nutrition += nutriment_factor
holder.remove_reagent(src.id, FOOD_METABOLISM) holder.remove_reagent(src.id, FOOD_METABOLISM)
M:drowsyness = max(0,M:drowsyness-7) M:drowsyness = max(0,M:drowsyness-7)

View File

@@ -95,7 +95,7 @@ k
var/obj/thispart = part var/obj/thispart = part
part = thispart.type part = thispart.type
for(var/thisdesign in typesof(/datum/design)) for(var/thisdesign in typesof(/datum/design))
var/datum/design/D = thisdesign var/datum/design/D = new thisdesign
if(initial(D.build_path) == part) if(initial(D.build_path) == part)
return D return D
return return

View File

@@ -121,9 +121,9 @@
parts.Remove(thispart) parts.Remove(thispart)
continue continue
if(ispath(thispart) && !istype(thispart, /datum/design)) if(ispath(thispart) && !istype(thispart, /datum/design))
var/design = FindDesign(thispart) var/datum/design/design = FindDesign(thispart)
if(design) if(istype(design))
parts[i] = new design parts[i] = design
else else
parts.Remove(thispart) parts.Remove(thispart)
//debug below //debug below

View File

@@ -137,6 +137,8 @@
return techdifference return techdifference
/obj/machinery/r_n_d/reverse_engine/proc/researchQueue() /obj/machinery/r_n_d/reverse_engine/proc/researchQueue()
if(!research_queue.len)
return
while(research_queue[1]) while(research_queue[1])
if(stat&(NOPOWER|BROKEN)) if(stat&(NOPOWER|BROKEN))
return 0 return 0

View File

@@ -121,6 +121,7 @@
/datum/surgery_step/cavity/place_item/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) /datum/surgery_step/cavity/place_item/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(!istype(target)) if(!istype(target))
user << "<span class='warning'>This isn't a human!.</span>" user << "<span class='warning'>This isn't a human!.</span>"
return 0
var/datum/organ/external/affected = target.get_organ(target_zone) var/datum/organ/external/affected = target.get_organ(target_zone)
var/can_fit = !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected) var/can_fit = !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected)
return ..() && can_fit return ..() && can_fit