Implements event batch id to events to display multiple events at the same time
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-06-30 11:32:00 +02:00
parent 0163c7a105
commit bc9b3ed964
11 changed files with 217 additions and 106 deletions

View File

@@ -1,7 +1,7 @@
use std::mem::transmute;
use crate::defines::LevelInt;
use crate::dynamic_data::{Battle, DynamicLibrary, LearnedMove, Pokemon, VolatileScriptsOwner};
use crate::dynamic_data::{Battle, DynamicLibrary, EventBatchId, LearnedMove, Pokemon, VolatileScriptsOwner};
use crate::script_implementations::wasm::export_registry::{
get_value, get_value_arc, get_value_arc_void, get_value_call_getter, get_value_void, register, try_wasm, wasm_err,
wasm_ok, WasmResult, WasmVoidResult, WasmVoidResultExtension,
@@ -120,14 +120,16 @@ register! {
env: FunctionEnvMut<WebAssemblyEnv>,
pokemon: ExternRef<Pokemon>,
damage: u32,
source: u8
source: u8,
event_batch_id_1: u64,
event_batch_id_2: u64,
) -> WasmVoidResult {
unsafe {
let pokemon = match pokemon.value_func(&env) {
Ok(pokemon) => pokemon,
Err(e) => return WasmVoidResult::err(e, &env),
};
match pokemon.damage(damage, transmute(source)) {
match pokemon.damage(damage, transmute(source), EventBatchId::from_u64_pair(event_batch_id_1, event_batch_id_2)) {
Ok(()) => WasmVoidResult::ok(),
Err(e) => WasmVoidResult::err(e, &env),
}