Skip to content

Commit

Permalink
TGS Test Merge (#6029)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue authored and Blue committed Sep 30, 2023
2 parents 30b014f + d88e4a6 commit 67a2e7a
Show file tree
Hide file tree
Showing 70 changed files with 1,057 additions and 507 deletions.
11 changes: 10 additions & 1 deletion citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "code\__DEFINES\damage_organs.dm"
#include "code\__DEFINES\directional.dm"
#include "code\__DEFINES\dna.dm"
#include "code\__DEFINES\event_args.dm"
#include "code\__DEFINES\fonts.dm"
#include "code\__DEFINES\gamemode.dm"
#include "code\__DEFINES\holidays.dm"
Expand Down Expand Up @@ -161,12 +162,12 @@
#include "code\__DEFINES\dcs\signals\signals_global.dm"
#include "code\__DEFINES\dcs\signals\signals_object.dm"
#include "code\__DEFINES\dcs\signals\signals_storage.dm"
#include "code\__DEFINES\dcs\signals\signals_tool_system.dm"
#include "code\__DEFINES\dcs\signals\signals_turf.dm"
#include "code\__DEFINES\dcs\signals\datums\signals_beam.dm"
#include "code\__DEFINES\dcs\signals\datums\signals_perspective.dm"
#include "code\__DEFINES\dcs\signals\elements\conflict.dm"
#include "code\__DEFINES\dcs\signals\items\signals_inducer.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\context_system.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_appearance.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_attack.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_buckling.dm"
Expand All @@ -180,6 +181,7 @@
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_throwing.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_visuals.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_x_act.dm"
#include "code\__DEFINES\dcs\signals\signals_atom\tool_system.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_economy.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_inventory.dm"
#include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_appearance.dm"
Expand Down Expand Up @@ -744,6 +746,9 @@
#include "code\datums\elements\clothing\dynamic_recolor.dm"
#include "code\datums\elements\items\darksight_granter.dm"
#include "code\datums\elements\items\hud_granter.dm"
#include "code\datums\event_args\_event_args.dm"
#include "code\datums\event_args\actor.dm"
#include "code\datums\event_args\clickchain.dm"
#include "code\datums\helper_datums\construction_datum.dm"
#include "code\datums\helper_datums\events.dm"
#include "code\datums\helper_datums\getrev.dm"
Expand Down Expand Up @@ -937,6 +942,7 @@
#include "code\game\click\adjacency_legacy.dm"
#include "code\game\click\ai.dm"
#include "code\game\click\click.dm"
#include "code\game\click\context.dm"
#include "code\game\click\cyborg.dm"
#include "code\game\click\drag_drop.dm"
#include "code\game\click\item_attack.dm"
Expand Down Expand Up @@ -1869,6 +1875,8 @@
#include "code\game\objects\structures\stool_bed_chair_nest\chairs_vr.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\stools.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\wheelchair.dm"
#include "code\game\objects\systems\_system.dm"
#include "code\game\objects\systems\cell_slot.dm"
#include "code\game\rendering\client.dm"
#include "code\game\rendering\mob.dm"
#include "code\game\rendering\screen.dm"
Expand Down Expand Up @@ -4686,6 +4694,7 @@
#include "code\modules\tools\_tool_system.dm"
#include "code\modules\tools\items.dm"
#include "code\modules\tools\multitool.dm"
#include "code\modules\tools\visuals.dm"
#include "code\modules\tools\wrappers.dm"
#include "code\modules\tools\z_legacy.dm"
#include "code\modules\tooltip\tooltip.dm"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define ADMIN_LOOKUP(user) ("[key_name_admin(user)][ADMIN_QUE(user)]")
#define ADMIN_LOOKUPFLW(user) ("[key_name_admin(user)][ADMIN_QUE(user)] [ADMIN_FLW(user)]")
#define COORD(src) ("[src ? src.Admin_Coordinates_Readable() : "nonexistent location"]")
// todo: this should be made faster/better, and support stuff like inventory / storage awareness
#define AUDIT_COORD(src) ("[src ? src.Admin_Coordinates_Readable() : "nonexistent location"]")
#define AREACOORD(src) ("[src ? src.Admin_Coordinates_Readable(TRUE) : "nonexistent location"]")
#define ADMIN_COORDJMP(src) ("[src ? src.Admin_Coordinates_Readable(FALSE, TRUE) : "nonexistent location"]")
#define ADMIN_VERBOSEJMP(src) ("[src ? src.Admin_Coordinates_Readable(TRUE, TRUE) : "nonexistent location"]")
Expand Down
20 changes: 20 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/context_system.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

/// from base of /atom/proc/context_query: (list/options, datum/event_args/actor/e_args)
/// options list is the same format as /atom/proc/context_query, insert directly to it.
#define COMSIG_ATOM_CONTEXT_QUERY "atom_context_query"
/// from base of /atom/proc/context_act: (key, datum/event_args/actor/e_args)
#define COMSIG_ATOM_CONTEXT_ACT "atom_context_act"
#define RAISE_ATOM_CONTEXT_ACT_HANDLED (1<<0)

/// create context
/// * name: name
/// * image: context menu image
/// * distance: distance where this is valid; much be reachable or actable; null = requires adjacency or adjacency-equivalence
/// * mobility: mobility flags required
#define ATOM_CONTEXT_TUPLE(name, image, distance, mobility) list(name, image, distance, mobility)

/// when used as distance, telekinetics and other things do not count as adjacency
// todo: currently not implemented
#define ATOM_CONTEXT_FORCE_PHYSICAL_ADJACENCY null
10 changes: 10 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/tool_system.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

/// from base of _tool_act: (I, user, function, flags, hint) where I = item, e_args = clickchain data, function = tool behaviour, flags = tool operation flags, hint = set by dynamic tool system
/// return CLICKCHAIN_COMPONENT_SIGNAL_HANDLED to abort normal tool_act handling.
#define COMSIG_ATOM_TOOL_ACT "tool_act"
/// from base of dynamic_tool_query: (I, datum/event_args/actor/clickchain/e_args, functions) where I = item, e_args = clickchain data.
/// inject by merging into functions
/// remember to use merge_double_lazy_assoc_list() to merge function lists!
#define COMSIG_ATOM_TOOL_QUERY "tool_functions"
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_tool_system.dm

This file was deleted.

7 changes: 7 additions & 0 deletions code/__DEFINES/event_args.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//? for /datum/event_args/actor

#define WRAP_MOB_TO_ACTOR_EVENT_ARGS(VARNAME) VARNAME = ismob(VARNAME)? new /datum/event_args/actor(VARNAME) : VARNAME

//? for /datum/event_args/actor/clickchain

#define WRAP_MOB_TO_CLICKCHAIN_EVENT_ARGS(VARNAME) VARNAME = ismob(VARNAME)? new /datum/event_args/actor/clickchain(VARNAME) : VARNAME
11 changes: 11 additions & 0 deletions code/__DEFINES/procs/clickcode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/// person can reach us normally
#define CLICKCHAIN_HAS_PROXIMITY (1<<1)
/// in tool act - used to check if we should do default proximity checks when none are specified
/// this is added to clickchain flags by tool_attack_chain.
#define CLICKCHAIN_TOOL_ACT (1<<2)
/// redirected by something - like when a switchtool to another item
#define CLICKCHAIN_REDIRECTED (1<<3)
Expand All @@ -33,7 +34,17 @@
#define CLICKCHAIN_DID_SOMETHING (1<<5)
/// completely block attacking (notably, attack_mob, attack_obj) from happening by halting standard_melee_attack.
#define CLICKCHAIN_DO_NOT_ATTACK (1<<6)
/// intercepted by component
#define CLICKCHAIN_COMPONENT_SIGNAL_HANDLED (1<<7)

//! Reachability Depths - checked from level of DirectAccess and turf adjacency.
/// default reachability depth
#define DEFAULT_REACHABILITY_DEPTH 3 // enough to reach into pill bottles in box in backpack

//! Reachability
/// can't reach - this *must* be a fals-y value.
#define REACH_FAILED 0
/// can physically reach normally
#define REACH_PHYSICAL 1
/// can reach with something like telekinesis
#define REACH_INDIRECT 2
10 changes: 0 additions & 10 deletions code/__DEFINES/tools/functionality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ GLOBAL_REAL_VAR(_dyntool_image_states) = list(

//* None yet! Waiting on skill-system design.

//? Tool hints - make these human readable!

#define TOOL_HINT_UNSCREWING_WINDOW_FRAME "unsecure frame"
#define TOOL_HINT_SCREWING_WINDOW_FRAME "secure frame"
#define TOOL_HINT_UNSCREWING_WINDOW_PANE "unfasten pane"
#define TOOL_HINT_SCREWING_WINDOW_PANE "fasten pane"
#define TOOL_HINT_CROWBAR_WINDOW_IN "pane in"
#define TOOL_HINT_CROWBAR_WINDOW_OUT "pane out"
#define TOOL_HINT_WRENCH_WINDOW_DISASSEMBLY "dismantle"

//? tool_locked var

/// unlocked - use dynamic tool system
Expand Down
7 changes: 4 additions & 3 deletions code/__HELPERS/do_after.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@
* * 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
* * progress_instance - override progressbar instance
*/
/proc/do_after(mob/user, delay, atom/target, flags, mobility_flags = MOBILITY_CAN_USE, max_distance, datum/callback/additional_checks, atom/progress_anchor)
/proc/do_after(mob/user, delay, atom/target, flags, mobility_flags = MOBILITY_CAN_USE, max_distance, datum/callback/additional_checks, atom/progress_anchor, datum/progressbar/progress_instance)
if(isnull(user))
return FALSE
if(!delay)
Expand Down Expand Up @@ -97,10 +98,10 @@

var/obj/item/active_held_item = user.get_active_held_item()

var/datum/progressbar/progress
var/datum/progressbar/progress = progress_instance
var/original_delay = delay
var/delay_factor = 1
if(!(flags & DO_AFTER_NO_PROGRESS) && (!isnull(progress_anchor || !isnull(target))))
if(isnull(progress) && !(flags & DO_AFTER_NO_PROGRESS) && (!isnull(progress_anchor || !isnull(target))))
progress = new(user, delay, progress_anchor || target)
var/start_time = world.time

Expand Down
5 changes: 5 additions & 0 deletions code/datums/event_args/_event_args.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* datums used to hold data for procs without having to pass too many args around
*/
/datum/event_args
abstract_type = /datum/event_args
57 changes: 57 additions & 0 deletions code/datums/event_args/actor.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* used to hold semantic data about an action being done by an actor vs initiator (controller)
*/
/datum/event_args/actor
/// the mob performing the action
var/mob/performer
/// the mob actually initiating the action, e.g. a remote controller.
var/mob/initiator

/datum/event_args/actor/New(mob/performer, mob/initiator)
src.performer = performer
src.initiator = isnull(initiator)? performer : initiator

/datum/event_args/actor/proc/chat_feedback(msg, atom/target)
performer.action_feedback(msg, target)
if(performer != initiator)
initiator.action_feedback(msg, target)

/datum/event_args/actor/proc/bubble_feedback(msg, atom/target)
performer.bubble_action_feedback(msg, target)
if(performer != initiator)
initiator.bubble_action_feedback(msg, target)

/**
* It is highly recommended to use named parameters with this.
*/
/datum/event_args/actor/proc/visible_feedback(atom/target, range, visible, audible, visible_self, otherwise_self, visible_them, otherwise_them)
performer.visible_action_feedback(
target = target,
initiator = initiator,
hard_range = range,
visible_hard = visible,
audible_hard = audible,
visible_self = visible_self,
otherwise_self = otherwise_self,
visible_them = visible_them,
otherwise_them = otherwise_them,
)

/**
* It is highly recommended to use named parameters with this.
*/
/datum/event_args/actor/proc/visible_dual_feedback(atom/target, range_hard, range_soft, visible_hard, visible_soft, audible_hard, audible_soft, visible_self, otherwise_self, visible_them, otherwise_them)
performer.visible_action_feedback(
target = target,
initiator = initiator,
hard_range = range_hard,
soft_range = range_soft,
visible_hard = visible_hard,
visible_soft = visible_soft,
audible_hard = audible_hard,
audible_soft = audible_soft,
visible_self = visible_self,
otherwise_self = otherwise_self,
visible_them = visible_them,
otherwise_them = otherwise_them,
)
13 changes: 13 additions & 0 deletions code/datums/event_args/clickchain.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* used to hold data about a click action
*/
/datum/event_args/actor/clickchain
/// a_intent
var/intent
/// click params
var/list/params

/datum/event_args/actor/clickchain/New(mob/performer, mob/initiator, intent, list/params)
..()
src.intent = isnull(intent)? performer.a_intent : intent
src.params = isnull(params)? list() : params
4 changes: 4 additions & 0 deletions code/datums/progressbar.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/proc/create_actor_progress_bar(datum/event_args/actor/e_args, goal_number, atom/target)
// todo: also show initiator the progress bar
return new /datum/progressbar(e_args.performer, goal_number, target)

/datum/progressbar
var/goal = 1
var/image/bar
Expand Down
10 changes: 7 additions & 3 deletions code/game/atoms/action_feedback.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
*
* @params
* * target - target atom
* * initiator - additional thing to show a message to as self
* * hard_range - how far to display hard message; defaults to MESSAGE_RANGE_COMBAT_LOUD. if doesn't exist we use soft.
* * soft_range - how far to display soft message; defaults to MESSAGE_RANGE_COMBAT_LOUD. overrides hard range if smaller.
* * visible_hard - hard message. if doesn't exist we use soft message.
* * audible_hard - what blind people hear when inside hard range. if doesn't exist we use soft message.
* * visible_soft - soft message.
* * audible_soft - what blind people hear when inside soft range (overridden by self and them if specified)
* * visible_self - what we see
* * audible_self - override if self is blind. if null, defaults to 'self.
* * otherwise_self - override if self is blind. if null, defaults to 'self.
* * visible_them - what the target see
* * audible_them - what the target sees if they are blind. if null, defaults to 'them'.
* * otherwise_them - what the target sees if they are blind. if null, defaults to 'them'.
*/
/atom/proc/visible_action_feedback(atom/target, hard_range = MESSAGE_RANGE_COMBAT_LOUD, soft_range, visible_hard, audible_hard, audible_soft, visible_soft, visible_self, audible_self, visible_them, audible_them)
/atom/proc/visible_action_feedback(atom/target, atom/initiator, hard_range = MESSAGE_RANGE_COMBAT_LOUD, soft_range, visible_hard, audible_hard, audible_soft, visible_soft, visible_self, otherwise_self, visible_them, otherwise_them)
var/list/viewing
var/viewing_range = max(soft_range, hard_range)
//! LEGACY
Expand All @@ -30,6 +31,9 @@
//! end
var/hard_visible = visible_hard || visible_soft
var/hard_audible = audible_hard || audible_soft
visible_self = visible_self || otherwise_self
visible_them = visible_them || otherwise_them
// todo: all of this needs rewritten oh my god
for(var/atom/movable/AM as anything in viewing)
if(get_dist(AM, src) <= hard_range)
if(ismob(AM))
Expand Down
6 changes: 5 additions & 1 deletion code/game/atoms/atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
/// armor datum type
var/armor_type = /datum/armor/none

//? Context
/// open context menus by mob
var/list/context_menus

//? Economy
/// intrinsic worth without accounting containing reagents / materials - applies in static and dynamic mode.
var/worth_intrinsic = 0
Expand Down Expand Up @@ -873,7 +877,7 @@
return reagents && (reagents.reagents_holder_flags & DRAINABLE)


/atom/proc/get_cell()
/atom/proc/get_cell(inducer)
return

//? Radiation
Expand Down
2 changes: 2 additions & 0 deletions code/game/click/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@

/atom/proc/AltClick(var/mob/user)
SEND_SIGNAL(src, COMSIG_CLICK_ALT, user)
if(context_menu(new /datum/event_args/actor(user)))
return TRUE
return FALSE

// todo: rework
Expand Down
Loading

0 comments on commit 67a2e7a

Please sign in to comment.