Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Birdtalon committed Nov 13, 2023
1 parent 95e8df1 commit d99f893
Show file tree
Hide file tree
Showing 54 changed files with 310 additions and 420 deletions.
4 changes: 1 addition & 3 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@
#define CAN_DIG_SHRAPNEL (1<<11)
/// whether it has an animated icon state of "[icon_state]_on" to be used during surgeries.
#define ANIMATED_SURGICAL_TOOL (1<<12)
/// The item goes on top of tables, instead of into them with the overlay system
#define NOTABLEMERGE (1<<13)
/// Has heat source but isn't 'on fire' and thus can be stored
#define IGNITING_ITEM (1<<14)
#define IGNITING_ITEM (1<<13)
//==========================================================================================


Expand Down
25 changes: 20 additions & 5 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
_L = target._status_traits; \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} else { \
_L = target._status_traits; \
if (_L[trait]) { \
_L[trait] |= list(source); \
} else { \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} \
} \
} while (0)
Expand All @@ -38,6 +44,9 @@
if (!length(_L[trait])) { \
_L -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
} \
}; \
if (!length(_L)) { \
target._status_traits = null \
Expand All @@ -62,6 +71,9 @@
if (!length(_traits_list[trait])) { \
_traits_list -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
} \
}; \
if (!length(_traits_list)) { \
target._status_traits = null \
Expand All @@ -78,8 +90,11 @@
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
}; \
};\
};\
if (!length(_L)) { \
target._status_traits = null\
};\
Expand All @@ -101,8 +116,11 @@
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \
if(_T in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[_T]); \
}; \
};\
};\
if (!length(_L)) { \
target._status_traits = null\
};\
Expand All @@ -124,9 +142,6 @@
/// Example trait
// #define TRAIT_X "t_x"

/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"

//-- mob traits --
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"
Expand Down Expand Up @@ -355,6 +370,8 @@ GLOBAL_LIST(trait_name_map)
/// Example trait source
// #define TRAIT_SOURCE_Y "t_s_y"
#define TRAIT_SOURCE_INHERENT "t_s_inherent"
/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"
//-- mob traits --
///Status trait coming from lying down through update_canmove()
#define LYING_TRAIT "lying"
Expand All @@ -364,8 +381,6 @@ GLOBAL_LIST(trait_name_map)
#define TRAIT_SOURCE_HIVE "t_s_hive"
///Status trait coming from being buckled.
#define TRAIT_SOURCE_BUCKLE "t_s_buckle"
///Status trait coming from roundstart quirks (that don't exist yet). Unremovable by REMOVE_TRAIT
#define TRAIT_SOURCE_QUIRK "t_s_quirk"
///Status trait coming from being assigned as [acting] squad leader.
#define TRAIT_SOURCE_SQUAD_LEADER "t_s_squad_leader"
///Status trait coming from their job
Expand Down
1 change: 0 additions & 1 deletion code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ DEFINE_BITFIELD(flags_item, list(
"ITEM_OVERRIDE_NORTHFACE" = ITEM_OVERRIDE_NORTHFACE,
"CAN_DIG_SHRAPNEL" = CAN_DIG_SHRAPNEL,
"ANIMATED_SURGICAL_TOOL" = ANIMATED_SURGICAL_TOOL,
"NOTABLEMERGE" = NOTABLEMERGE,
"IGNITING_ITEM" = IGNITING_ITEM,
))

Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
if(!user.hive.living_xeno_queen)
to_chat(user, SPAN_WARNING("Without a queen your psychic link is broken!"))
return FALSE
if(user.burrow || user.is_mob_incapacitated() || user.buckled)
if(HAS_TRAIT(user, TRAIT_ABILITY_BURROWED) || user.is_mob_incapacitated() || user.buckled)
return FALSE
user.hive.mark_ui.update_all_data()
user.hive.mark_ui.open_mark_menu(user)
Expand Down Expand Up @@ -583,7 +583,7 @@
if(!user.hive.living_xeno_queen)
to_chat(user, SPAN_WARNING("Your hive doesn't have a living queen!"))
return FALSE
if(user.burrow || user.is_mob_incapacitated() || user.buckled)
if(HAS_TRAIT(user, TRAIT_ABILITY_BURROWED) || user.is_mob_incapacitated() || user.buckled)
return FALSE
user.overwatch(user.hive.living_xeno_queen)

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

/mob/living/carbon/xenomorph/UnarmedAttack(atom/target, proximity, click_parameters, tile_attack = FALSE, ignores_resin = FALSE)
if(lying || burrow) //No attacks while laying down
if(lying || HAS_TRAIT(src, TRAIT_ABILITY_BURROWED)) //No attacks while laying down
return FALSE
var/mob/alt

Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/autofire/autofire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
/datum/component/automatedfire/autofire/proc/initiate_shot()
SIGNAL_HANDLER
if(shooting)//if we are already shooting, it means the shooter is still on cooldown
if(bursting && (world.time > (next_fire + (burstfire_shot_delay * burst_shots_to_fire))))
hard_reset()
return
shooting = TRUE
process_shot()
Expand Down
12 changes: 12 additions & 0 deletions code/game/machinery/vending/vending_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@
/obj/item/device/camera_film = 10,
/obj/item/notepad = 5,
/obj/item/device/toner = 5,
/obj/item/paper/colonial_grunts = 15,
/obj/item/toy/dice/d20 = 10,
/obj/item/tool/pen = 10,
/obj/item/tool/pen/blue = 10,
/obj/item/tool/pen/red = 10,
/obj/item/tool/pen/fountain = 3,
)

contraband = list(/obj/item/toy/sword = 2)
Expand All @@ -433,5 +439,11 @@
/obj/item/toy/deck/uno = 15,
/obj/item/device/camera = 30,
/obj/item/device/toner = 15,
/obj/item/paper/colonial_grunts = 5,
/obj/item/toy/dice/d20 = 1,
/obj/item/tool/pen = 2,
/obj/item/tool/pen/blue = 2,
/obj/item/tool/pen/red = 2,
/obj/item/tool/pen/fountain = 30,
)
product_type = VENDOR_PRODUCT_TYPE_RECREATIONAL
6 changes: 3 additions & 3 deletions code/game/objects/items/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
return FALSE

// Create their vis object if needed
if(!xeno.backpack_icon_carrier)
xeno.backpack_icon_carrier = new(null, xeno)
xeno.vis_contents += xeno.backpack_icon_carrier
if(!xeno.backpack_icon_holder)
xeno.backpack_icon_holder = new(null, xeno)
xeno.vis_contents += xeno.backpack_icon_holder

target_mob.put_in_back(src)
return FALSE
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/items/toys/cards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
icon = 'icons/obj/items/playing_cards.dmi'
icon_state = "deck"
w_class = SIZE_TINY
flags_item = NOTABLEMERGE

var/base_icon = "deck"
var/max_cards = 52
Expand Down Expand Up @@ -262,7 +261,6 @@
icon = 'icons/obj/items/playing_cards.dmi'
icon_state = "empty"
w_class = SIZE_TINY
flags_item = NOTABLEMERGE

var/concealed = FALSE
var/pile_state = FALSE
Expand Down
175 changes: 14 additions & 161 deletions code/game/objects/structures/surface.dm
Original file line number Diff line number Diff line change
@@ -1,159 +1,20 @@
//Surface structures are structures that can have items placed on them
/obj/structure/surface
health = 100
var/list/update_types = list(
/obj/item/reagent_container/glass,
/obj/item/storage,
/obj/item/reagent_container/food/snacks
)
//add items there that behave like structures for whatever dumb reason
var/list/blacklisted_item_types = list(
/obj/item/device/radio/intercom,
/obj/item/device/sentry_computer
)

/obj/structure/surface/Initialize()
. = ..()
return INITIALIZE_HINT_LATELOAD

/obj/structure/surface/LateInitialize()
attach_all()
update_icon()

/obj/structure/surface/Destroy()
detach_all()
. = ..()

/obj/structure/surface/ex_act(severity, direction, datum/cause_data/cause_data)
health -= severity
if(health <= 0)
var/location = get_turf(src)
handle_debris(severity, direction)
detach_all()
for(var/obj/item/O in loc)
O.explosion_throw(severity, direction)
qdel(src)
if(prob(66))
create_shrapnel(location, rand(1,4), direction, , /datum/ammo/bullet/shrapnel/light, cause_data)
return TRUE

/obj/structure/surface/proc/attach_all()
for(var/obj/item/O in loc)
if(in_blacklist(O))
continue
attach_item(O, FALSE)
draw_item_overlays()

/obj/structure/surface/proc/in_blacklist(obj/item/O)
for(var/allowed_type in blacklisted_item_types)
if(istype(O, allowed_type))
return TRUE
return FALSE

/obj/structure/surface/proc/attach_item(obj/item/O, update = TRUE)
if(!O)
/obj/structure/surface/attackby(obj/item/attacking_item, mob/user, click_data)
if(!user.drop_inv_item_to_loc(attacking_item, loc))
return
if(O.luminosity) //it can't make light as an overlay
return
O.forceMove(src)
RegisterSignal(O, COMSIG_ATOM_DECORATED, PROC_REF(decorate_update))
if(update)
draw_item_overlays()

/obj/structure/surface/proc/detach_item(obj/item/O)
O.scatter_item()
UnregisterSignal(O, COMSIG_ATOM_DECORATED)
draw_item_overlays()
return

/obj/structure/surface/proc/decorate_update(obj/item/O)
SIGNAL_HANDLER
draw_item_overlays()

/obj/structure/surface/proc/detach_all()
overlays.Cut()
for(var/obj/item/O in contents)
UnregisterSignal(O, COMSIG_ATOM_DECORATED)
O.forceMove(loc)
auto_align(attacking_item, click_data)
user.next_move = world.time + 2
return TRUE

/obj/structure/surface/proc/get_item(list/click_data)
var/i = LAZYLEN(contents)
if(!click_data)
return
if(i < 1)
return FALSE
for(i, i >= 1, i--)//starting from the end because that's where the topmost is
var/obj/item/O = contents[i]
var/bounds_x = text2num(click_data["icon-x"])-1 - O.pixel_x
var/bounds_y = text2num(click_data["icon-y"])-1 - O.pixel_y
if(bounds_x < 0 || bounds_y < 0)
continue
var/icon/I = icon(O.icon, O.icon_state)
var/p = I.GetPixel(bounds_x, bounds_y)
if(p)
return O
return FALSE

/obj/structure/surface/proc/draw_item_overlays()
overlays.Cut()
for(var/obj/item/O in contents)
var/image/I = image(O.icon)
I.appearance = O.appearance
I.appearance_flags |= RESET_COLOR
I.overlays = O.overlays
LAZYADD(overlays, I)

/obj/structure/surface/clicked(mob/user, list/mods)
if(mods["shift"] && !mods["middle"])
var/obj/item/O = get_item(mods)
if(!O)
return ..()
if(O.can_examine(user))
O.examine(user)
return TRUE
..()

/obj/structure/surface/proc/try_to_open_container(mob/user, mods)
if(!Adjacent(user))
return

if(ishuman(user) || isrobot(user))
var/obj/item/O = get_item(mods)
if(O && isstorage(O))
var/obj/item/storage/S = O
S.open(usr)
return TRUE

/obj/structure/surface/attack_hand(mob/user, click_data)
. = ..()
if(click_data && click_data["alt"])
return
var/obj/item/O = get_item(click_data)
if(!O)
return
O.attack_hand(user)
if(!LAZYISIN(contents, O))//in case attack_hand did not pick up the item
detach_item(O)

/obj/structure/surface/attackby(obj/item/W, mob/user, click_data)
var/obj/item/O = get_item(click_data)
if(!O || click_data["ctrl"])//holding the ctrl key will force it to place the object
// Placing stuff on tables
if(user.drop_inv_item_to_loc(W, loc))
auto_align(W, click_data)
user.next_move = world.time + 2
return TRUE
else if(!O.attackby(W, user))
W.afterattack(O, user, TRUE)
for(var/type in update_types)
if(istype(O, type))
draw_item_overlays()

/obj/structure/surface/proc/auto_align(obj/item/W, click_data)
if(!W.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy.
W.pixel_x = rand(-W.randpixel, W.randpixel)
W.pixel_y = rand(-W.randpixel, W.randpixel)
W.pixel_z = 0
/obj/structure/surface/proc/auto_align(obj/item/new_item, click_data)
if(!new_item.center_of_mass) // Clothing, material stacks, generally items with large sprites where exact placement would be unhandy.
new_item.pixel_x = rand(-new_item.randpixel, new_item.randpixel)
new_item.pixel_y = rand(-new_item.randpixel, new_item.randpixel)
new_item.pixel_z = 0
return

if(!click_data)
Expand All @@ -169,16 +30,8 @@
var/cell_x = Clamp(round(mouse_x/CELLSIZE), 0, CELLS-1) // Ranging from 0 to CELLS-1
var/cell_y = Clamp(round(mouse_y/CELLSIZE), 0, CELLS-1)

var/list/center = cached_key_number_decode(W.center_of_mass)

W.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"]
W.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"]
W.pixel_z = 0

if(!(W.flags_item & NOTABLEMERGE))
attach_item(W)
var/list/center = cached_key_number_decode(new_item.center_of_mass)

/obj/structure/surface/MouseDrop(atom/over)
. = ..()
if(over == usr && usr && usr.client && usr.client.lmb_last_mousedown_mods)
return try_to_open_container(usr, usr.client.lmb_last_mousedown_mods)
new_item.pixel_x = (CELLSIZE * (cell_x + 0.5)) - center["x"]
new_item.pixel_y = (CELLSIZE * (cell_y + 0.5)) - center["y"]
new_item.pixel_z = 0
Loading

0 comments on commit d99f893

Please sign in to comment.