Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SyncIt21 committed Dec 30, 2024
2 parents 4c198d3 + 2fcc559 commit 21ff04d
Show file tree
Hide file tree
Showing 39 changed files with 200 additions and 93 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@

/// From whoever has been revealed (atom/revealed)
#define COMSIG_ATOM_REVEAL "atom_reveal"

/// From /atom/proc/set_density(new_value) for when an atom changes density
#define COMSIG_ATOM_DENSITY_CHANGED "atom_density_change"
29 changes: 28 additions & 1 deletion code/__DEFINES/tgs.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tgstation-server DMAPI
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF RFC 2119.

#define TGS_DMAPI_VERSION "7.3.0"
#define TGS_DMAPI_VERSION "7.3.1"

// All functions and datums outside this document are subject to change with any version and should not be relied on.

Expand Down Expand Up @@ -58,6 +58,11 @@
#define TGS_FILE2TEXT_NATIVE file2text
#endif

// SpacemanDMM compatibility
#ifndef CAN_BE_REDEFINED
#define CAN_BE_REDEFINED(X)
#endif

// EVENT CODES

/// Before a reboot mode change, extras parameters are the current and new reboot mode enums.
Expand Down Expand Up @@ -160,6 +165,7 @@
* * http_handler - Optional user defined [/datum/tgs_http_handler].
*/
/world/proc/TgsNew(datum/tgs_event_handler/event_handler, minimum_required_security_level = TGS_SECURITY_ULTRASAFE, datum/tgs_http_handler/http_handler)
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -170,13 +176,15 @@
* This function should not be called before ..() in [/world/proc/New].
*/
/world/proc/TgsInitializationComplete()
CAN_BE_REDEFINED(TRUE)
return

/// Consumers MUST run this macro at the start of [/world/proc/Topic].
#define TGS_TOPIC var/tgs_topic_return = TgsTopic(args[1]); if(tgs_topic_return) return tgs_topic_return

/// Consumers MUST call this as late as possible in [world/proc/Reboot] (BEFORE ..()).
/world/proc/TgsReboot()
CAN_BE_REDEFINED(TRUE)
return

// DATUM DEFINITIONS
Expand Down Expand Up @@ -214,6 +222,7 @@
* Returns [TRUE]/[FALSE] based on if the [/datum/tgs_version] contains wildcards.
*/
/datum/tgs_version/proc/Wildcard()
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -222,6 +231,7 @@
* other_version - The [/datum/tgs_version] to compare against.
*/
/datum/tgs_version/proc/Equals(datum/tgs_version/other_version)
CAN_BE_REDEFINED(TRUE)
return

/// Represents a merge of a GitHub pull request.
Expand Down Expand Up @@ -459,16 +469,19 @@

/// Returns the maximum supported [/datum/tgs_version] of the DMAPI.
/world/proc/TgsMaximumApiVersion()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the minimum supported [/datum/tgs_version] of the DMAPI.
/world/proc/TgsMinimumApiVersion()
CAN_BE_REDEFINED(TRUE)
return

/**
* Returns [TRUE] if DreamDaemon was launched under TGS, the API matches, and was properly initialized. [FALSE] will be returned otherwise.
*/
/world/proc/TgsAvailable()
CAN_BE_REDEFINED(TRUE)
return

// No function below this succeeds if it TgsAvailable() returns FALSE or if TgsNew() has yet to be called.
Expand All @@ -480,6 +493,7 @@
* If TGS has not requested a [TGS_REBOOT_MODE_SHUTDOWN] DreamDaemon will be launched again.
*/
/world/proc/TgsEndProcess()
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -490,6 +504,7 @@
* admin_only: If [TRUE], message will be sent to admin connected chats. Vice-versa applies.
*/
/world/proc/TgsTargetedChatBroadcast(datum/tgs_message_content/message, admin_only = FALSE)
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -500,6 +515,7 @@
* user: The [/datum/tgs_chat_user] to PM.
*/
/world/proc/TgsChatPrivateMessage(datum/tgs_message_content/message, datum/tgs_chat_user/user)
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -510,42 +526,52 @@
* channels - Optional list of [/datum/tgs_chat_channel]s to restrict the message to.
*/
/world/proc/TgsChatBroadcast(datum/tgs_message_content/message, list/channels = null)
CAN_BE_REDEFINED(TRUE)
return

/// Returns the current [/datum/tgs_version] of TGS if it is running the server, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsVersion()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the running engine type
/world/proc/TgsEngine()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the current [/datum/tgs_version] of the DMAPI being used if it was activated, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsApiVersion()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the name of the TGS instance running the game if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsInstanceName()
CAN_BE_REDEFINED(TRUE)
return

/// Return the current [/datum/tgs_revision_information] of the running server if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsRevision()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the current BYOND security level as a TGS_SECURITY_ define if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsSecurityLevel()
CAN_BE_REDEFINED(TRUE)
return

/// Returns the current BYOND visibility level as a TGS_VISIBILITY_ define if TGS is present, null otherwise. Requires TGS to be using interop API version 5 or higher otherwise the string "___unimplemented" wil be returned. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsVisibility()
CAN_BE_REDEFINED(TRUE)
return

/// Returns a list of active [/datum/tgs_revision_information/test_merge]s if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsTestMerges()
CAN_BE_REDEFINED(TRUE)
return

/// Returns a list of connected [/datum/tgs_chat_channel]s if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
/world/proc/TgsChatChannelInfo()
CAN_BE_REDEFINED(TRUE)
return

/**
Expand All @@ -556,6 +582,7 @@
* wait_for_completion - If set, this function will not return until the event has run to completion.
*/
/world/proc/TgsTriggerEvent(event_name, list/parameters, wait_for_completion = FALSE)
CAN_BE_REDEFINED(TRUE)
return

/*
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/ground_sinking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
/datum/component/ground_sinking/proc/finish_sinking(mob/living/basic/living_target)
sinked = TRUE
is_sinking = FALSE
living_target.density = FALSE
living_target.set_density(FALSE)
living_target.damage_coeff = damage_res_sinked
if(heal_when_sinked)
start_regenerating()
Expand All @@ -113,7 +113,7 @@
stop_regenerating()
living_target.icon_state = target_icon_state
living_target.damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, STAMINA = 0, OXY = 1)
living_target.density = TRUE
living_target.set_density(TRUE)
sinked = FALSE

/// The mop starts regaining health
Expand Down
31 changes: 30 additions & 1 deletion code/datums/components/leanable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
var/leaning_offset = 11
/// List of mobs currently leaning on our parent
var/list/leaning_mobs = list()
/// Is this object currently leanable?
var/is_currently_leanable = TRUE

/datum/component/leanable/Initialize(mob/living/leaner, leaning_offset = 11)
. = ..()
Expand All @@ -13,15 +15,32 @@
/datum/component/leanable/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOUSEDROPPED_ONTO, PROC_REF(mousedrop_receive))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
RegisterSignal(parent, COMSIG_ATOM_DENSITY_CHANGED, PROC_REF(on_density_change))
var/atom/leanable_atom = parent
is_currently_leanable = leanable_atom.density

/datum/component/leanable/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, list(
COMSIG_MOVABLE_MOVED,
COMSIG_MOUSEDROPPED_ONTO,
COMSIG_ATOM_DENSITY_CHANGED,
))

/datum/component/leanable/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOUSEDROPPED_ONTO, COMSIG_MOVABLE_MOVED))

/datum/component/leanable/Destroy(force)
stop_leaning_leaners()
return ..()

/datum/component/leanable/proc/stop_leaning_leaners(fall)
for (var/mob/living/leaner as anything in leaning_mobs)
leaner.stop_leaning()
if(fall)
to_chat(leaner, span_danger("You lose balance!"))
leaner.Paralyze(0.5 SECONDS)
leaning_mobs = null
return ..()

/datum/component/leanable/proc/on_moved(datum/source)
SIGNAL_HANDLER
Expand All @@ -42,6 +61,8 @@
var/turf/checked_turf = get_step(leaner, REVERSE_DIR(leaner.dir))
if (checked_turf != get_turf(source))
return
if(!is_currently_leanable)
return COMPONENT_CANCEL_MOUSEDROPPED_ONTO
leaner.start_leaning(source, leaning_offset)
leaning_mobs += leaner
RegisterSignals(leaner, list(COMSIG_LIVING_STOPPED_LEANING, COMSIG_QDELETING), PROC_REF(stopped_leaning))
Expand Down Expand Up @@ -118,3 +139,11 @@

if (old_dir != new_dir)
INVOKE_ASYNC(src, PROC_REF(stop_leaning))

/datum/component/leanable/proc/on_density_change()
SIGNAL_HANDLER
is_currently_leanable = !is_currently_leanable
if(!is_currently_leanable)
stop_leaning_leaners(fall = TRUE)
return
stop_leaning_leaners()
12 changes: 6 additions & 6 deletions code/datums/components/pet_commands/pet_command.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,12 @@
SIGNAL_HANDLER
if(!can_see(source, target, 9))
return COMSIG_MOB_CANCEL_CLICKON
on_target_set(source, target)
var/manual_emote_text = generate_emote_command(target)
if(on_target_set(source, target) && !isnull(manual_emote_text))
INVOKE_ASYNC(source, TYPE_PROC_REF(/atom, manual_emote), manual_emote_text)
UnregisterSignal(source, COMSIG_MOB_CLICKON)
source.client?.mouse_override_icon = source.client::mouse_override_icon
source.update_mouse_pointer()
var/manual_emote_text = generate_emote_command(target)
if(!isnull(manual_emote_text))
INVOKE_ASYNC(source, TYPE_PROC_REF(/atom, manual_emote), manual_emote_text)
return COMSIG_MOB_CANCEL_CLICKON

/datum/pet_command/proc/point_on_target(mob/living/friend, atom/potential_target)
Expand Down Expand Up @@ -214,11 +213,12 @@
/datum/pet_command/proc/on_target_set(mob/living/friend, atom/potential_target)
var/mob/living/parent = weak_parent.resolve()
if (!parent)
return
return FALSE

parent.ai_controller.CancelActions()
if(!look_for_target(friend, potential_target) || !set_command_target(parent, potential_target))
return
return FALSE
parent.visible_message(span_warning("[parent] follows [friend]'s gesture towards [potential_target] [pointed_reaction]!"))
return TRUE


18 changes: 9 additions & 9 deletions code/datums/components/pet_commands/pet_commands_basic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@
// Refuse to target things we can't target, chiefly other friends
/datum/pet_command/attack/set_command_target(mob/living/parent, atom/target)
if (!target)
return
return FALSE
var/mob/living/living_parent = parent
if (!living_parent.ai_controller)
return
return FALSE
var/datum/targeting_strategy/targeter = GET_TARGETING_STRATEGY(living_parent.ai_controller.blackboard[targeting_strategy_key])
if (!targeter)
return
return FALSE
if (!targeter.can_attack(living_parent, target))
refuse_target(parent, target)
return
return FALSE
return ..()

/datum/pet_command/attack/retrieve_command_text(atom/living_pet, atom/target)
Expand Down Expand Up @@ -186,16 +186,16 @@

/datum/pet_command/breed/set_command_target(mob/living/parent, atom/target)
if(isnull(target) || !isliving(target))
return
return FALSE
if(!HAS_TRAIT(parent, TRAIT_MOB_BREEDER) || !HAS_TRAIT(target, TRAIT_MOB_BREEDER))
return
return FALSE
if(isnull(parent.ai_controller))
return
return FALSE
if(!parent.ai_controller.blackboard[BB_BREED_READY] || isnull(parent.ai_controller.blackboard[BB_BABIES_PARTNER_TYPES]))
return
return FALSE
var/mob/living/living_target = target
if(!living_target.ai_controller?.blackboard[BB_BREED_READY])
return
return FALSE
return ..()

/datum/pet_command/breed/execute_action(datum/ai_controller/controller)
Expand Down
2 changes: 1 addition & 1 deletion code/game/atom/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
return
. = density
density = new_value

SEND_SIGNAL(src, COMSIG_ATOM_DENSITY_CHANGED)

///Setter for the `base_pixel_x` variable to append behavior related to its changing.
/atom/proc/set_base_pixel_x(new_value)
Expand Down
8 changes: 8 additions & 0 deletions code/game/machinery/airlock_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
var/airlock_state
var/frequency


/obj/machinery/door/airlock/mouse_drop_receive(mob/living/dropping, mob/user, params)
. = ..()
// We add the component only once here & not in Initialize() because there are tons of airlocks & we don't want to add to their init times
// This is on airlock rather than on door because windoors are door and leaning looks whack on windoors
LoadComponent(/datum/component/leanable, dropping)


/// Forces the airlock to unbolt and open
/obj/machinery/door/airlock/proc/secure_open()
locked = FALSE
Expand Down
5 changes: 5 additions & 0 deletions code/game/machinery/computer/_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
. = ..()
power_change()

/obj/machinery/computer/mouse_drop_receive(mob/living/dropping, mob/user, params)
. = ..()
// We add the component only once here & not in Initialize() because there are tons of computers & we don't want to add to their init times
LoadComponent(/datum/component/leanable, dropping)

/obj/machinery/computer/CanAllowThrough(atom/movable/mover, border_dir) // allows projectiles to fly over the computer
. = ..()
if(.)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1355,15 +1355,15 @@
if(air_tight)
set_density(TRUE)
if(multi_tile)
filler.density = TRUE
filler.set_density(TRUE)
flags_1 |= PREVENT_CLICK_UNDER_1
air_update_turf(TRUE, TRUE)
var/unpassable_delay = animation_segment_delay(AIRLOCK_CLOSING_UNPASSABLE)
sleep(unpassable_delay)
if(!air_tight)
set_density(TRUE)
if(multi_tile)
filler.density = TRUE
filler.set_density(TRUE)
flags_1 |= PREVENT_CLICK_UNDER_1
air_update_turf(TRUE, TRUE)
var/opaque_delay = animation_segment_delay(AIRLOCK_CLOSING_OPAQUE) - unpassable_delay
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/modular_shield.dm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
/obj/machinery/modular_shield_generator/proc/finish_field()

for(var/obj/structure/emergency_shield/modular/current_shield in deployed_shields)
current_shield.density = TRUE
current_shield.set_density(TRUE)
current_shield.alpha = 255
initiating = FALSE

Expand Down
Loading

0 comments on commit 21ff04d

Please sign in to comment.