Skip to content

Commit

Permalink
Merge pull request Civ13#2782 from Bierkraan/working-branch
Browse files Browse the repository at this point in the history
Update to RU civ
  • Loading branch information
Bierkraan authored Apr 29, 2024
2 parents eab58cd + e895de3 commit b63061d
Show file tree
Hide file tree
Showing 185 changed files with 8,772 additions and 1,412 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ map_backups/
maps/test/
tts/
config/host.txt
maps/campaign/campaign8.dmm
civ13od.dme
odcomp.bat

config/host.txt
29 changes: 29 additions & 0 deletions _auxtools.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 515 split call for external libraries into call_ext
#if DM_VERSION < 515
#define LIBCALL call
#else
#define LIBCALL call_ext
#endif

// Спизженно с фарвеба

/proc/auxtools_stack_trace(msg)
CRASH(msg)

/proc/enable_debugging(mode, port)
CRASH("auxtools not loaded")

/world/New()
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
LIBCALL(debug_server, "auxtools_init")()
enable_debugging()
. = ..()

/world/Del()
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
LIBCALL(debug_server, "auxtools_shutdown")()
. = ..()

/proc/auxtools_expr_stub()
Binary file added byond-extools.dll
Binary file not shown.
41 changes: 38 additions & 3 deletions civ13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define DEBUG
// END_PREFERENCES
// BEGIN_INCLUDE
#include "_auxtools.dm"
#include "code\__byond_version_compat.dm"
#include "code\_macros.dm"
#include "code\client_macros.dm"
#include "code\global.dm"
Expand All @@ -23,35 +25,51 @@
#include "code\setup.dm"
#include "code\stylesheet.dm"
#include "code\world.dm"
#include "code\__defines\__game.dm"
#include "code\__defines\__spacemandmm.dm"
#include "code\__defines\_globals.dm"
#include "code\__defines\_planes+layers.dm"
#include "code\__defines\_rust_g.dm"
#include "code\__defines\_tick.dm"
#include "code\__defines\admin.dm"
#include "code\__defines\appearance.dm"
#include "code\__defines\attachment.dm"
#include "code\__defines\callback.dm"
#include "code\__defines\chemistry.dm"
#include "code\__defines\cooldowns.dm"
#include "code\__defines\damage.dm"
#include "code\__defines\damage_organs.dm"
#include "code\__defines\faction_lang_defines.dm"
#include "code\__defines\flags.dm"
#include "code\__defines\gun.dm"
#include "code\__defines\inventory_sizes.dm"
#include "code\__defines\items_clothing.dm"
#include "code\__defines\maps.dm"
#include "code\__defines\math_physics.dm"
#include "code\__defines\MC.dm"
#include "code\__defines\misc.dm"
#include "code\__defines\mobs.dm"
#include "code\__defines\qdel.dm"
#include "code\__defines\regexes.dm"
#include "code\__defines\respawn.dm"
#include "code\__defines\seasons.dm"
#include "code\__defines\species_languages.dm"
#include "code\__defines\stats.dm"
#include "code\__defines\subsystem.dm"
#include "code\__defines\targeting.dm"
#include "code\__defines\time.dm"
#include "code\__defines\time_of_day.dm"
#include "code\__defines\turfs.dm"
#include "code\__defines\weather.dm"
#include "code\__defines\WWinput.dm"
#include "code\__defines\dcs\flags.dm"
#include "code\__defines\dcs\helpers.dm"
#include "code\__defines\dcs\signals.dm"
#include "code\_globalvars\configuration.dm"
#include "code\_helpers\_logging.dm"
#include "code\_helpers\areas.dm"
#include "code\_helpers\cmp.dm"
#include "code\_helpers\datum_pool.dm"
#include "code\_helpers\debugger.dm"
#include "code\_helpers\directions.dm"
#include "code\_helpers\distance.dm"
#include "code\_helpers\files.dm"
Expand All @@ -60,22 +78,22 @@
#include "code\_helpers\global_lists.dm"
#include "code\_helpers\icons.dm"
#include "code\_helpers\lists.dm"
#include "code\_helpers\logging.dm"
#include "code\_helpers\maths.dm"
#include "code\_helpers\matrices.dm"
#include "code\_helpers\mobs.dm"
#include "code\_helpers\names.dm"
#include "code\_helpers\qdel.dm"
#include "code\_helpers\sanitize_values.dm"
#include "code\_helpers\shell.dm"
#include "code\_helpers\sorts.dm"
#include "code\_helpers\spawn_sync.dm"
#include "code\_helpers\text.dm"
#include "code\_helpers\time.dm"
#include "code\_helpers\translation.dm"
#include "code\_helpers\turfs.dm"
#include "code\_helpers\type2type.dm"
#include "code\_helpers\unsorted.dm"
#include "code\_helpers\vector.dm"
#include "code\_helpers\view.dm"
#include "code\_helpers\WWinput.dm"
#include "code\_onclick\adjacent.dm"
#include "code\_onclick\click.dm"
Expand All @@ -90,15 +108,30 @@
#include "code\_onclick\hud\human.dm"
#include "code\_onclick\hud\movable_screen_objects.dm"
#include "code\_onclick\hud\plane_master.dm"
#include "code\controllers\mc\controller.dm"
#include "code\controllers\mc\failsafe.dm"
#include "code\controllers\mc\globals.dm"
#include "code\controllers\mc\master.dm"
#include "code\controllers\mc\subsystem.dm"
#include "code\controllers\subsystem\dcs.dm"
#include "code\controllers\subsystem\timer.dm"
#include "code\datums\browser.dm"
#include "code\datums\callback.dm"
#include "code\datums\category.dm"
#include "code\datums\configuration.dm"
#include "code\datums\datum.dm"
#include "code\datums\http.dm"
#include "code\datums\hud.dm"
#include "code\datums\mind.dm"
#include "code\datums\progressbar.dm"
#include "code\datums\vote.dm"
#include "code\datums\weakref.dm"
#include "code\datums\win_condition.dm"
#include "code\datums\world_topic.dm"
#include "code\datums\components\_component.dm"
#include "code\datums\elements\_element.dm"
#include "code\datums\extensions\_defines.dm"
#include "code\datums\extensions\extensions.dm"
#include "code\datums\observation\_debug.dm"
#include "code\datums\observation\_defines.dm"
#include "code\datums\observation\destroyed.dm"
Expand Down Expand Up @@ -918,13 +951,15 @@
#include "code\modules\admin\verbs\weather.dm"
#include "code\modules\admin\verbs\world.dm"
#include "code\modules\admin\view_variables\helpers.dm"
#include "code\modules\admin\view_variables\reference_tracking.dm"
#include "code\modules\admin\view_variables\topic.dm"
#include "code\modules\admin\view_variables\view_variables.dm"
#include "code\modules\client\asset_cache.dm"
#include "code\modules\client\client_defines.dm"
#include "code\modules\client\client_procs.dm"
#include "code\modules\client\client_verbs.dm"
#include "code\modules\client\fullscreen.dm"
#include "code\modules\client\interface.dm"
#include "code\modules\client\movement.dm"
#include "code\modules\client\ping.dm"
#include "code\modules\client\sound.dm"
Expand Down
30 changes: 30 additions & 0 deletions code/__byond_version_compat.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This file contains defines allowing targeting byond versions newer than the supported

//Update this whenever you need to take advantage of more recent byond features
#define MIN_COMPILER_VERSION 515
#define MIN_COMPILER_BUILD 1610
#if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM)
//Don't forget to update this part
#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update.
#error You need version 515.1610 or higher
#endif

// Keep savefile compatibilty at minimum supported level
/savefile/byond_version = MIN_COMPILER_VERSION

// So we want to have compile time guarantees these methods exist on local type
// We use wrappers for this in case some part of the api ever changes, and to make their function more clear
// For the record: GLOBAL_VERB_REF would be useless as verbs can't be global.

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (nameof(.proc/##X))
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (nameof(.verb/##X))

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X))
/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (nameof(##TYPE.verb/##X))

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)
113 changes: 113 additions & 0 deletions code/__defines/MC.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#define MC_TICK_CHECK ( ( TICK_USAGE > Master.current_ticklimit || src.state != SS_RUNNING ) ? pause() : 0 )

#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = Master.current_ticklimit; var/split_tick_phases = ##phase_count
#define MC_SPLIT_TICK \
if(split_tick_phases > 1){\
Master.current_ticklimit = ((original_tick_limit - TICK_USAGE) / split_tick_phases) + TICK_USAGE;\
--split_tick_phases;\
} else {\
Master.current_ticklimit = original_tick_limit;\
}

// Used to smooth out costs to try and avoid oscillation.
#define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current))
#define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current))
#define MC_AVERAGE_SLOW(average, current) (0.9 * (average) + 0.1 * (current))

#define MC_AVG_FAST_UP_SLOW_DOWN(average, current) (average > current ? MC_AVERAGE_SLOW(average, current) : MC_AVERAGE_FAST(average, current))
#define MC_AVG_SLOW_UP_FAST_DOWN(average, current) (average < current ? MC_AVERAGE_SLOW(average, current) : MC_AVERAGE_FAST(average, current))

#define NEW_SS_GLOBAL(varname) if(varname != src){if(istype(varname)){Recover();qdel(varname);}varname = src;}

#define START_PROCESSING(Processor, Datum) \
if (Datum.is_processing) {\
if(Datum.is_processing != #Processor)\
{\
crash_with("Failed to start processing. [log_info_line(Datum)] is already being processed by [Datum.is_processing] but queue attempt occured on [#Processor]."); \
}\
} else {\
Datum.is_processing = #Processor;\
Processor.processing += Datum;\
}

#define STOP_PROCESSING(Processor, Datum) \
if(Datum.is_processing) {\
if(Processor.processing.Remove(Datum)) {\
Datum.is_processing = null;\
} else {\
crash_with("Failed to stop processing. [log_info_line(Datum)] is being processed by [Datum.is_processing] but de-queue attempt occured on [#Processor]."); \
}\
}

// For SSmachines, use these instead

#define START_PROCESSING_MACHINE(machine, flag)\
if(!istype(machine, /obj/machinery)) CRASH("A non-machine [log_info_line(machine)] was queued to process on the machinery subsystem.");\
machine.processing_flags |= flag;\
START_PROCESSING(SSmachines, machine)

#define STOP_PROCESSING_MACHINE(machine, flag)\
machine.processing_flags &= ~flag;\
if(machine.processing_flags == 0) STOP_PROCESSING(SSmachines, machine)

//SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier)

//subsystem does not initialize.
#define SS_NO_INIT 1

//subsystem does not fire.
// (like can_fire = 0, but keeps it from getting added to the processing subsystems list)
// (Requires a MC restart to change)
#define SS_NO_FIRE 2

//subsystem only runs on spare cpu (after all non-background subsystems have ran that tick)
// SS_BACKGROUND has its own priority bracket
#define SS_BACKGROUND 4

//subsystem does not tick check, and should not run unless there is enough time (or its running behind (unless background))
#define SS_NO_TICK_CHECK 8

//Treat wait as a tick count, not DS, run every wait ticks.
// (also forces it to run first in the tick, above even SS_NO_TICK_CHECK subsystems)
// (implies all runlevels because of how it works)
// (overrides SS_BACKGROUND)
// This is designed for basically anything that works as a mini-mc (like SStimer)
#define SS_TICKER 16

//keep the subsystem's timing on point by firing early if it fired late last fire because of lag
// ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds.
#define SS_KEEP_TIMING 32

//Calculate its next fire after its fired.
// (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be)
// This flag overrides SS_KEEP_TIMING
#define SS_POST_FIRE_TIMING 64

// Run Shutdown() on server shutdown so the SS can finalize state.
#define SS_NEEDS_SHUTDOWN 128

#define GAME_STATE 2 ** (Master.current_runlevel - 1)

//! SUBSYSTEM STATES
#define SS_IDLE 0 /// ain't doing shit.
#define SS_QUEUED 1 /// queued to run
#define SS_RUNNING 2 /// actively running
#define SS_PAUSED 3 /// paused by mc_tick_check
#define SS_SLEEPING 4 /// fire() slept.
#define SS_PAUSING 5 /// in the middle of pausing

#define SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/##X);\
/datum/controller/subsystem/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/##X

#define PROCESSING_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/processing/##X);\
/datum/controller/subsystem/processing/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/processing/##X

#define log_qdel(X) log_debug(X)
Loading

0 comments on commit b63061d

Please sign in to comment.