mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
stitches together some tg code to make swarmers able to eat stuff I think (#10287)
* Update atoms.dm * add return composition bit * yeah this'll probably work * ok * Update swarmer_act.dm
This commit is contained in:
@@ -64,4 +64,15 @@ Simple datum which is instanced once per type and is used for every object of sa
|
|||||||
|
|
||||||
o.max_integrity = new_max_integrity
|
o.max_integrity = new_max_integrity
|
||||||
o.force = initial(o.force)
|
o.force = initial(o.force)
|
||||||
o.throwforce = initial(o.throwforce)
|
o.throwforce = initial(o.throwforce)
|
||||||
|
|
||||||
|
/** Returns the composition of this material.
|
||||||
|
*
|
||||||
|
* Mostly used for alloys when breaking down materials.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* - amount: The amount of the material to break down.
|
||||||
|
* - breakdown_flags: Some flags dictating how exactly this material is being broken down.
|
||||||
|
*/
|
||||||
|
/datum/material/proc/return_composition(amount=1, breakdown_flags=NONE)
|
||||||
|
return list((src) = amount) // Yes we need the parenthesis, without them BYOND stringifies src into "src" and things break.
|
||||||
|
|||||||
@@ -1116,6 +1116,25 @@
|
|||||||
/atom/proc/intercept_zImpact(atom/movable/AM, levels = 1)
|
/atom/proc/intercept_zImpact(atom/movable/AM, levels = 1)
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
|
/**Returns the material composition of the atom.
|
||||||
|
*
|
||||||
|
* Used when recycling items, specifically to turn alloys back into their component mats.
|
||||||
|
*
|
||||||
|
* Exists because I'd need to add a way to un-alloy alloys or otherwise deal
|
||||||
|
* with people converting the entire stations material supply into alloys.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* - flags: A set of flags determining how exactly the materials are broken down.
|
||||||
|
*/
|
||||||
|
/atom/proc/get_material_composition(breakdown_flags=NONE)
|
||||||
|
. = list()
|
||||||
|
var/list/cached_materials = custom_materials
|
||||||
|
for(var/mat in cached_materials)
|
||||||
|
var/datum/material/material = getmaterialref(mat)
|
||||||
|
var/list/material_comp = material.return_composition(cached_materials[material], breakdown_flags)
|
||||||
|
for(var/comp_mat in material_comp)
|
||||||
|
.[comp_mat] += material_comp[comp_mat]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes effects when the atom gets hit by a rust effect from heretics
|
* Causes effects when the atom gets hit by a rust effect from heretics
|
||||||
*
|
*
|
||||||
@@ -1156,4 +1175,4 @@
|
|||||||
var/datum/material/custom_material = x
|
var/datum/material/custom_material = x
|
||||||
|
|
||||||
custom_material.on_applied(src, materials[custom_material] * multiplier, material_flags)
|
custom_material.on_applied(src, materials[custom_material] * multiplier, material_flags)
|
||||||
custom_materials[custom_material] += materials[x] * multiplier
|
custom_materials[custom_material] += materials[x] * multiplier
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
/obj/item/integrate_amount() //returns the amount of resources gained when eating this item
|
/obj/item/integrate_amount() //returns the amount of resources gained when eating this item
|
||||||
if(materials[/datum/material/iron] || materials[/datum/material/glass])
|
var/list/mats = get_material_composition(ALL) // Ensures that items made from plasteel, and plas/titanium/plastitaniumglass get integrated correctly.
|
||||||
|
if(length(mats) && (mats[getmaterialref(/datum/material/iron)] || mats[getmaterialref(/datum/material/glass)]))
|
||||||
return 1
|
return 1
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
@@ -227,4 +228,4 @@
|
|||||||
|
|
||||||
/obj/machinery/shieldwall/swarmer_act(mob/living/simple_animal/hostile/swarmer/actor)
|
/obj/machinery/shieldwall/swarmer_act(mob/living/simple_animal/hostile/swarmer/actor)
|
||||||
to_chat(actor, "<span class='warning'>This object does not contain solid matter. Aborting.</span>")
|
to_chat(actor, "<span class='warning'>This object does not contain solid matter. Aborting.</span>")
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user