-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.sql
44 lines (34 loc) · 1.68 KB
/
functions.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
create or replace function pack as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
create or replace function decodeplan as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
create or replace function applyplan returns table as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
create or replace function strategy_default as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
replace into entity_strategy (udf) values ("strategy_default");
-- add custom strategies here, make sure to also register them in the
-- entity_strategy table
create or replace function strategy_flee as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
replace into entity_strategy (udf) values ("strategy_flee");
create or replace function strategy_battle as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
replace into entity_strategy (udf) values ("strategy_battle");
create or replace function strategy_blank as wasm
from local infile "agent/target/wasm32-wasi/release/agent.wasm"
with wit from local infile "agent/interface.wit";
replace into entity_strategy (udf, is_enabled) values ("strategy_blank", false);
delimiter //
create or replace function distance_2d (x1 int, y1 int, x2 int, y2 int)
returns float as
begin
return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
end //
delimiter ;