Generic event handler template/entity #1442
Replies: 5 comments 2 replies
-
That one looks good, but some events might need some specific customization, that merging them into a template might make it look somewhat confusing.
Here are my thoughts.
Sample code 1: [RhinoTank]
WhenCrush.Weapon=SelfHeal
[SelfHeal]
WhenCrush.MultiplierWH=SelfHealFilter
[SelfHealFilter]
Verses=50%,50%,50%,100%,100%,100%,0%,0%,0%,0%,0%
Versus.some_custom_armor_type=0% In this case, when Rhino Tank crushes something, it fires the weapon Sample code 2: [Weapon_NanofiberSync]
InvokeEvents=WhenNanofiberSync
[Knightsframe]
WhenNanofiberSync=TransformIntoKingsframe
[TransformIntoKingsframe]
WhenNanofiberSync.MultiplierWH=<some warhead> In this case, when the |
Beta Was this translation helpful? Give feedback.
-
In the last sample codes, maybe we still need a list of [EventTypes], so we know the full list to iterate with. Just state in the document which event types are invoked through a hard-coded way. |
Beta Was this translation helpful? Give feedback.
-
My browser somehow can't reply to comments so I have to leave a new comment here. Maybe we can make a shortcut by borrowing the multiplier vs. armor type system of warheads, we use that warhead to judge the event relative object to get a multiplier, so we get a [condition] and a [multiplier] at a same time without much cost of coding. |
Beta Was this translation helpful? Give feedback.
-
我认为可以使用“对象1、对象2、对象3”这样的标签,然后在具体的条件下进行赋予具体的含义。比如在“死亡”这个事件里我们设定“对象1”为死者,“对象2”为杀手,“对象3”没有含义就设定为空。
也许需要包括ObjectClass和CellClass。不过大多数情况下TechnoClass和CellClass是足够的。 就给出的INI来说,我认为第一种比较好。 |
Beta Was this translation helpful? Give feedback.
-
Description
Currently there is a lot of cases both in vanilla game, in existing and proposed features that can be described as "when X occurs, do Y". Each of the cases is usually implemented in it's own specific way, often not sharing common improvements with other cases even if it's beneficial. This proposal aims to solve that by introducing a new universal "event handler" type or a multitag construct (template, like
Promotable
), inspired by event pattern (can be observed in C#, for example).For a vanilla example - think of
DeathWeapon
, but instead of a weapon you could choose an anim, or customize the consequence so that the weapon is fired on whoever killed it by specifying who owns the detonated weapon, etc.Attaching a draft below.
INI code
Additional context
Considerations and questions to iterate on:
Checklist
Beta Was this translation helpful? Give feedback.
All reactions