Emit air bubble exposed (#1537)

* Update to bug report form

* Update bug_report.yaml

* Update AUTHORS.md

- Tomo (general coding, special FX coding, bug fixing)

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update bug_report.yaml

* Update EffectsFunctions.cpp

* First Commit

* Check

* Update CHANGELOG.md

* Doc revisions

* Doc Revision

* Update EffectsFunctions.cpp

* Remove room from arguements.

* Doc clarification.

* Make Size and Amplitude Optional

* Update EffectsFunctions.cpp

---------

Co-authored-by: Stranger1992 <84292688+Stranger1992@users.noreply.github.com>
Co-authored-by: Nemoel-Tomo <tomo_669@hotmail.com>
Co-authored-by: Jakub <kubabilinski03@gmail.com>
Co-authored-by: Jakub <80340234+Jakub768@users.noreply.github.com>
Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
Co-authored-by: Sezz <sezzary@outlook.com>
This commit is contained in:
TrainWrack 2025-02-01 06:23:04 -05:00 committed by GitHub
parent fa0e125f59
commit 48902b00a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 5 deletions

View file

@ -23,6 +23,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
### Lua API changes
* Added Effects.EmitAirBubble() function to spawn air bubbles.
* Added additional arguments for Sprite object slot and starting rotation value for EmitParticle function.

View file

@ -140,6 +140,10 @@
<td class="summary">Emit blood.</td>
</tr>
<tr>
<td class="name" ><a href="#EmitAirBubble">EmitAirBubble(pos[, size][, amplitude])</a></td>
<td class="summary">Emit air bubble in a water room.</td>
</tr>
<tr>
<td class="name" ><a href="#EmitFire">EmitFire(pos, size)</a></td>
<td class="summary">Emit fire for one frame.</td>
</tr>
@ -497,13 +501,45 @@
</dd>
<dt>
<a name = "EmitAirBubble"></a>
<strong>EmitAirBubble(pos[, size][, amplitude])</strong>
</dt>
<dd>
Emit air bubble in a water room.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pos</span>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
The position where the air bubble will be spawned. Needs to be in a water room.
</li>
<li><span class="parameter">size</span>
<span class="types"><span class="type">float</span></span>
The size of the air bubble.
(<em>optional</em>)
</li>
<li><span class="parameter">amplitude</span>
<span class="types"><span class="type">float</span></span>
The oscillation amplitude of the air bubble.
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "EmitFire"></a>
<strong>EmitFire(pos, size)</strong>
</dt>
<dd>
Emit fire for one frame. Will not hurt Lara. Call this each frame if you want a continuous fire.
Emit fire for one frame. Will not hurt player. Call this each frame if you want a continuous fire.

View file

@ -322,6 +322,7 @@ static constexpr char ScriptReserved_EmitShockwave[] = "EmitShockwave";
static constexpr char ScriptReserved_EmitLight[] = "EmitLight";
static constexpr char ScriptReserved_EmitSpotLight[] = "EmitSpotLight";
static constexpr char ScriptReserved_EmitBlood[] = "EmitBlood";
static constexpr char ScriptReserved_EmitAirBubble[] = "EmitAirBubble";
static constexpr char ScriptReserved_EmitFire[] = "EmitFire";
static constexpr char ScriptReserved_MakeExplosion[] = "MakeExplosion";
static constexpr char ScriptReserved_MakeEarthquake[] = "MakeEarthquake";

View file

@ -4,6 +4,7 @@
#include "Game/camera.h"
#include "Game/collision/collide_room.h"
#include "Game/control/los.h"
#include "Game/effects/Bubble.h"
#include "Game/effects/DisplaySprite.h"
#include "Game/effects/effects.h"
#include "Game/effects/Electricity.h"
@ -30,6 +31,7 @@
// @tentable Effects
// @pragma nostrip
using namespace TEN::Effects::Bubble;
using namespace TEN::Effects::DisplaySprite;
using namespace TEN::Effects::Electricity;
using namespace TEN::Effects::Environment;
@ -292,17 +294,33 @@ namespace TEN::Scripting::Effects
@tparam Vec3 pos
@tparam int count (default 1) "amount" of blood. Higher numbers won't add more blood but will make it more "flickery", with higher numbers turning it into a kind of red orb.
*/
static void EmitBlood(Vec3 pos, TypeOrNil<int> num)
static void EmitBlood(const Vec3& pos, TypeOrNil<int> count)
{
TriggerBlood(pos.x, pos.y, pos.z, -1, USE_IF_HAVE(int, num, 1));
TriggerBlood(pos.x, pos.y, pos.z, -1, USE_IF_HAVE(int, count, 1));
}
/***Emit fire for one frame. Will not hurt Lara. Call this each frame if you want a continuous fire.
/// Emit air bubble in a water room.
// @function EmitAirBubble
// @tparam Vec3 pos World position where the effect will be spawned. Must be in a water room.
// @tparam[opt] float size Sprite size. __Default: 32__
// @tparam[opt] float amp Oscillation amplitude. __Default: 32__
static void EmitAirBubble(const Vec3& pos, TypeOrNil<float> size, TypeOrNil<float> amp)
{
constexpr auto DEFAULT_SIZE = 128.0f;
constexpr auto DEFAULT_AMP = 32.0f;
int roomNumber = FindRoomNumber(pos.ToVector3i());
float convertedSize = USE_IF_HAVE(float, size, DEFAULT_SIZE);
float convertedAmp = USE_IF_HAVE(float, amp, DEFAULT_AMP);
SpawnBubble(pos.ToVector3(), roomNumber, convertedSize, convertedAmp);
}
/***Emit fire for one frame. Will not hurt player. Call this each frame if you want a continuous fire.
@function EmitFire
@tparam Vec3 pos
@tparam float size (default 1.0)
*/
static void EmitFire(Vec3 pos, TypeOrNil<float> size)
static void EmitFire(const Vec3& pos, TypeOrNil<float> size)
{
AddFire(pos.x, pos.y, pos.z, FindRoomNumber(Vector3i(pos.x, pos.y, pos.z)), USE_IF_HAVE(float, size, 1));
}
@ -348,6 +366,7 @@ namespace TEN::Scripting::Effects
tableEffects.set_function(ScriptReserved_EmitLight, &EmitLight);
tableEffects.set_function(ScriptReserved_EmitSpotLight, &EmitSpotLight);
tableEffects.set_function(ScriptReserved_EmitBlood, &EmitBlood);
tableEffects.set_function(ScriptReserved_EmitAirBubble, &EmitAirBubble);
tableEffects.set_function(ScriptReserved_MakeExplosion, &MakeExplosion);
tableEffects.set_function(ScriptReserved_EmitFire, &EmitFire);
tableEffects.set_function(ScriptReserved_MakeEarthquake, &Earthquake);