-
-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into mech-clamp-fix
- Loading branch information
Showing
37 changed files
with
558 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#define INIT_PROFILE_NAME "init_profiler.json" | ||
|
||
///Subsystem exists so we can separately log init time costs from the costs of general operation | ||
///Hopefully this makes sorting out what causes problems when easier | ||
SUBSYSTEM_DEF(init_profiler) | ||
name = "Init Profiler" | ||
init_order = INIT_ORDER_INIT_PROFILER | ||
init_stage = INITSTAGE_MAX | ||
flags = SS_NO_FIRE | ||
|
||
/datum/controller/subsystem/init_profiler/Initialize() | ||
if(CONFIG_GET(flag/auto_profile)) | ||
write_init_profile() | ||
return SS_INIT_SUCCESS | ||
|
||
/datum/controller/subsystem/init_profiler/proc/write_init_profile() | ||
var/current_profile_data = world.Profile(PROFILE_REFRESH, format = "json") | ||
CHECK_TICK | ||
|
||
if(!length(current_profile_data)) //Would be nice to have explicit proc to check this | ||
stack_trace("Warning, profiling stopped manually before dump.") | ||
var/prof_file = file("[GLOB.log_directory]/[INIT_PROFILE_NAME]") | ||
if(fexists(prof_file)) | ||
fdel(prof_file) | ||
WRITE_FILE(prof_file, current_profile_data) | ||
world.Profile(PROFILE_CLEAR) //Now that we're written this data out, dump it. We don't want it getting mixed up with our current round data | ||
|
||
#undef INIT_PROFILE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
///This component allows something to be when crossed, for example for cockroaches. | ||
/datum/component/squashable | ||
///Chance on crossed to be squashed | ||
var/squash_chance = 50 | ||
///How much brute is applied when mob is squashed | ||
var/squash_damage = 1 | ||
///Squash flags, for extra checks etcetera. | ||
var/squash_flags = NONE | ||
///Special callback to call on squash instead, for things like hauberoach | ||
var/datum/callback/on_squash_callback | ||
///signal list given to connect_loc | ||
var/static/list/loc_connections = list( | ||
COMSIG_ATOM_ENTERED = PROC_REF(on_entered), | ||
) | ||
|
||
|
||
/datum/component/squashable/Initialize(squash_chance, squash_damage, squash_flags, squash_callback) | ||
. = ..() | ||
if(!isliving(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
if(squash_chance) | ||
src.squash_chance = squash_chance | ||
if(squash_damage) | ||
src.squash_damage = squash_damage | ||
if(squash_flags) | ||
src.squash_flags = squash_flags | ||
if(!src.on_squash_callback && squash_callback) | ||
on_squash_callback = CALLBACK(parent, squash_callback) | ||
|
||
AddComponent(/datum/component/connect_loc_behalf, parent, loc_connections) | ||
|
||
/datum/component/squashable/Destroy(force) | ||
on_squash_callback = null | ||
return ..() | ||
|
||
///Handles the squashing of the mob | ||
/datum/component/squashable/proc/on_entered(turf/source_turf, atom/movable/crossing_movable) | ||
// SIGNAL_HANDLER -- dont uncomment this | ||
|
||
if(parent == crossing_movable) | ||
return | ||
|
||
var/mob/living/parent_as_living = parent | ||
if((squash_flags & SQUASHED_DONT_SQUASH_IN_CONTENTS) && !isturf(parent_as_living.loc)) | ||
return | ||
|
||
if((squash_flags & SQUASHED_SHOULD_BE_DOWN) && parent_as_living.body_position != LYING_DOWN) | ||
return | ||
|
||
var/should_squash = ((squash_flags & SQUASHED_ALWAYS_IF_DEAD) && parent_as_living.stat == DEAD) || prob(squash_chance) | ||
|
||
if(should_squash && on_squash_callback) | ||
if(on_squash_callback.Invoke(parent_as_living, crossing_movable)) | ||
return //Everything worked, we're done! | ||
if(isliving(crossing_movable)) | ||
var/mob/living/crossing_mob = crossing_movable | ||
if(crossing_mob.mob_size > MOB_SIZE_SMALL && !(crossing_mob.movement_type & MOVETYPES_NOT_TOUCHING_GROUND)) | ||
if(HAS_TRAIT(crossing_mob, TRAIT_PACIFISM)) | ||
crossing_mob.visible_message(span_notice("[crossing_mob] carefully steps over [parent_as_living]."), span_notice("You carefully step over [parent_as_living] to avoid hurting it.")) | ||
return | ||
if(should_squash) | ||
crossing_mob.visible_message(span_notice("[crossing_mob] squashed [parent_as_living]."), span_notice("You squashed [parent_as_living].")) | ||
Squish(parent_as_living) | ||
else | ||
parent_as_living.visible_message(span_notice("[parent_as_living] avoids getting crushed.")) | ||
else if(isstructure(crossing_movable)) | ||
if(should_squash) | ||
crossing_movable.visible_message(span_notice("[parent_as_living] is crushed under [crossing_movable].")) | ||
Squish(parent_as_living) | ||
else | ||
parent_as_living.visible_message(span_notice("[parent_as_living] avoids getting crushed.")) | ||
|
||
/datum/component/squashable/proc/Squish(mob/living/target) | ||
if(squash_flags & SQUASHED_SHOULD_BE_GIBBED) | ||
target.gib(DROP_ALL_REMAINS) | ||
else | ||
target.adjustBruteLoss(squash_damage) | ||
|
||
/datum/component/squashable/UnregisterFromParent() | ||
. = ..() | ||
qdel(GetComponent(/datum/component/connect_loc_behalf)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.