[MIRROR] sane stacks (#11533)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-29 16:12:10 -07:00
committed by GitHub
parent 4797afe137
commit a272557ccd
21 changed files with 45 additions and 27 deletions

View File

@@ -234,9 +234,7 @@
var/recursive = amount == -1 ? 1 : 0
var/datum/material/matdata = get_material_by_name(material_name)
var/stack_type = matdata.stack_type
var/obj/item/stack/material/S = new stack_type(loc)
if(amount <= 0)
amount = S.max_amount
var/obj/item/stack/material/S = new stack_type(loc, -1)
var/ejected = min(round(stored_material[material_name] / S.perunit), amount)
if(!S.set_amount(min(ejected, amount)))
return

View File

@@ -56,9 +56,6 @@
#define MAT_PLASTEELREBAR "plasteel rebar"
#define MAT_GRASS "grass"
#define MAT_RESIN "resin"
#define MAT_CULT "cult"
#define MAT_CULT2 "cult2"
#define MAT_ALIENALLOY "alienalloy"
#define MAT_COMPOSITE "composite"
#define MAT_BIOMASS "biomass"
#define MAT_WEEDEXTRACT "weed extract"
@@ -71,6 +68,17 @@
#define MAT_FOAM "foam"
#define MAT_FLOKIUM "flockium"
#define MAT_SMOLEBRICKS "smolebricks"
#define MAT_WAX "wax"
#define MAT_CULT "cult"
#define MAT_CULT2 "cult2"
// ALien materials
#define MAT_ALIENALLOY "alienalloy"
#define MAT_ALIEN_ALIUM "alium"
#define MAT_ALIEN_BEDROCK "bedrock"
#define MAT_ALIEN_DUNGEON "dungeonium"
#define MAT_ALIEN_ELEVAT "elevatorium"
// cloth materials
#define MAT_WOOL "wool"

View File

@@ -38,6 +38,7 @@
if(craftable)
material = get_material_by_name("[default_type]")
if(!material)
stack_trace("Material of type: [default_type] does not exist.")
return INITIALIZE_HINT_QDEL
if(material) //sanity check
recipes = material.get_recipes()
@@ -76,7 +77,7 @@
singular_name = "grass floor tile"
desc = "A patch of grass like they often use on golf courses."
icon_state = "tile_grass"
default_type = "grass"
default_type = MAT_GRASS
force = 1.0
throwforce = 1.0
throw_speed = 5

View File

@@ -19,6 +19,7 @@
material_name = MAT_WOOD
material = get_material_by_name("[material_name]")
if(!material)
stack_trace("Material of type: [material_name] does not exist.")
return INITIALIZE_HINT_QDEL
color = material.icon_colour

View File

@@ -24,6 +24,7 @@
material_name = MAT_WOOD
material = get_material_by_name("[material_name]")
if(!material)
stack_trace("Material of type: [material_name] does not exist.")
return INITIALIZE_HINT_QDEL
color = material.icon_colour
AddElement(/datum/element/climbable)

View File

@@ -37,7 +37,7 @@
/obj/machinery/door/blast/puzzle/Initialize(mapload)
. = ..()
implicit_material = get_material_by_name("dungeonium")
implicit_material = get_material_by_name(MAT_ALIEN_DUNGEON)
if(locks.len)
return
var/check_range = world.view * checkrange_mult

View File

@@ -30,6 +30,7 @@
new_material = MAT_STEEL
material = get_material_by_name(new_material)
if(!istype(material))
stack_trace("Material of type: [new_material] does not exist.")
return INITIALIZE_HINT_QDEL
if(new_padding_material)
padding_material = get_material_by_name(new_padding_material)

View File

@@ -23,10 +23,11 @@
if(!new_material)
new_material = MAT_STEEL
material = get_material_by_name(new_material)
if(!istype(material))
stack_trace("Material of type: [new_material] does not exist.")
return INITIALIZE_HINT_QDEL
if(new_padding_material)
padding_material = get_material_by_name(new_padding_material)
if(!istype(material))
return INITIALIZE_HINT_QDEL
force = round(material.get_blunt_damage()*0.4)
update_icon()

View File

@@ -4,7 +4,7 @@
block_tele = TRUE // Anti-cheese.
/turf/simulated/wall/dungeon/Initialize(mapload)
. = ..(mapload, "dungeonium")
. = ..(mapload, MAT_ALIEN_DUNGEON)
/turf/simulated/wall/dungeon/attackby()
return
@@ -38,7 +38,7 @@
block_tele = TRUE
/turf/simulated/wall/solidrock/Initialize(mapload)
. = ..(mapload, "bedrock")
. = ..(mapload, MAT_ALIEN_BEDROCK)
/turf/simulated/wall/solidrock/Initialize(mapload)
. = ..()

View File

@@ -38,8 +38,10 @@ ADMIN_VERB_AND_CONTEXT_MENU(debug_variables, (R_DEBUG|R_SERVER|R_ADMIN|R_SPAWN|R
var/type = islist ? /list : thing.type
var/no_icon = FALSE
var/cord_line
if(isatom(thing))
var/atom/AT = thing
cord_line = "<A href='byond://?_src_=holder;[HrefToken()];jumpto=\ref[thing]'>x:[AT.x] y:[AT.y] z:[AT.z]</A> "
if(use_gfi)
sprite = getFlatIcon(thing)
if(!sprite)
@@ -265,6 +267,7 @@ ADMIN_VERB_AND_CONTEXT_MENU(debug_variables, (R_DEBUG|R_SERVER|R_ADMIN|R_SPAWN|R
<span id='tagged'>[tagged_line]</span>
<span id='varedited'>[varedited_line]</span>
<span id='deleted'>[deleted_line]</span>
<br><font size='1'>[cord_line]</font>
</div>
</td>
<td width='50%'>

View File

@@ -355,8 +355,8 @@
X << 'sound/voice/bcriminal.ogg' //ChompEDIT - back to beepsky
window_flash(X)
//VOREStation Edit end.
fully_created = TRUE
attempt_auto_fit_viewport()
fully_created = TRUE
// Now that we're fully initialized, use our prefs
if(prefs?.read_preference(/datum/preference/toggle/browser_dev_tools))

View File

@@ -305,7 +305,7 @@
desc = "Soft substance produced by bees. Used to make candles."
icon = 'icons/obj/beekeeping.dmi'
icon_state = "wax"
default_type = "wax"
default_type = MAT_WAX
pass_color = TRUE
strict_color_stacking = TRUE
@@ -314,7 +314,7 @@
recipes = wax_recipes
/datum/material/wax
name = "wax"
name = MAT_WAX
stack_type = /obj/item/stack/material/wax
icon_colour = "#fff343"
melting_point = T0C+300

View File

@@ -14,27 +14,27 @@
wiki_flag = WIKI_SPOILER
/datum/material/alienalloy/elevatorium
name = "elevatorium"
name = MAT_ALIEN_ELEVAT
display_name = "elevator panelling"
table_icon_base = "stone"
icon_colour = "#666666"
/datum/material/alienalloy/dungeonium
name = "dungeonium"
name = MAT_ALIEN_DUNGEON
display_name = "ultra-durable"
icon_base = "dungeon"
table_icon_base = "stone"
icon_colour = "#FFFFFF"
/datum/material/alienalloy/bedrock
name = "bedrock"
name = MAT_ALIEN_BEDROCK
display_name = "impassable rock"
icon_base = "rock"
table_icon_base = "stone"
icon_colour = "#FFFFFF"
/datum/material/alienalloy/alium
name = "alium"
name = MAT_ALIEN_ALIUM
display_name = "alien"
icon_base = "alien"
table_icon_base = "alien"

View File

@@ -31,6 +31,7 @@
default_type = MAT_STEEL
material = get_material_by_name("[default_type]")
if(!material)
stack_trace("Material of type: [default_type] does not exist.")
return INITIALIZE_HINT_QDEL
recipes = material.get_recipes()

View File

@@ -18,7 +18,7 @@
machine.console = src
else
//Silently failing and causing mappers to scratch their heads while runtiming isn't ideal.
to_world(span_danger("Warning: Stacking machine console at [src.x], [src.y], [src.z] could not find its machine!"))
stack_trace(span_danger("Warning: Stacking machine console at [src.x], [src.y], [src.z] could not find its machine!"))
return INITIALIZE_HINT_QDEL
/obj/machinery/mineral/stacking_unit_console/attack_hand(mob/user)

View File

@@ -2,4 +2,4 @@
name = "rutile"
icon_state = "ore_rutile"
origin_tech = list(TECH_MATERIAL = 2)
material = "rutile"
material = ORE_RUTILE

View File

@@ -208,8 +208,7 @@
/datum/species/protean/equip_survival_gear(var/mob/living/carbon/human/H)
..()
var/obj/item/stack/material/steel/metal_stack = new()
metal_stack.set_amount(5)
var/obj/item/stack/material/steel/metal_stack = new(null, 5)
var/obj/item/clothing/accessory/permit/nanotech/permit = new()
permit.set_name(H.real_name)

View File

@@ -150,7 +150,9 @@
for(var/i = 1 to get_dist(src, destination))
if(stat)
return FALSE // We died or got knocked out on the way.
if(loc == destination)
var/last_loc = loc
if(last_loc == destination)
break // We somehow got there early.
// Update T.
@@ -176,6 +178,8 @@
dig_under_floor(get_turf(src))
playsound(src, 'sound/effects/break_stone.ogg', 75, 1)
sleep(tunnel_tile_speed)
if(last_loc == loc)
return FALSE
// For visuals.
/mob/living/simple_mob/animal/giant_spider/tunneler/proc/submerge()

View File

@@ -219,7 +219,7 @@
if(S && S.get_amount() < S.max_amount)
S.add(1)
else
new stacktype(T)
new stacktype(T, 1)
/obj/item/debris_pack
name = "debris"

View File

@@ -132,7 +132,7 @@
can_plate = FALSE
/obj/structure/table/alien/Initialize(mapload)
material = get_material_by_name("alium")
material = get_material_by_name(MAT_ALIEN_ALIUM)
verbs -= /obj/structure/table/verb/do_flip
verbs -= /obj/structure/table/proc/do_put
. = ..()

View File

@@ -1,2 +1,2 @@
/turf/simulated/wall/elevator/Initialize(mapload)
. = ..(mapload, "elevatorium")
. = ..(mapload, MAT_ALIEN_ELEVAT)