-
Notifications
You must be signed in to change notification settings - Fork 76
[TM FIRST] Рассказчики #5777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[TM FIRST] Рассказчики #5777
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| #define LOG_CATEGORY_STORYTELLER "storyteller" | ||
| #define LOG_CATEGORY_STORYTELLER_PLANNER "storyteller_planner" | ||
| #define LOG_CATEGORY_STORYTELLER_ANALYZER "storyteller_analyzer" | ||
| #define LOG_CATEGORY_STORYTELLER_BALANCER "storyteller_balancer" | ||
| #define LOG_CATEGORY_STORYTELLER_METRICS "storyteller_metrics" | ||
| #define ADMIN_CATEGORY_STORYTELLER "Admin.Storyteller" | ||
|
|
||
| /proc/log_storyteller(text, list/data) | ||
| logger.Log(LOG_CATEGORY_STORYTELLER, text, data) | ||
|
|
||
| /proc/log_storyteller_planner(text, list/data) | ||
| logger.Log(LOG_CATEGORY_STORYTELLER_PLANNER, text, data) | ||
|
|
||
| /proc/log_storyteller_analyzer(text, list/data) | ||
| logger.Log(LOG_CATEGORY_STORYTELLER_ANALYZER, text, data) | ||
|
|
||
| /proc/log_storyteller_balancer(text, list/data) | ||
| logger.Log(LOG_CATEGORY_STORYTELLER_BALANCER, text, data) | ||
|
|
||
| /proc/log_storyteller_metrics(text, list/data) | ||
| logger.Log(LOG_CATEGORY_STORYTELLER_METRICS, text, data) | ||
|
|
||
|
|
||
| /proc/pick_map_spawn_location(spawn_radius = 10, z_level) | ||
| RETURN_TYPE(/list) | ||
|
|
||
| var/list/corners = list( | ||
| list(x=1, y=1, z=z_level), | ||
| list(x=1, y=world.maxy, z=z_level), | ||
| list(x=world.maxx, y=1, z=z_level), | ||
| list(x=world.maxx, y=world.maxy, z=z_level) | ||
| ) | ||
|
|
||
| var/list/selected_corner = pick(corners) | ||
| var/turf/center_turf = locate(selected_corner["x"], selected_corner["y"], selected_corner["z"]) | ||
| if(!center_turf) | ||
| return list() | ||
|
|
||
|
|
||
| var/list/edge_turfs = list() | ||
| for(var/turf/TURF in range(spawn_radius, center_turf)) | ||
| if(TURF.x == 1 || TURF.x == world.maxx || TURF.y == 1 || TURF.y == world.maxy) | ||
| if(istype(TURF, /turf/open) && !TURF.density) | ||
| edge_turfs += TURF | ||
|
|
||
| if(!length(edge_turfs)) | ||
| edge_turfs += center_turf | ||
|
|
||
| return edge_turfs | ||
|
|
||
|
|
||
| /proc/get_inventory(atom/holder, recursive = TRUE) | ||
| RETURN_TYPE(/list) | ||
|
|
||
| . = list() | ||
| if(!holder || istype(holder) || !length(holder.contents)) | ||
| return . | ||
|
|
||
| for(var/atom/atom in holder.contents) | ||
| . += atom | ||
| if(length(atom.contents) && recursive) | ||
| . += get_inventory(atom) | ||
|
|
||
| return . | ||
|
|
||
|
|
||
| /proc/is_safe_area(area/to_check) | ||
| var/list/vents = to_check.air_vents | ||
| var/total_vents = length(vents) | ||
| var/unsafe_vents = 0 | ||
|
|
||
| var/static/list/safe_gases = list( | ||
| /datum/gas/oxygen = list(16, 100), | ||
| /datum/gas/nitrogen, | ||
| /datum/gas/carbon_dioxide = list(0, 10) | ||
| ) | ||
|
|
||
| for(var/obj/machinery/atmospherics/components/unary/vent_pump/vent in vents) | ||
| var/turf/open/T = get_turf(vent) | ||
| var/datum/gas_mixture/floor_gas_mixture = T.air | ||
| if(!floor_gas_mixture) | ||
| unsafe_vents += 1 | ||
| continue | ||
|
Comment on lines
+78
to
+83
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше проверяй через var/turf/T, потому что венты могут быть в стенах и насколько я понял здесь они считаются как безопасные. Мб проверять тип турфа (closed или тп) и потом уже газы |
||
|
|
||
| var/list/floor_gases = floor_gas_mixture.gases | ||
| if(!check_gases(floor_gases, safe_gases)) | ||
| unsafe_vents += 1 | ||
| continue | ||
|
|
||
| if((floor_gas_mixture.temperature <= 270) || (floor_gas_mixture.temperature >= 360)) | ||
| unsafe_vents += 1 | ||
| continue | ||
|
|
||
| var/pressure = floor_gas_mixture.return_pressure() | ||
| if((pressure <= 20) || (pressure >= 550)) | ||
| unsafe_vents += 1 | ||
| continue | ||
|
Comment on lines
+90
to
+97
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 270, 360 температуру и 20, 550 замени на дефайны BODYTEMP_COLD_DAMAGE_LIMIT, BODYTEMP_HEAT_DAMAGE_LIMIT и HAZARD_LOW_PRESSURE, HAZARD_HIGH_PRESSURE (atmos_mob_interaction.dm в помощь) |
||
|
|
||
| if(!(total_vents == 1 && unsafe_vents == 0)) | ||
| return !(unsafe_vents > round(total_vents * 0.5)) | ||
|
Comment on lines
+99
to
+100
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Возможно я не понимаю тонкости 100 строки, но не проще было бы вписать false? |
||
| return TRUE | ||
|
|
||
| /proc/pick_weight_f(list/list_to_pick) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Документация. Буквально. Функция pick_weight_f вычисляет CUM предметов 😄 |
||
| if(length(list_to_pick) == 0) | ||
| return null | ||
|
|
||
| var/total = 0.0 | ||
| for(var/item in list_to_pick) | ||
| var/weight = list_to_pick[item] | ||
| if(!isnum(weight) || weight < 0) | ||
| list_to_pick[item] = 0 | ||
| continue | ||
| total += weight | ||
|
|
||
| if(total <= 0) | ||
| return null | ||
|
|
||
|
|
||
| var/list/cumulative = list() | ||
| var/cum_sum = 0.0 | ||
| for(var/item in list_to_pick) | ||
| var/weight = list_to_pick[item] | ||
| if(weight <= 0) | ||
| continue | ||
| cum_sum += weight | ||
| cumulative += list(list("item" = item, "cum" = cum_sum)) | ||
|
|
||
| if(length(cumulative) == 0) | ||
| return null | ||
|
|
||
|
|
||
| #define PRECISION 1000000 | ||
| var/rand_float = rand(1, PRECISION) / PRECISION | ||
| #undef PRECISION | ||
|
|
||
| var/target = rand_float * total | ||
| for(var/entry in cumulative) | ||
| if(entry["cum"] >= target) | ||
| return entry["item"] | ||
|
|
||
| return cumulative[cumulative.len]["item"] | ||
|
|
||
| /proc/get_nearest_atoms(atom/center, type = /atom/movable, range = 7) | ||
| var/list/candidates = SSspatial_grid.orthogonal_range_search(center, SPATIAL_GRID_CONTENTS_TYPE_ATMOS, range) // Using ATMOS as example; adjust type if needed | ||
| var/list/nearby_atoms = list() | ||
| var/turf/center_turf = get_turf(center) | ||
| for(var/atom/A in candidates) | ||
| if(istype(A, type) && get_dist(center_turf, get_turf(A)) <= range) | ||
| nearby_atoms += A | ||
| return nearby_atoms | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #define STORYTELLER_EVENT storyteller_implementation = TRUE | ||
| /proc/is_storyteller_event(_evt) | ||
| if(istype(_evt, /datum/round_event)) | ||
| var/datum/round_event/evt = _evt | ||
| return evt.storyteller_implementation | ||
| else | ||
| return FALSE | ||
|
|
||
| #define BB_RAIDER_GROUP_LEADER "BB_raider_group_leader" | ||
| #define BB_RAIDER_STRIKE_POINT "BB_raider_strike_point" | ||
| #define BB_RAIDER_HIGH_VALUE_AREAS "BB_raider_hightvalue_areas" | ||
| #define BB_RAIDER_CURRENT_OBJECTIVE "BB_raider_current_objective" | ||
| #define BB_RAIDER_GROUP_MEMBERS "BB_raider_group_members" | ||
| #define BB_RAIDER_ATTACK_METHOD "BB_raider_attack_method" | ||
| #define BB_RAIDER_INTERESTING_ITEMS "BB_raider_interesting_items" | ||
| #define BB_RAIDER_INTERESTING_TARGETS "BB_raider_interesting_targets" | ||
| #define BB_RAIDER_MY_ROLE "BB_raider_my_role" | ||
| #define BB_RAIDER_ROLE_LEADER "BB_raider_role_leader" | ||
| #define BB_RAIDER_ROLE_MEMBER "BB_raider_role_member" | ||
| #define BB_RAIDER_ROLE_SHOOTER "BB_raider_role_shooter" | ||
| #define BB_RAIDER_ROLE_LOOTER "BB_raider_role_looter" | ||
| #define BB_RAIDER_ROLE_SABOTEUR "BB_raider_role_saboteur" | ||
| #define BB_RAIDER_VALUABLE_OBJECTS "BB_raider_valuable_objects" | ||
| #define BB_RAIDER_TEAM "BB_raider_team" | ||
| #define BB_RAIDER_REACH_STRIKE_POINT "BB_raider_reach_strike_point" | ||
| #define BB_RAIDER_PATH_WAYPOINTS "BB_raider_path_waipoints" | ||
| #define BB_RAIDER_FINAL_DESTINATION "BB_raider_final_deestination" | ||
| #define BB_PATH_FINDER "BB_my_pathfinder" | ||
| #define BB_RAIDER_DESTRUCTION_TARGET "BB_raider_destruction_target" | ||
| #define BB_RAIDER_LOOT_TARGET "BB_raider_loot_target" | ||
| #define BB_RAIDER_SEARCH_COOLDOWN_END "BB_riader_search_cooldown_end" | ||
| #define BB_RAIDER_HOLD_COOLDOWN_END "BB_raider_hold_cooldown_end" | ||
|
|
||
| #define TRAIT_NO_REBOOT_EVENT "stroyteller_trait_no_reboot_event" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // From /datum/storyteller_analyzer/proc/scan_station() | ||
| #define COMSIG_STORYTELLER_RUN_METRICS "comsig_storyteller_run_metrics" | ||
|
|
||
| // From /datum/storyteller_analyzer/proc/scan_station(), storyteller_inputs/inputs, timeout, total_metrics | ||
| #define COMSIG_STORYTELLER_FINISHED_ANALYZING "comsig_storyteller_finish_analyzing" | ||
|
|
||
| // From /datum/storyteller/proc/think() | ||
| #define COMSIG_STORYTELLER_PRE_THINK "comsig_storyteller_pre_think" | ||
| // Use to prevent thinking | ||
| #define COMPONENT_THINK_BLOCKED (1 << 0) | ||
|
|
||
| // From /datum/storyteller/proc/think() | ||
| #define COMSIG_STORYTELLER_POST_THINK "comsig_storyteller_post_think" | ||
|
|
||
| // From /datum/controller/subsystem/storytellers/proc/start_vote() | ||
| #define COMSIG_STORYTELLER_VOTE_START "comsig_stryteller_vote_start" | ||
|
|
||
| // From /datum/controller/subsystem/storytellers/proc/end_vote() | ||
| #define COMSIG_STORYTELLER_VOTE_END "comsig_stryteller_vote_end" | ||
|
|
||
| /// Called by (/datum/round_event_control/run_event_as_storyteller). | ||
| #define COMSIG_GLOB_STORYTELLER_RUN_EVENT "!storyteller_event" | ||
| /// Do not allow this random event to continue. | ||
| #define CANCEL_STORYTELLER_EVENT (1<<0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Время нанести первый удар по 15к строкам кода и первая стрела называется "ЗАНУДСТВО".
Я бы в целом посоветовал некоторую часть файлов переименовал, как например у тебя в этом файле по сути helper'sы для сторителлеров, но функции теоретически можно применять и в других местах. Если не забуду то укажу и остальные такие файлы.
А второе, это названия функций и отсутствие документации к ним. Интуитивно не смотря в код трудно понять зачем оно и как определяется безопасность комнаты.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Забыл указать. Забыл какие нужно. Альцг.......