Browse Source

Change default mutate hooking into side effects

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
85aed2889d
  1. 10
      config/AcediaSystem.ini
  2. 1
      sources/BaseRealm/Global.uc
  3. 2
      sources/CoreRealm/API/SideEffects/SideEffect.uc
  4. 14
      sources/CoreRealm/SideEffects.uc
  5. 6
      sources/ServerRealm/ServerGlobal.uc

10
config/AcediaSystem.ini

@ -11,6 +11,16 @@
; This is the least offensive side effect of AcediaCore and there should
; be no reason to prevents its `GameRules` from being added.
allowAddingGameRules=true
; If allowed, AcediaCore can provide some additional information about
; itself and other packages through "help" / "status" / "version" / "credits"
; mutate commands, as well as allow to use "mutate acediacommands" to
; emergency-enable `Commands` feature.
; However that required access to "mutate" command events, which might not
; always be desirable from `AcediaCore` library. This setting allows you to
; disable such hooks.
; NOTE: setting this to `false` will not prevent `Commands` feature from
; hooking into mutate on its own.
allowHookingIntoMutate=true
; Unfortunately, thanks to the TWI's code, there's no way to catch events
; of when certain kinds of damage are dealt: from welder, bloat's bile and
; siren's scream. At least not without something drastic, like replacing game

1
sources/BaseRealm/Global.uc

@ -79,7 +79,6 @@ protected function Initialize()
db = DBAPI(memory.Allocate(class'DBAPI'));
avarice = AvariceAPI(memory.Allocate(class'AvariceAPI'));
environment = AcediaEnvironment(memory.Allocate(class'AcediaEnvironment'));
class'InfoQueryHandler'.static.StaticConstructor();
}
public function DropCoreAPI()

2
sources/CoreRealm/API/SideEffects/SideEffect.uc

@ -49,7 +49,7 @@ class SideEffect extends AcediaObject
* this is not a side effect. Such mods are likely not going to have to specify
* any side effects whatsoever.
*
* ## Implemention your own `SideEffect`s
* ## Implementiong your own `SideEffect`s
*
* Simply make a non-abstract child class based on `SideEffect`, create its
* instance filled with necessary data and register it in `SideEffectAPI` once

14
sources/CoreRealm/SideEffects.uc

@ -37,6 +37,19 @@ class SideEffects extends AcediaObject
*/
var public const config bool allowAddingGameRules;
/**
* If allowed, AcediaCore can provide some additional information about
* itself and other packages through "help" / "status" / "version" / "credits"
* mutate commands, as well as allow to use "mutate acediacommands" to
* emergency-enable `Commands` feature.
* However that required access to "mutate" command events, which might not
* always be desirable from `AcediaCore` library. This setting allows you to
* disable such hooks.
* NOTE: setting this to `false` will not prevent `Commands` feature from
* hooking into mutate on its own.
*/
var public const config bool allowHookingIntoMutate;
/**
* Unfortunately, thanks to the TWI's code, there's no way to catch events
* of when certain kinds of damage are dealt: from welder, bloat's bile and
@ -87,6 +100,7 @@ var public const config BroadcastAPI.InjectionLevel broadcastHandlerInjectionLev
defaultproperties
{
allowAddingGameRules = true
allowHookingIntoMutate = true
allowReplacingDamageTypes = true
broadcastHandlerInjectionLevel = BHIJ_Root
}

6
sources/ServerRealm/ServerGlobal.uc

@ -59,12 +59,14 @@ public final function bool ConnectServerLevelCore()
return false;
}
Initialize();
class'UnrealService'.static.Require();
// TODO: this is hack as fuck, needs to be redone
_ = class'Global'.static.GetInstance();
if (class'SideEffects'.default.allowHookingIntoMutate)
{
class'InfoQueryHandler'.static.StaticConstructor();
_.unreal.mutator.OnMutate(
ServiceAnchor(_.memory.Allocate(class'ServiceAnchor')))
.connect = EnableCommandsFeature;
}
return true;
}

Loading…
Cancel
Save