Skip to content

Commit

Permalink
Merge branch 'master' into TheRPEDUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
TheObserver-sys authored Sep 24, 2023
2 parents 4d7f2a9 + ebceb1d commit c323ef9
Show file tree
Hide file tree
Showing 132 changed files with 3,107 additions and 1,262 deletions.
34 changes: 23 additions & 11 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@
#include "code\datums\progressbar.dm"
#include "code\datums\prototype.dm"
#include "code\datums\radiation_wave.dm"
#include "code\datums\recipe.dm"
#include "code\datums\soul_link.dm"
#include "code\datums\sun.dm"
#include "code\datums\tgs_event_handler.dm"
Expand Down Expand Up @@ -694,13 +693,6 @@
#include "code\datums\components\atoms\radioactive.dm"
#include "code\datums\components\crafting\crafting.dm"
#include "code\datums\components\crafting\guncrafting.dm"
#include "code\datums\components\crafting\recipes.dm"
#include "code\datums\components\crafting\recipes\recipes_clothing.dm"
#include "code\datums\components\crafting\recipes\recipes_furniture.dm"
#include "code\datums\components\crafting\recipes\recipes_misc.dm"
#include "code\datums\components\crafting\recipes\recipes_primal.dm"
#include "code\datums\components\crafting\recipes\recipes_robot.dm"
#include "code\datums\components\crafting\recipes\recipes_weapon_and_ammo.dm"
#include "code\datums\components\items\wielding.dm"
#include "code\datums\components\movable\aquarium.dm"
#include "code\datums\components\riding\riding_filter.dm"
Expand Down Expand Up @@ -796,6 +788,21 @@
#include "code\datums\outfits\military\sysguard.dm"
#include "code\datums\proxfield\_proxfield.dm"
#include "code\datums\proxfield\basic.dm"
#include "code\datums\recipe\crafting_recipe.dm"
#include "code\datums\recipe\material_recipe.dm"
#include "code\datums\recipe\recipe.dm"
#include "code\datums\recipe\stack_recipe.dm"
#include "code\datums\recipe\crafting_recipes\recipes_clothing.dm"
#include "code\datums\recipe\crafting_recipes\recipes_furniture.dm"
#include "code\datums\recipe\crafting_recipes\recipes_misc.dm"
#include "code\datums\recipe\crafting_recipes\recipes_primal.dm"
#include "code\datums\recipe\crafting_recipes\recipes_robot.dm"
#include "code\datums\recipe\crafting_recipes\recipes_weapon_and_ammo.dm"
#include "code\datums\recipe\material_recipes\furniture.dm"
#include "code\datums\recipe\material_recipes\structures.dm"
#include "code\datums\recipe\material_recipes\tools.dm"
#include "code\datums\recipe\stack_recipes\misc.dm"
#include "code\datums\recipe\stack_recipes\structures.dm"
#include "code\datums\repositories\ammomaterial.dm"
#include "code\datums\repositories\cameras.dm"
#include "code\datums\repositories\crew.dm"
Expand Down Expand Up @@ -2978,6 +2985,7 @@
#include "code\modules\loadout\accessories\collar.dm"
#include "code\modules\loadout\accessories\insignia.dm"
#include "code\modules\loadout\accessories\utility.dm"
#include "code\modules\logging\logging.dm"
#include "code\modules\loot\pack.dm"
#include "code\modules\loot\table.dm"
#include "code\modules\loot\packs\archeology.dm"
Expand Down Expand Up @@ -3139,9 +3147,10 @@
#include "code\modules\maps\weather\virgo4.dm"
#include "code\modules\materials\_materials.dm"
#include "code\modules\materials\fifty_spawner_mats.dm"
#include "code\modules\materials\material_recipes.dm"
#include "code\modules\materials\material_sheets.dm"
#include "code\modules\materials\material_synth.dm"
#include "code\modules\materials\recipes.dm"
#include "code\modules\materials\definitions\legacy.dm"
#include "code\modules\materials\definitions\special.dm"
#include "code\modules\materials\definitions\admin\alienalloy.dm"
#include "code\modules\materials\definitions\crystals\diamond.dm"
Expand All @@ -3161,9 +3170,9 @@
#include "code\modules\materials\definitions\metals\steel.dm"
#include "code\modules\materials\definitions\metals\titanium.dm"
#include "code\modules\materials\definitions\metals\uranium.dm"
#include "code\modules\materials\definitions\misc\cardboard.dm"
#include "code\modules\materials\definitions\misc\cloths.dm"
#include "code\modules\materials\definitions\misc\foam.dm"
#include "code\modules\materials\definitions\misc\paper.dm"
#include "code\modules\materials\definitions\misc\plastic.dm"
#include "code\modules\materials\definitions\misc\snow.dm"
#include "code\modules\materials\definitions\misc\wax.dm"
Expand All @@ -3173,7 +3182,9 @@
#include "code\modules\materials\definitions\organic\flesh.dm"
#include "code\modules\materials\definitions\organic\leather.dm"
#include "code\modules\materials\definitions\organic\resin.dm"
#include "code\modules\materials\definitions\organic\wood.dm"
#include "code\modules\materials\definitions\organic\wood\log.dm"
#include "code\modules\materials\definitions\organic\wood\plank.dm"
#include "code\modules\materials\definitions\special\clown_planet.dm"
#include "code\modules\materials\definitions\special\cult.dm"
#include "code\modules\materials\definitions\special\morphium.dm"
#include "code\modules\materials\definitions\special\phoron.dm"
Expand Down Expand Up @@ -4345,6 +4356,7 @@
#include "code\modules\rogueminer_vr\zone_console.dm"
#include "code\modules\rogueminer_vr\zonemaster.dm"
#include "code\modules\roles\role.dm"
#include "code\modules\sculpting\sculpting_block.dm"
#include "code\modules\security levels\keycard authentication.dm"
#include "code\modules\security levels\security levels.dm"
#include "code\modules\shieldgen\directional_shield.dm"
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/_cooldowns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@
//? Machinery
//* /obj/machinery/computer/card
#define CD_INDEX_IDCONSOLE_PRINT "idconsole_print"

//? Structures
//* /obj/structure/sculpting_block
#define CD_INDEX_SCULPTING_COOLDOWN "sculpting_block"
3 changes: 3 additions & 0 deletions code/__DEFINES/_flags/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
#define OBJ_PREVENT_CLICK_UNDER (1<<3)
/// We ignore depth system when blocking mobs
#define OBJ_IGNORE_MOB_DEPTH (1<<4)
/// no sculpting
#define OBJ_NO_SCULPTING (1<<5)

DEFINE_BITFIELD(obj_flags, list(
BITFIELD(EMAGGED),
BITFIELD(CAN_BE_HIT),
BITFIELD(ON_BLUEPRINTS),
BITFIELD(OBJ_PREVENT_CLICK_UNDER),
BITFIELD(OBJ_IGNORE_MOB_DEPTH),
BITFIELD(OBJ_NO_SCULPTING),
))
3 changes: 3 additions & 0 deletions code/__DEFINES/math.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,6 @@
#define NORM(x, y) (sqrt(SQUAREDNORM(x,y)))
#define ISPOWEROFTWO(x) ((x & (x - 1)) == 0)
#define ROUNDUPTOPOWEROFTWO(x) (2 ** -round(-log(2,x)))

/// get highest magnitude of two numbers, magnitude is abs value
#define BIGGER_MAGNITUDE(a, b) ((abs(a) > abs(b))? a : b)
7 changes: 4 additions & 3 deletions code/__HELPERS/do_after.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@
* * mobility_flags - required mobility flags
* * max_distance - if not null, the user is required to be get_dist() <= max_distance from target.
* * additional_checks - a callback that allows for custom checks. this is invoked with our args directly, allowing us to modify delay.
* * progress_anchor - override progressbar anchor location
*/
/proc/do_after(mob/user, delay, atom/target, flags, mobility_flags = MOBILITY_CAN_USE, max_distance, datum/callback/additional_checks)
/proc/do_after(mob/user, delay, atom/target, flags, mobility_flags = MOBILITY_CAN_USE, max_distance, datum/callback/additional_checks, atom/progress_anchor)
if(isnull(user))
return FALSE
if(!delay)
Expand Down Expand Up @@ -99,8 +100,8 @@
var/datum/progressbar/progress
var/original_delay = delay
var/delay_factor = 1
if(!(flags & DO_AFTER_NO_PROGRESS))
progress = new(user, delay, target)
if(!(flags & DO_AFTER_NO_PROGRESS) && (!isnull(progress_anchor || !isnull(target))))
progress = new(user, delay, progress_anchor || target)
var/start_time = world.time

//* loop
Expand Down
126 changes: 118 additions & 8 deletions code/__HELPERS/icons/flatten.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @params
* - A - appearancelike object.
* - no_anim - flatten out animations
*
* @return flat icon
*/
/proc/get_compound_icon(atom/A, no_anim)
var/mutable_appearance/N = new
Expand All @@ -38,7 +40,107 @@
qdel(west)
return full

/**
* Generates an icon with all 4 directions of something.
*
* Note: Centering offsets here have a weird meaning.
* They basically tell you how to offset the finished result to ignore large icons
* causing the original icon to be scaled beyond its sides.
* It's not a 'true' semantic centering offset - the icon system doesn't handle that.
*
* @params
* * A - appearancelike object.
* * no_anim - flatten out animations
* * preprocess - preprocess callback. used because we can't icon ops on a compound icon.
*
* @return list(flat icon, offset x, offset y) where x/y offsets are centering pixel offsets
*/
/proc/get_compound_icon_with_offsets(atom/A, no_anim, datum/callback/preprocess)
var/mutable_appearance/N = new
N.appearance = A

var/list/gfi_return
var/x_offset = 0
var/y_offset = 0
var/got_anything = FALSE

N.dir = NORTH
gfi_return = get_flat_icon_with_offsets(N, NORTH, no_anim = no_anim)
var/icon/north
if(!isnull(gfi_return))
north = gfi_return[1]
preprocess?.Invoke(north)
x_offset = BIGGER_MAGNITUDE(x_offset, gfi_return[2])
y_offset = BIGGER_MAGNITUDE(y_offset, gfi_return[3])
got_anything = TRUE
N.dir = SOUTH
gfi_return = get_flat_icon_with_offsets(N, SOUTH, no_anim = no_anim)
var/icon/south
if(!isnull(gfi_return))
south = gfi_return[1]
preprocess?.Invoke(south)
x_offset = BIGGER_MAGNITUDE(x_offset, gfi_return[2])
y_offset = BIGGER_MAGNITUDE(y_offset, gfi_return[3])
got_anything = TRUE
N.dir = EAST
gfi_return = get_flat_icon_with_offsets(N, EAST, no_anim = no_anim)
var/icon/east
if(!isnull(gfi_return))
east = gfi_return[1]
preprocess?.Invoke(east)
x_offset = BIGGER_MAGNITUDE(x_offset, gfi_return[2])
y_offset = BIGGER_MAGNITUDE(y_offset, gfi_return[3])
got_anything = TRUE
N.dir = WEST
gfi_return = get_flat_icon_with_offsets(N, WEST, no_anim = no_anim)
var/icon/west
if(!isnull(gfi_return))
west = gfi_return[1]
preprocess?.Invoke(west)
x_offset = BIGGER_MAGNITUDE(x_offset, gfi_return[2])
y_offset = BIGGER_MAGNITUDE(y_offset, gfi_return[3])
got_anything = TRUE

qdel(N)

if(!got_anything)
return

//Starts with a blank icon because of byond bugs.
var/icon/full = icon('icons/system/blank_32x32.dmi', "")
if(!isnull(north))
full.Insert(north, dir = NORTH)
qdel(north)
if(!isnull(south))
full.Insert(south, dir = SOUTH)
qdel(south)
if(!isnull(east))
full.Insert(east, dir = EAST)
qdel(east)
if(!isnull(west))
full.Insert(west, dir = WEST)
qdel(west)

return list(full, x_offset, y_offset)

/**
* grabs flat icon with no care for alignment / basically just grabs a png
*/
/proc/get_flat_icon(appearance/appearancelike, dir, no_anim)
if(!dir && isloc(appearancelike))
dir = appearancelike.dir
. = _get_flat_icon(appearancelike, dir, no_anim, null, TRUE)
return .?[1]

/**
* grabs flat icon as list(icon, centering-x, centering-y) offsets
*
* Note: Centering offsets here have a weird meaning.
* They basically tell you how to offset the finished result to ignore large icons
* causing the original icon to be scaled beyond its sides.
* It's not a 'true' semantic centering offset - the icon system doesn't handle that.
*/
/proc/get_flat_icon_with_offsets(appearance/appearancelike, dir, no_anim)
if(!dir && isloc(appearancelike))
dir = appearancelike.dir
return _get_flat_icon(appearancelike, dir, no_anim, null, TRUE)
Expand All @@ -50,8 +152,11 @@
* * no_anim - (optional) trample animations to first frame
* * deficon - (optional) default icon to use instead of using the host appearance's
* * start - is this the first call in the recurse? this is important
*
* @return list(icon, x, y) where x/y are centering pixel offsets
*/
/proc/_get_flat_icon(image/A, defdir, no_anim, deficon, start)
RETURN_TYPE(/list)
// start with blank image
var/static/icon/template = icon('icons/system/blank_32x32.dmi', "")

Expand All @@ -73,7 +178,7 @@

// invis? skip.
if(!A || A.alpha <= 0)
return BLANK
return list(BLANK, 0, 0)

// detect if state exists
var/icon/icon = A.icon || deficon
Expand Down Expand Up @@ -107,7 +212,7 @@
if(!A.overlays.len && !A.underlays.len)
// we don't even have ourselves!
if(none)
return BLANK
return list(BLANK, 0, 0)
// no overlays/underlays, we're done, just mix in ourselves
var/icon/self_icon = icon(icon(icon, state, ourdir), "", SOUTH, no_anim? 1 : null)
if(A.alpha < 255)
Expand All @@ -117,7 +222,7 @@
self_icon.MapColors(arglist(A.color))
else
self_icon.Blend(A.color, ICON_MULTIPLY)
return self_icon
return list(self_icon, 0, 0)

// safety/performance check
if((A.overlays.len + A.underlays.len) > 80)
Expand Down Expand Up @@ -163,6 +268,7 @@
comparing = gathered[i]
if(current_layer < gathered[comparing])
gathered.Insert(i, copying)
break
// associate
gathered[copying] = current_layer

Expand All @@ -186,11 +292,14 @@
comparing = gathered[i]
if(current_layer < gathered[comparing])
gathered.Insert(i, copying)
break
// associate
gathered[copying] = current_layer

// adding icon we're mixing in
var/icon/adding
// full flat icon returned by a recursive GFI call during rendering
var/list/gfi_return
// current dimensions
var/list/flat_size = list(1, flat.Width(), 1, flat.Height())
// adding dimensions
Expand All @@ -215,12 +324,13 @@
blend_mode = BLEND_OVERLAY
adding = icon(icon, state, ourdir)
else
// use full get_flat_icon
// use full get_flat_icon_with_offsets
blend_mode = copying.blend_mode
adding = _get_flat_icon(copying, defdir, no_anim, icon)
gfi_return = _get_flat_icon(copying, defdir, no_anim, icon)
adding = gfi_return?[1]

// if we got nothing, skip
if(!adding)
if(isnull(adding))
continue

// detect adding size, taking into account copying overlay's pixel offsets
Expand Down Expand Up @@ -265,10 +375,10 @@
// clean up frames
var/icon/cleaned = icon()
cleaned.Insert(flat, "", SOUTH, 1, 0)
return cleaned
return list(cleaned, -shift_x, -shift_y)
else
// just return flat as SOUTH
return icon(flat, "", SOUTH)
return list(icon(flat, "", SOUTH), -shift_x, -shift_y)

#undef flatX1
#undef flatX2
Expand Down
Loading

0 comments on commit c323ef9

Please sign in to comment.