Curation round 13: grid entities, more enemies, Caves, boss helpers and five bosses, chests and costumes, curses and alt stages, the Lua API
This commit is contained in:
1 parent
f8ce24fc6c
commit
8ae02a8422
160 files changed
+16231
-1689
No files matched your search
@@ -0,0 +1,276 @@
|
||||
#include "classes.h"
|
||||
#include "entity_bomb.h"
|
||||
#include "entity_effect.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_knife.h"
|
||||
#include "entity_laser.h"
|
||||
#include "entity_npc.h"
|
||||
#include "entity_pickup.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_projectile.h"
|
||||
#include "entity_tear.h"
|
||||
#include "lua_api.h"
|
||||
|
||||
// Registers Lua's EntityTear and EntityProjectile, the shots of players and enemies.
|
||||
static void shots_register(lua_State* state)
|
||||
{
|
||||
lua_class_begin(state, "EntityTear", LUA_CLASS_TEAR, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Tear::height>(state, "Height");
|
||||
lua_field<&Entity_Tear::fallingSpeed>(state, "FallingSpeed");
|
||||
lua_field<&Entity_Tear::fallingAccel>(state, "FallingAcceleration");
|
||||
lua_property(
|
||||
state, "Scale", [](Entity_Tear& tear) { return tear.fScale; },
|
||||
[](Entity_Tear& tear, float scale) { tear.fScale = scale; });
|
||||
lua_field<&Entity_Tear::tearFlags>(state, "TearFlags");
|
||||
lua_field_get<&Entity_Tear::tearIdx>(state, "TearIndex");
|
||||
lua_field<&Entity_Tear::rotation>(state, "Rotation");
|
||||
lua_field<&Entity_Tear::waitFrames>(state, "WaitFrames");
|
||||
lua_field<&Entity_Tear::homingFriction>(state, "HomingFriction");
|
||||
lua_field<&Entity_Tear::baseScale>(state, "BaseScale");
|
||||
lua_field<&Entity_Tear::baseDamage>(state, "BaseDamage");
|
||||
lua_field<&Entity_Tear::knockbackMultiplier>(state, "KnockbackMultiplier");
|
||||
lua_field<&Entity_Tear::continueVelocity>(state, "ContinueVelocity");
|
||||
lua_field<&Entity_Tear::parentOffset>(state, "ParentOffset");
|
||||
lua_field<&Entity_Tear::posDisplacement>(state, "PosDisplacement");
|
||||
lua_field<&Entity_Tear::stickDiff>(state, "StickDiff");
|
||||
lua_field<&Entity_Tear::stickTimer>(state, "StickTimer");
|
||||
lua_field<&Entity_Tear::isCanTriggerStreakEnd>(state, "CanTriggerStreakEnd");
|
||||
lua_method(state, "ChangeVariant", [](Entity_Tear& tear, int variant) { tear.ChangeVariant(variant); });
|
||||
lua_method(state, "SetWaitFrames", [](Entity_Tear& tear, int frames) { tear.waitFrames = frames; });
|
||||
lua_method(state, "SetKnockbackMultiplier",
|
||||
[](Entity_Tear& tear, float multiplier) { tear.knockbackMultiplier = multiplier; });
|
||||
lua_method(state, "SetParentOffset", [](Entity_Tear& tear, Vector offset) { tear.parentOffset = offset; });
|
||||
lua_class_end(state);
|
||||
|
||||
lua_class_begin(state, "EntityProjectile", LUA_CLASS_PROJECTILE, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Projectile::height>(state, "Height");
|
||||
lua_field<&Entity_Projectile::fallingSpeed>(state, "FallingSpeed");
|
||||
lua_field<&Entity_Projectile::fallingAccel>(state, "FallingAccel");
|
||||
lua_field<&Entity_Projectile::homingStrength>(state, "HomingStrength");
|
||||
lua_field<&Entity_Projectile::curvingStrength>(state, "CurvingStrength");
|
||||
lua_field<&Entity_Projectile::acceleration>(state, "Acceleration");
|
||||
lua_field<&Entity_Projectile::wiggleFrameOffset>(state, "WiggleFrameOffset");
|
||||
lua_field<&Entity_Projectile::changeFlags>(state, "ChangeFlags");
|
||||
lua_field<&Entity_Projectile::changeVelocity>(state, "ChangeVelocity");
|
||||
lua_field<&Entity_Projectile::changeTimeout>(state, "ChangeTimeout");
|
||||
lua_field<&Entity_Projectile::scale>(state, "Scale");
|
||||
lua_field<&Entity_Projectile::projectileFlags>(state, "ProjectileFlags");
|
||||
lua_field<&Entity_Projectile::damage>(state, "Damage");
|
||||
lua_method(state, "AddHeight", [](Entity_Projectile& shot, float amount) { shot.AddHeight(amount); });
|
||||
lua_method(state, "AddFallingSpeed", [](Entity_Projectile& shot, float amount) { shot.fallingSpeed += amount; });
|
||||
lua_method(state, "AddFallingAccel", [](Entity_Projectile& shot, float amount) { shot.fallingAccel += amount; });
|
||||
lua_method(state, "AddScale", [](Entity_Projectile& shot, float amount) { shot.scale += amount; });
|
||||
lua_method(state, "AddProjectileFlags",
|
||||
[](Entity_Projectile& shot, uint64_t flags) { shot.AddProjectileFlags(flags); });
|
||||
lua_method(state, "AddChangeFlags", [](Entity_Projectile& shot, uint64_t flags) { shot.changeFlags |= flags; });
|
||||
lua_class_end(state);
|
||||
}
|
||||
|
||||
// Registers Lua's EntityBomb, EntityKnife and EntityLaser, the players' other weapons.
|
||||
static void weapons_register(lua_State* state)
|
||||
{
|
||||
lua_class_begin(state, "EntityBomb", LUA_CLASS_BOMB, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Bomb::tearFlags>(state, "Flags");
|
||||
lua_field<&Entity_Bomb::isFetus>(state, "IsFetus");
|
||||
lua_field<&Entity_Bomb::explosionDamage>(state, "ExplosionDamage");
|
||||
lua_field<&Entity_Bomb::radiusMultiplier>(state, "RadiusMultiplier");
|
||||
lua_method(state, "SetExplosionCountdown",
|
||||
[](Entity_Bomb& bomb, int countdown) { bomb.SetExplosionCountdown(countdown); });
|
||||
lua_class_end(state);
|
||||
|
||||
lua_class_begin(state, "EntityKnife", LUA_CLASS_KNIFE, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Knife::tearFlags>(state, "TearFlags");
|
||||
lua_field<&Entity_Knife::rotation>(state, "Rotation");
|
||||
lua_field<&Entity_Knife::rotationOffset>(state, "RotationOffset");
|
||||
lua_field<&Entity_Knife::maxDistance>(state, "MaxDistance");
|
||||
lua_field<&Entity_Knife::charge>(state, "Charge");
|
||||
lua_field<&Entity_Knife::scale>(state, "Scale");
|
||||
lua_field<&Entity_Knife::pathOffset>(state, "PathOffset");
|
||||
lua_field<&Entity_Knife::pathFollowSpeed>(state, "PathFollowSpeed");
|
||||
lua_method(state, "Shoot", [](Entity_Knife& knife, float charge, float range) { knife.Shoot(charge, range); });
|
||||
lua_method(state, "IsFlying", [](Entity_Knife& knife) { return knife.isFlying; });
|
||||
lua_method(state, "GetKnifeDistance", [](Entity_Knife& knife) { return knife.knifeDistance; });
|
||||
lua_method(state, "GetKnifeVelocity", [](Entity_Knife& knife) { return knife.knifeVelocity; });
|
||||
lua_method(state, "SetPathFollowSpeed", [](Entity_Knife& knife, float speed) { knife.pathFollowSpeed = speed; });
|
||||
lua_class_end(state);
|
||||
|
||||
lua_class_begin(state, "EntityLaser", LUA_CLASS_LASER, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Laser::tearFlags>(state, "TearFlags");
|
||||
lua_field<&Entity_Laser::angleDegrees>(state, "Angle");
|
||||
lua_field<&Entity_Laser::angleDegrees>(state, "AngleDegrees");
|
||||
lua_field<&Entity_Laser::startAngleDegrees>(state, "StartAngleDegrees");
|
||||
lua_field<&Entity_Laser::lastAngleDegrees>(state, "LastAngleDegrees");
|
||||
lua_field<&Entity_Laser::parentOffset>(state, "ParentOffset");
|
||||
lua_field<&Entity_Laser::timeout>(state, "Timeout");
|
||||
lua_field<&Entity_Laser::maxDistance>(state, "MaxDistance");
|
||||
lua_field<&Entity_Laser::radius>(state, "Radius");
|
||||
lua_field<&Entity_Laser::curveStrength>(state, "CurveStrength");
|
||||
lua_field<&Entity_Laser::laserLength>(state, "LaserLength");
|
||||
lua_field<&Entity_Laser::rotationDegrees>(state, "RotationDegrees");
|
||||
lua_field<&Entity_Laser::rotationSpd>(state, "RotationSpd");
|
||||
lua_field<&Entity_Laser::homingType>(state, "HomingType");
|
||||
lua_field<&Entity_Laser::blackHpDropChance>(state, "BlackHpDropChance");
|
||||
lua_field<&Entity_Laser::endPoint>(state, "EndPoint");
|
||||
lua_field<&Entity_Laser::isShrink>(state, "Shrink");
|
||||
lua_field<&Entity_Laser::isOneHit>(state, "OneHit");
|
||||
lua_field<&Entity_Laser::isGridHit>(state, "GridHit");
|
||||
lua_field<&Entity_Laser::isSampleLaser>(state, "SampleLaser");
|
||||
lua_field<&Entity_Laser::isFirstUpdate>(state, "FirstUpdate");
|
||||
lua_field<&Entity_Laser::isActiveRotating>(state, "IsActiveRotating");
|
||||
lua_field<&Entity_Laser::isDisableFollowParent>(state, "DisableFollowParent");
|
||||
lua_method(state, "SetTimeout", [](Entity_Laser& laser, int timeout) { laser.timeout = timeout; });
|
||||
lua_method(state, "SetOneHit", [](Entity_Laser& laser, bool isOneHit) { laser.isOneHit = isOneHit; });
|
||||
lua_method(state, "SetMaxDistance", [](Entity_Laser& laser, float distance) { laser.maxDistance = distance; });
|
||||
lua_method(state, "SetHomingType", [](Entity_Laser& laser, uint32_t type) { laser.homingType = type; });
|
||||
lua_method(state, "SetBlackHpDropChance",
|
||||
[](Entity_Laser& laser, float chance) { laser.blackHpDropChance = chance; });
|
||||
lua_method(state, "IsCircleLaser", [](Entity_Laser& laser) { return laser.IsCircleLaser(); });
|
||||
lua_method(state, "IsSampleLaser", [](Entity_Laser& laser) { return laser.isSampleLaser; });
|
||||
lua_class_end(state);
|
||||
}
|
||||
|
||||
// Registers Lua's EntityFamiliar and EntityEffect.
|
||||
static void companions_register(lua_State* state)
|
||||
{
|
||||
lua_class_begin(state, "EntityFamiliar", LUA_CLASS_FAMILIAR, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Familiar::player>(state, "Player");
|
||||
lua_field<&Entity_Familiar::state>(state, "State");
|
||||
lua_field<&Entity_Familiar::coins>(state, "Coins");
|
||||
lua_field<&Entity_Familiar::hearts>(state, "Hearts");
|
||||
lua_field<&Entity_Familiar::keys>(state, "Keys");
|
||||
lua_field<&Entity_Familiar::fireCooldown>(state, "FireCooldown");
|
||||
lua_field<&Entity_Familiar::headFrameDelay>(state, "HeadFrameDelay");
|
||||
lua_field<&Entity_Familiar::moveDirection>(state, "MoveDirection");
|
||||
lua_field<&Entity_Familiar::shootDirection>(state, "ShootDirection");
|
||||
lua_field<&Entity_Familiar::lastDirection>(state, "LastDirection");
|
||||
lua_field<&Entity_Familiar::orbitAngleOffset>(state, "OrbitAngleOffset");
|
||||
lua_field<&Entity_Familiar::orbitDistance>(state, "OrbitDistance");
|
||||
lua_field<&Entity_Familiar::orbitSpeed>(state, "OrbitSpeed");
|
||||
lua_field<&Entity_Familiar::orbitLayer>(state, "OrbitLayer");
|
||||
lua_field<&Entity_Familiar::roomClearCount>(state, "RoomClearCount");
|
||||
lua_field_get<&Entity_Familiar::isDelayed>(state, "IsDelayed");
|
||||
lua_field_get<&Entity_Familiar::isFollower>(state, "IsFollower");
|
||||
lua_method(state, "AddCoins", [](Entity_Familiar& familiar, int count) { familiar.AddCoins(count); });
|
||||
lua_method(state, "AddHearts", [](Entity_Familiar& familiar, int amount) { familiar.AddHearts(amount); });
|
||||
lua_method(state, "AddKeys", [](Entity_Familiar& familiar, int amount) { familiar.AddKeys(amount); });
|
||||
lua_method(state, "FollowParent", [](Entity_Familiar& familiar) { familiar.FollowParent(); });
|
||||
lua_method(state, "FollowPosition",
|
||||
[](Entity_Familiar& familiar, Vector position) { familiar.FollowPosition(position); });
|
||||
lua_method(state, "GetOrbitPosition",
|
||||
[](Entity_Familiar& familiar, Vector center) { return familiar.GetOrbitPosition(center); });
|
||||
lua_static(state, "GetOrbitDistance", [](int layer) { return Entity_Familiar::GetOrbitDistance(layer); });
|
||||
lua_method(state, "Shoot", [](Entity_Familiar& familiar) { familiar.Shoot(); });
|
||||
lua_method(state, "PlayChargeAnim",
|
||||
[](Entity_Familiar& familiar, int direction) { familiar.PlayChargeAnim(direction); });
|
||||
lua_method(state, "PlayShootAnim",
|
||||
[](Entity_Familiar& familiar, int direction) { familiar.PlayShootAnim(direction); });
|
||||
lua_method(state, "PlayFloatAnim",
|
||||
[](Entity_Familiar& familiar, int direction) { familiar.PlayFloatAnim(direction); });
|
||||
lua_method(state, "MoveDiagonally", [](Entity_Familiar& familiar, float speed) { familiar.MoveDiagonally(speed); });
|
||||
lua_method(state, "AddToFollowers", [](Entity_Familiar& familiar) { familiar.AddToFollowers(); });
|
||||
lua_method(state, "RemoveFromFollowers", [](Entity_Familiar& familiar) { familiar.RemoveFromFollowers(); });
|
||||
lua_method(state, "AddToDelayed", [](Entity_Familiar& familiar) { familiar.AddToDelayed(); });
|
||||
lua_method(state, "RemoveFromDelayed", [](Entity_Familiar& familiar) { familiar.RemoveFromDelayed(); });
|
||||
lua_method(state, "AddToOrbit", [](Entity_Familiar& familiar, int layer) { familiar.AddToOrbit(layer); });
|
||||
lua_method(state, "RemoveFromOrbit", [](Entity_Familiar& familiar) { familiar.RemoveFromOrbit(); });
|
||||
lua_class_end(state);
|
||||
|
||||
lua_class_begin(state, "EntityEffect", LUA_CLASS_EFFECT, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Effect::state>(state, "State");
|
||||
lua_field<&Entity_Effect::timeout>(state, "Timeout");
|
||||
lua_field<&Entity_Effect::lifespan>(state, "LifeSpan");
|
||||
lua_field<&Entity_Effect::rotation>(state, "Rotation");
|
||||
lua_field<&Entity_Effect::scale>(state, "Scale");
|
||||
lua_field<&Entity_Effect::fallingSpeed>(state, "FallingSpeed");
|
||||
lua_field<&Entity_Effect::fallingAcceleration>(state, "FallingAcceleration");
|
||||
lua_field<&Entity_Effect::height>(state, "m_Height");
|
||||
lua_field<&Entity_Effect::minRadius>(state, "MinRadius");
|
||||
lua_field<&Entity_Effect::maxRadius>(state, "MaxRadius");
|
||||
lua_field<&Entity_Effect::isFollowing>(state, "IsFollowing");
|
||||
lua_field<&Entity_Effect::parentOffset>(state, "ParentOffset");
|
||||
lua_field<&Entity_Effect::damageSource>(state, "DamageSource");
|
||||
lua_method(state, "SetTimeout", [](Entity_Effect& effect, int frames) { effect.SetTimeout(frames); });
|
||||
lua_method(state, "SetRadii", [](Entity_Effect& effect, float minRadius, float maxRadius) {
|
||||
effect.SetRadii(minRadius, maxRadius);
|
||||
});
|
||||
lua_method(state, "FollowParent", [](Entity_Effect& effect, Entity* parent) { effect.FollowParent(parent); });
|
||||
lua_method(state, "SetDamageSource", [](Entity_Effect& effect, int type) { effect.damageSource = type; });
|
||||
lua_class_end(state);
|
||||
}
|
||||
|
||||
// Registers Lua's EntityNPC, enemies and other characters, and EntityPickup.
|
||||
static void npc_pickup_register(lua_State* state)
|
||||
{
|
||||
lua_class_begin(state, "EntityNPC", LUA_CLASS_NPC, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_NPC::state>(state, "State");
|
||||
lua_field<&Entity_NPC::stateFrame>(state, "StateFrame");
|
||||
lua_field<&Entity_NPC::i1>(state, "I1");
|
||||
lua_field<&Entity_NPC::i2>(state, "I2");
|
||||
lua_field<&Entity_NPC::v1>(state, "V1");
|
||||
lua_field<&Entity_NPC::v2>(state, "V2");
|
||||
lua_field<&Entity_NPC::projectileCooldown>(state, "ProjectileCooldown");
|
||||
lua_field<&Entity_NPC::projectileDelay>(state, "ProjectileDelay");
|
||||
lua_field_get<&Entity_NPC::groupIdx>(state, "GroupIdx");
|
||||
lua_property(
|
||||
state, "Scale", [](Entity_NPC& npc) { return npc.scale; },
|
||||
[](Entity_NPC& npc, float scale) { npc.SetScale(scale); });
|
||||
lua_property(
|
||||
state, "EntityRef", [](Entity_NPC& npc) { return npc.entityRef.get(); },
|
||||
[](Entity_NPC& npc, Entity* entity) { npc.entityRef = entity; });
|
||||
lua_property(state, "ParentNPC", [](Entity_NPC& npc) { return dynamic_cast<Entity_NPC*>(npc.parent.get()); });
|
||||
lua_property(state, "ChildNPC", [](Entity_NPC& npc) { return dynamic_cast<Entity_NPC*>(npc.child.get()); });
|
||||
lua_method(state, "Morph", [](Entity_NPC& npc, int type, int variant, int subType, int championColor) {
|
||||
npc.Morph(type, variant, subType, championColor);
|
||||
});
|
||||
lua_method(state, "MakeChampion", [](Entity_NPC& npc, uint32_t seed, int championColor, bool isInit) {
|
||||
npc.MakeChampion(seed, championColor, isInit);
|
||||
});
|
||||
lua_method(state, "IsChampion", [](Entity_NPC& npc) { return npc.isChampion; });
|
||||
lua_method(state, "GetChampionColorIdx", [](Entity_NPC& npc) { return npc.championColorIdx; });
|
||||
lua_method(state, "GetBossColorIdx", [](Entity_NPC& npc) { return npc.bosscoloridx; });
|
||||
lua_method(state, "GetPlayerTarget", [](Entity_NPC& npc) { return npc.GetPlayerTarget(); });
|
||||
lua_method(state, "CalcTargetPosition", [](Entity_NPC& npc, float limit) { return npc.CalcTargetPosition(limit); });
|
||||
lua_method(state, "PlaySound", [](Entity_NPC& npc, int id, float volume, int frameDelay, bool isLoop, float pitch) {
|
||||
npc.PlaySound(id, volume, frameDelay, isLoop, pitch);
|
||||
});
|
||||
lua_method(state, "AnimWalkFrame",
|
||||
[](Entity_NPC& npc, std::string_view horizontal, std::string_view vertical, float speed) {
|
||||
npc.AnimWalkFrame(horizontal, vertical, speed);
|
||||
});
|
||||
lua_method(state, "MakeSplat", [](Entity_NPC& npc, float size) { return npc.MakeSplat(size); });
|
||||
lua_method(state, "KillUnique", [](Entity_NPC& npc) { npc.KillUnique(); });
|
||||
lua_class_end(state);
|
||||
|
||||
lua_class_begin(state, "EntityPickup", LUA_CLASS_PICKUP, LUA_CLASS_ENTITY);
|
||||
lua_field<&Entity_Pickup::charge>(state, "Charge");
|
||||
lua_field<&Entity_Pickup::price>(state, "Price");
|
||||
lua_field<&Entity_Pickup::shopItemId>(state, "ShopItemId");
|
||||
lua_field<&Entity_Pickup::timeout>(state, "Timeout");
|
||||
lua_field<&Entity_Pickup::isTouched>(state, "Touched");
|
||||
lua_field<&Entity_Pickup::state>(state, "State");
|
||||
lua_field<&Entity_Pickup::wait>(state, "Wait");
|
||||
lua_field<&Entity_Pickup::isAutoUpdatePrice>(state, "AutoUpdatePrice");
|
||||
lua_field<&Entity_Pickup::optionsPickupIndex>(state, "OptionsPickupIndex");
|
||||
lua_method(state, "IsShopItem", [](Entity_Pickup& pickup) { return pickup.IsShopItem(); });
|
||||
lua_method(state, "Morph",
|
||||
[](Entity_Pickup& pickup, int type, int variant, int subType, bool isKeepPrice, bool isKeepSeed,
|
||||
bool isIgnoreModifiers) {
|
||||
pickup.Morph(type, variant, subType, isKeepPrice, isKeepSeed, isIgnoreModifiers);
|
||||
});
|
||||
lua_method(state, "AppearFast", [](Entity_Pickup& pickup) { pickup.AppearFast(); });
|
||||
lua_method(state, "TryOpenChest",
|
||||
[](Entity_Pickup& pickup, Entity_Player* player) { return pickup.TryOpenChest(player); });
|
||||
lua_method(state, "PlayDropSound", [](Entity_Pickup& pickup) { pickup.PlayDropSound(); });
|
||||
lua_method(state, "PlayPickupSound", [](Entity_Pickup& pickup) { pickup.PlayPickupSound(); });
|
||||
lua_method(state, "GetCoinValue", [](Entity_Pickup& pickup) { return pickup.GetCoinValue(); });
|
||||
lua_method(state, "CanReroll", [](Entity_Pickup& pickup) { return pickup.CanReroll(); });
|
||||
lua_class_end(state);
|
||||
}
|
||||
|
||||
void lua_api_entities_register(lua_State* state)
|
||||
{
|
||||
shots_register(state);
|
||||
weapons_register(state);
|
||||
companions_register(state);
|
||||
npc_pickup_register(state);
|
||||
}
|
||||
Reference in new issue
Block a user