Compare commits

..

1 Commits

Author SHA1 Message Date
David Markowitz
ff75e6f0f7 PhantomPhysics: Fix gravity
Fix gravity not being adjusted when colliding with a phantom physics object

Tested that while on moonbase, the players gravity is no longer reset to 1 when they change their cheat info.
2023-10-15 18:37:43 -07:00
15 changed files with 15 additions and 1084 deletions

View File

@@ -1,264 +0,0 @@
components = {
'COMPONENT_TYPE_CONTROLLABLE_PHYSICS': 1,
'COMPONENT_TYPE_RENDER': 2,
'COMPONENT_TYPE_SIMPLE_PHYSICS': 3,
'COMPONENT_TYPE_CHARACTER': 4,
'COMPONENT_TYPE_SCRIPT': 5,
'COMPONENT_TYPE_BOUNCER': 6,
'COMPONENT_TYPE_DESTROYABLE': 7,
'COMPONENT_TYPE_GHOST': 8,
'COMPONENT_TYPE_SKILL': 9,
'COMPONENT_TYPE_SPAWNER': 10,
'COMPONENT_TYPE_ITEM': 11,
'COMPONENT_TYPE_MODULAR_BUILD': 12,
'COMPONENT_TYPE_BUILD_CONTROLLER': 13,
'COMPONENT_TYPE_REBUILD_ACTIVATOR': 14,
'COMPONENT_TYPE_ICON_ONLY': 15,
'COMPONENT_TYPE_VENDOR': 16,
'COMPONENT_TYPE_INVENTORY': 17,
'COMPONENT_TYPE_PROJECTILE_PHYSICS': 18,
'COMPONENT_TYPE_SHOOTING_GALLERY': 19,
'COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS': 20,
'COMPONENT_TYPE_DROP_EFFECT': 21,
'COMPONENT_TYPE_CHEST': 22,
'COMPONENT_TYPE_COLLECTIBLE': 23,
'COMPONENT_TYPE_BLUEPRINT': 24,
'COMPONENT_TYPE_MOVING_PLATFORM': 25,
'COMPONENT_TYPE_PET': 26,
'COMPONENT_TYPE_PLATFORM_BOUNDARY': 27,
'COMPONENT_TYPE_MODULE': 28,
'COMPONENT_TYPE_ARCADE': 29,
'COMPONENT_TYPE_HAVOK_VEHICLE_PHYSICS': 30,
'COMPONENT_TYPE_MOVEMENT_AI': 31,
'COMPONENT_TYPE_EXHIBIT': 32,
'COMPONENT_TYPE_OVERHEAD_ICON': 33,
'COMPONENT_TYPE_PET_CONTROL': 34,
'COMPONENT_TYPE_MINIFIG': 35,
'COMPONENT_TYPE_PROPERTY': 36,
'COMPONENT_TYPE_PET_CREATOR': 37,
'COMPONENT_TYPE_MODEL_BUILDER': 38,
'COMPONENT_TYPE_SCRIPTED_ACTIVITY': 39,
'COMPONENT_TYPE_PHANTOM_PHYSICS': 40,
'COMPONENT_TYPE_SPRING_PAD': 41,
'COMPONENT_TYPE_MODEL': 42,
'COMPONENT_TYPE_PROPERTY_ENTRANCE': 43,
'COMPONENT_TYPE_FX': 44,
'COMPONENT_TYPE_PROPERTY_MANAGEMENT': 45,
'COMPONENT_TYPE_VEHICLE_PHYSICS': 46,
'COMPONENT_TYPE_PHYSICS_SYSTEM': 47,
'COMPONENT_TYPE_REBUILD': 48,
'COMPONENT_TYPE_SWITCH': 49,
'COMPONENT_TYPE_ZONE_CONTROL': 50,
'COMPONENT_TYPE_CHANGELING': 51,
'COMPONENT_TYPE_CHOICE_BUILD': 52,
'COMPONENT_TYPE_PACKAGE': 53,
'COMPONENT_TYPE_SOUND_REPEATER': 54,
'COMPONENT_TYPE_SOUND_AMBIENT_2D': 55,
'COMPONENT_TYPE_SOUND_AMBIENT_3D': 56,
'COMPONENT_TYPE_PRECONDITION': 57,
'COMPONENT_TYPE_PLAYER_FLAG': 58,
'COMPONENT_TYPE_CUSTOM_BUILD_ASSEMBLY': 59,
'COMPONENT_TYPE_BASE_COMBAT_AI': 60,
'COMPONENT_TYPE_MODULE_ASSEMBLY': 61,
'COMPONENT_TYPE_SHOWCASE_MODEL_HANDLER': 62,
'COMPONENT_TYPE_RACING_MODULE': 63,
'COMPONENT_TYPE_GENERIC_ACTIVATOR': 64,
'COMPONENT_TYPE_PROPERTY_VENDOR': 65,
'COMPONENT_TYPE_HF_LIGHT_DIRECTION_GADGET': 66,
'COMPONENT_TYPE_ROCKET_LAUNCH': 67,
'COMPONENT_TYPE_ROCKET_LANDING_COMPONENT': 68,
'COMPONENT_TYPE_TRIGGER': 69,
'COMPONENT_TYPE_DROPPED_LOOT': 70,
'COMPONENT_TYPE_RACING_CONTROL': 71,
'COMPONENT_TYPE_FACTION_TRIGGER': 72,
'COMPONENT_TYPE_MISSION_OFFER': 73,
'COMPONENT_TYPE_RACING_STATS': 74,
'COMPONENT_TYPE_LUP_EXHIBIT': 75,
'COMPONENT_TYPE_BBB': 76,
'COMPONENT_TYPE_SOUND_TRIGGER': 77,
'COMPONENT_TYPE_PROXIMITY_MONITOR': 78,
'COMPONENT_TYPE_RACING_SOUND_TRIGGER': 79,
'COMPONENT_TYPE_CHAT': 80,
'COMPONENT_TYPE_FRIENDS_LIST': 81,
'COMPONENT_TYPE_GUILD': 82,
'COMPONENT_TYPE_LOCAL_SYSTEM': 83,
'COMPONENT_TYPE_MISSION': 84,
'COMPONENT_TYPE_MUTUABLE_MODEL_BEHAVIORS': 85,
'COMPONENT_TYPE_PATHFINDING_CONTROL': 86,
'COMPONENT_TYPE_PLAYER_PET_TAMING': 87,
'COMPONENT_TYPE_PROPERTY_EDITOR': 88,
'COMPONENT_TYPE_SKINNED_RENDER': 89,
'COMPONENT_TYPE_SLASH_COMMAND': 90,
'COMPONENT_TYPE_STATUS_EFFECT': 91,
'COMPONENT_TYPE_TEAMS': 92,
'COMPONENT_TYPE_TEXT_EFFECT': 93,
'COMPONENT_TYPE_TRADE': 94,
'COMPONENT_TYPE_USER_CONTROL': 95,
'COMPONENT_TYPE_IGNORE_LIST': 96,
'COMPONENT_TYPE_ROCKET_LAUNCH_LUP': 97,
'COMPONENT_TYPE_BUFF': 98,
'COMPONENT_TYPE_INTERACTION_MANAGER': 99,
'COMPONENT_TYPE_DONATION_VENDOR': 100,
'COMPONENT_TYPE_COMBAT_MEDIATOR': 101,
'COMPONENT_TYPE_ACHIEVEMENT_VENDOR': 102,
'COMPONENT_TYPE_GATE_RUSH': 103,
'COMPONENT_TYPE_RAIL_ACTIVATOR': 104,
'COMPONENT_TYPE_ROLLER': 105,
'COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT': 106,
'COMPONENT_TYPE_CRAFTING': 107,
'COMPONENT_TYPE_POSSESSABLE': 108,
'COMPONENT_TYPE_LEVEL_PROGRESSION': 109,
'COMPONENT_TYPE_POSSESSOR': 110,
'COMPONENT_TYPE_MOUNT_CONTROL': 111,
'UNKNOWN_112': 112,
'COMPONENT_TYPE_PROPERTY_PLAQUE': 113,
'COMPONENT_TYPE_BUILD_BORDER': 114,
'UNKNOWN_115': 115,
'COMPONENT_TYPE_CULLING_PLANE': 116,
'INVALID': 4294967295
}
component_initialization_order = [
'COMPONENT_TYPE_POSSESSABLE',
'COMPONENT_TYPE_BLUEPRINT',
'COMPONENT_TYPE_MODULE_ASSEMBLY',
'COMPONENT_TYPE_CONTROLLABLE_PHYSICS',
'COMPONENT_TYPE_PROJECTILE_PHYSICS',
'COMPONENT_TYPE_PHYSICS_SYSTEM',
'COMPONENT_TYPE_VEHICLE_PHYSICS',
'COMPONENT_TYPE_HAVOK_VEHICLE_PHYSICS',
'COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS',
'COMPONENT_TYPE_SIMPLE_PHYSICS',
'COMPONENT_TYPE_PHANTOM_PHYSICS',
'COMPONENT_TYPE_DESTROYABLE',
'COMPONENT_TYPE_MINIFIG',
'COMPONENT_TYPE_CHARACTER',
'COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT',
'COMPONENT_TYPE_POSSESSOR',
'COMPONENT_TYPE_MOUNT_CONTROL',
'COMPONENT_TYPE_PET',
'COMPONENT_TYPE_INVENTORY',
'COMPONENT_TYPE_PROXIMITY_MONITOR',
'COMPONENT_TYPE_MOVEMENT_AI',
'COMPONENT_TYPE_SCRIPT',
'COMPONENT_TYPE_SKILL',
'COMPONENT_TYPE_BASE_COMBAT_AI',
'COMPONENT_TYPE_SPAWNER',
'COMPONENT_TYPE_ITEM',
'COMPONENT_TYPE_REBUILD',
'COMPONENT_TYPE_BUILD_BORDER',
'COMPONENT_TYPE_MODULE',
'COMPONENT_TYPE_BUILD_CONTROLLER',
'COMPONENT_TYPE_REBUILD_ACTIVATOR',
'COMPONENT_TYPE_MODULAR_BUILD',
'COMPONENT_TYPE_MISSION_OFFER',
'COMPONENT_TYPE_VENDOR',
'COMPONENT_TYPE_DONATION_VENDOR',
'COMPONENT_TYPE_ACHIEVEMENT_VENDOR',
'COMPONENT_TYPE_SHOOTING_GALLERY',
'COMPONENT_TYPE_ROLLER',
'COMPONENT_TYPE_SCRIPTED_ACTIVITY',
'COMPONENT_TYPE_COLLECTIBLE',
'COMPONENT_TYPE_MOVING_PLATFORM',
'COMPONENT_TYPE_CHANGELING',
'COMPONENT_TYPE_CHOICE_BUILD',
'COMPONENT_TYPE_PACKAGE',
'COMPONENT_TYPE_PLATFORM_BOUNDARY',
'COMPONENT_TYPE_HF_LIGHT_DIRECTION_GADGET',
'COMPONENT_TYPE_CULLING_PLANE',
'COMPONENT_TYPE_EXHIBIT',
'COMPONENT_TYPE_LUP_EXHIBIT',
'COMPONENT_TYPE_PROPERTY',
'COMPONENT_TYPE_PROPERTY_PLAQUE',
'COMPONENT_TYPE_MODEL',
'COMPONENT_TYPE_PROPERTY_ENTRANCE',
'COMPONENT_TYPE_ROCKET_LAUNCH_LUP',
'COMPONENT_TYPE_PROPERTY_MANAGEMENT',
'COMPONENT_TYPE_RAIL_ACTIVATOR',
'COMPONENT_TYPE_BOUNCER',
'COMPONENT_TYPE_SPRING_PAD',
'COMPONENT_TYPE_SWITCH',
'COMPONENT_TYPE_ZONE_CONTROL',
'COMPONENT_TYPE_MODEL_BUILDER',
'COMPONENT_TYPE_SOUND_REPEATER',
'COMPONENT_TYPE_CHEST',
'COMPONENT_TYPE_SHOWCASE_MODEL_HANDLER',
'COMPONENT_TYPE_ARCADE',
'COMPONENT_TYPE_RENDER',
'COMPONENT_TYPE_SOUND_AMBIENT_2D',
'COMPONENT_TYPE_SOUND_AMBIENT_3D',
'COMPONENT_TYPE_SOUND_TRIGGER',
'COMPONENT_TYPE_RACING_SOUND_TRIGGER',
'COMPONENT_TYPE_CUSTOM_BUILD_ASSEMBLY',
'COMPONENT_TYPE_GENERIC_ACTIVATOR',
'COMPONENT_TYPE_PROPERTY_VENDOR',
'COMPONENT_TYPE_ROCKET_LAUNCH',
'COMPONENT_TYPE_ROCKET_LANDING_COMPONENT',
'COMPONENT_TYPE_FACTION_TRIGGER',
'COMPONENT_TYPE_RACING_CONTROL',
'COMPONENT_TYPE_GATE_RUSH',
'COMPONENT_TYPE_BBB',
'COMPONENT_TYPE_CRAFTING'
]
component_order_as_ints = {}
component_int_to_name = {}
for component in component_initialization_order:
component_order_as_ints[components[component]] = component
for component in components:
component_int_to_name[components[component]] = component
class GameObject:
type = ""
class ObjectLoadState:
createdGameObject = GameObject()
components = []
hasPhysicsComponent = False
hasDestroyable = False
hasPathfindingComponent = False
hasProximityMonitorComponent = False
hasScriptComponent = False
hasDroppedLootComponent = False
hasModelbehaviors = False
somethingOrNothing = False
physicsComponentId = -1
# Begin custom attributes
serializedOrder = []
hasMissionOffer = False
class NiPoint3:
x = 0.0
y = 0.0
z = 0.0
class NiQuaternion:
w = 0.0
x = 0.0
y = 0.0
z = 0.0
class LoadObject:
objId = 0
owner = 0
lotToSpawn = 0
isLocalPlayer = False
hasDropEffect = False
bIsSmashable = False
dynamicPhysics = False
spawnPosition = NiPoint3()
spawnRotation = NiQuaternion()
scale = 0.0
legoBrickID = 0
legoColorID = 0
configData = {}
isHFPaletteObject = False
objType = 0
useSimplePhysics = False
bDelayedLoad = False
# Don't know the name yet of this
field8_0x20 = True

View File

@@ -1,408 +0,0 @@
import ComponentDefinitions as cd
def ApplyComponentWhitelist():
# Dont care to actually do this, just want the call for now.
pass
def ControllablePhysFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasModelbehaviors:
if not loadObject.hasDropEffect:
if not loadObject.useSimplePhysics:
objectLoadState.components.append('CONTROLLABLE_PHYSICS')
else:
objectLoadState.components.append('SIMPLE_PHYSICS')
else:
loadObject.physicsComponentId = componentId
def RenderFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if loadObject.lotToSpawn == 176:
return
gmlevel = loadObject.configData.get('gmlevel', 0)
if gmlevel > 0 and gmlevel < 6:
componentId = 9940 # Override the componentId of the render component to be 9940, the Mythran Render Component
renderDisabled = loadObject.configData.get('renderDisabled', False)
if renderDisabled:
return
if objectLoadState.createdGameObject.type == 'BlockingVolume':
return
rejectedLots = [5937, 5938, 9741, 9742, 9862, 9863]
if loadObject.lotToSpawn in rejectedLots:
return
if loadObject.lotToSpawn == 6368:
FxFactory(loadObject, objectLoadState, componentId)
return
FxFactory(loadObject, objectLoadState, componentId)
defaultWrapperAsset = ""
hasNifAsset = False
hasKfmAsset = False
allowRenderWrapping = False
nifName = loadObject.configData.get('nif_name', '')
if nifName == '':
print('TODO query cdc for this data in the Render component')
nifName = 'mesh/something.nif' # if empty get nifname as the render_asset column of the RenderComponent table from the database
if nifName[-1] == 'f':
hasNifAsset = True
elif nifName[-1] == 'm':
hasKfmAsset = True
if defaultWrapperAsset != '':
if defaultWrapperAsset[-1] == 'm':
allowRenderWrapping = not loadObject.configData.get('preventRenderWrapping', False)
if allowRenderWrapping or hasKfmAsset or (not defaultWrapperAsset == 'PrimitiveModels' and not hasNifAsset and not loadObject.configData.get('CreateNULLRender', False)):
objectLoadState.components.append('SKINNED_RENDER')
else:
objectLoadState.components.append('RENDER')
def FxFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('FX')
def SimplePhysFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasModelbehaviors:
objectLoadState.physicsComponentId = componentId
return
if not loadObject.hasDropEffect:
return
markedAsPhantom = loadObject.configData.get('markedAsPhantom', False)
if markedAsPhantom:
objectLoadState.components.append('PHANTOM_PHYSICS')
else:
objectLoadState.components.append('SIMPLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def CharacterFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('POSSESSOR')
objectLoadState.components.append('MOUNT_CONTROL')
objectLoadState.components.append('PET_CREATOR')
objectLoadState.components.append('LEVEL_PROGRESSION')
objectLoadState.components.append('PLAYER_FORCED_MOVEMENT')
objectLoadState.components.append('CHARACTER')
def ScriptFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int, add_pathfinding_control: bool):
custom_script_client = loadObject.configData.get('custom_script_client', '')
custom_script_server = loadObject.configData.get('custom_script_server', '')
if componentId == 0 and custom_script_client == '' and custom_script_server == '':
return
objectLoadState.components.append('SCRIPT')
if not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
if not objectLoadState.hasPathfindingComponent and add_pathfinding_control:
objectLoadState.components.append('PATHFINDING_CONTROL')
objectLoadState.hasPathfindingComponent = True
def BouncerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('BOUNCER')
def DestroyableFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('STATUS_EFFECT')
objectLoadState.components.append('BUFF')
objectLoadState.components.append('DESTROYABLE')
objectLoadState.hasDestroyable = True
def SkillFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SKILL')
def SpawnerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SPAWNER')
# If game state is happy flower
spawntemplate = loadObject.configData.get('spawntemplate', '')
print('TODO query cdc for this data in the Spawner component')
render_asset = loadObject.configData.get('render_asset', 'test.nif') # Get this from RenderComponent table
render_id = loadObject.configData.get('render_id', '') # Get this from RenderComponent table
if render_asset[-1] == 'f':
objectLoadState.components.append('SKINNED_RENDER')
else:
objectLoadState.components.append('RENDER')
def ItemFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ITEM')
def ModularBuildFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MODULAR_BUILD')
def BuildControllerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('BUILD_CONTROLLER')
def VendorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
objectLoadState.components.append('VENDOR')
def InventoryFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('INVENTORY')
def ProjectilePhysicsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not loadObject.hasDropEffect:
objectLoadState.components.append('PROJECTILE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def ShootingGalleryFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SHOOTING_GALLERY')
def RigibBodyPhantomPhysicsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('RIGID_BODY_PHANTOM_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def ChestFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('CHEST')
def CollectibleFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('COLLECTIBLE')
if not objectLoadState.hasDestroyable:
objectLoadState.components.append('DESTROYABLE')
objectLoadState.hasDestroyable = True
def BlueprintFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('BLUEPRINT')
def MovingPlatformFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MOVING_PLATFORM')
def PetFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
inInventory = loadObject.configData.get('inInventory', False)
if inInventory:
return
if not objectLoadState.hasPathfindingComponent:
objectLoadState.components.append('PATHFINDING_CONTROL')
objectLoadState.hasPathfindingComponent = True
objectLoadState.components.append('PET')
def PlatformBoundaryFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PLATFORM_BOUNDARY')
def ModuleFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MODULE')
def ArcadeFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ARCADE')
def HavokVehiclePhysicsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
use_simple_physics = loadObject.configData.get('use_simple_physics', False)
if use_simple_physics:
objectLoadState.components.append('SIMPLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
else:
objectWorldState = loadObject.configData.get('objectWorldState', '')
if objectWorldState == 0 or objectWorldState != 2:
objectLoadState.components.append('HAVOK_VEHICLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def MovementAiFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MOVEMENT_AI')
def ExhibitFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
# Sorry aron, doesnt do anything :(
pass
def MinifigFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MINIFIG')
def PropertyFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PROPERTY')
def ModelBuilderFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MODEL_BUILDER')
def ScriptedActivityFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SCRIPTED_ACTIVITY')
def PhantomPhysicsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not loadObject.hasDropEffect:
objectLoadState.components.append('PHANTOM_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def SpringPadFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SPRING_PAD')
def ModelFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
modelType = loadObject.configData.get('modelType', 0)
if not objectLoadState.hasModelbehaviors:
if not objectLoadState.hasPhysicsComponent:
objectLoadState.components.append('SIMPLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
elif not objectLoadState.hasPhysicsComponent:
if modelType == 0:
objectLoadState.components.append('CONTROLLABLE_PHYSICS')
else:
objectLoadState.components.append('SIMPLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
if modelType != 0 and not objectLoadState.hasPathfindingComponent:
objectLoadState.components.append('PATHFINDING_CONTROL')
objectLoadState.hasPathfindingComponent = True
hasPropertyObjectID = loadObject.configData.get('propertyObjectID', 0) != 0
inInventory = loadObject.configData.get('inInventory', False)
if hasPropertyObjectID and inInventory:
objectLoadState.components.append('MODEL_BEHAVIORS')
else:
objectLoadState.components.append('MUTABLE_MODEL_BEHAVIORS')
def PropertyEntranceFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PROPERTY_ENTRANCE')
def PropertyManagementFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PROPERTY_MANAGEMENT')
def VehiclePhysicsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('VEHICLE_PHYSICS')
objectLoadState.hasPhysicsComponent = True
def PhysicsSystemFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasModelbehaviors:
if not loadObject.hasDropEffect:
objectLoadState.components.append('PHYSICS_SYSTEM')
objectLoadState.hasPhysicsComponent = True
def RebuildFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('REBUILD')
if not objectLoadState.hasDestroyable:
objectLoadState.components.append('DESTROYABLE')
objectLoadState.hasDestroyable = True
loadObject.bIsSmashable = True
def BaseCombatAiFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int, add_pathfinding_control: bool):
if not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
if not objectLoadState.hasPathfindingComponent and add_pathfinding_control:
objectLoadState.components.append('PATHFINDING_CONTROL')
objectLoadState.hasPathfindingComponent = True
objectLoadState.components.append('BASE_COMBAT_AI')
def ProximityMonitorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
print('TODO query cdc for this data in prox mon')
# There must be a row for this component in the ProximityMonitorComponent table to get this component
LoadOnClient = loadObject.configData.get('LoadOnClient', False) # Get this from ProximityMonitorComponent table if you know there is a column for it
if LoadOnClient:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
def DonationVendorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
objectLoadState.components.append('DONATION_VENDOR')
def AchievmentVendorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
objectLoadState.components.append('ACHIEVEMENT_VENDOR')
def CraftingFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
# Game verson must be above 999 for this to work!
gameVersion = 1000
if gameVersion > 999:
objectLoadState.components.append('CRAFTING')
# Technically Possessable and Possessor are the exact same thing
def PossessableFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('POSSESSABLE')
def PossessorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('POSSESSOR')
def PropertyPlaqueFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PROPERTY_PLAQUE')
def BuildBorderFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('BUILD_BORDER')
def CullingPlaneFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('CULLING_PLANE')
def GateRushFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('GATE_RUSH')
def RailActivatorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('RAIL_ACTIVATOR')
def RollerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ROLLER')
def PlayerForcedMovementFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PLAYER_FORCED_MOVEMENT')
def RacingSoundTriggerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('RACING_SOUND_TRIGGER')
def RocketLaunchLupFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ROCKET_LAUNCH_LUP')
def ModuleAssemblyFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MODULE_ASSEMBLY')
def ShowcaseModelHandlerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SHOWCASE_MODEL_HANDLER')
def GenericActivatorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('GENERIC_ACTIVATOR')
def PropertyVendorFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('PROPERTY_VENDOR')
def RocketLaunchFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ROCKET_LAUNCH')
def RocketLandingComponentFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ROCKET_LANDING_COMPONENT')
def RacingControlFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('RACING_CONTROL')
def FactionTriggerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('FACTION_TRIGGER')
def MissionOfferFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('MISSION_OFFER')
objectLoadState.hasMissionOffer = True
def RacingStatsFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('RACING_STATS')
def LupExhibitFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('LUP_EXHIBIT')
def BBBFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('BBB')
def SoundTriggerFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SOUND_TRIGGER')
def SwitchFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SWITCH')
def ZoneControlFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('ZONE_CONTROL')
def ChanglingFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('CHANGELING')
def ChoiceBuildFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('CHOICE_BUILD')
def PackageFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
# Literally returns nothing
pass
def SoundRepeaterFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SOUND_REPEATER')
def SoundAmbient2DFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
if loadObject.isLocalPlayer:
objectLoadState.components.append('SOUND_AMBIENT_2D')
def SoundAmbient3DFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('SOUND_AMBIENT_3D')
def CustomBuildAssemblyFactory(loadObject: cd.LoadObject, objectLoadState: cd.ObjectLoadState, componentId: int):
objectLoadState.components.append('CUSTOM_BUILD_ASSEMBLY')

View File

@@ -1,306 +0,0 @@
import ComponentDefinitions as cd
import ComponentFactories as cf
# If we have any of these components, we need pathfinding control
def CheckIfNeedsPathfindingControl(components_to_load: dict):
add_pathfinding_control = cd.components['COMPONENT_TYPE_CONTROLLABLE_PHYSICS'] in components_to_load
add_pathfinding_control |= cd.components['COMPONENT_TYPE_PROJECTILE_PHYSICS'] in components_to_load
add_pathfinding_control |= cd.components['COMPONENT_TYPE_HAVOK_VEHICLE_PHYSICS'] in components_to_load
add_pathfinding_control |= cd.components['COMPONENT_TYPE_VEHICLE_PHYSICS'] in components_to_load
return add_pathfinding_control
def DoObjectPreLoad(components_to_load: dict):
isHfActive = False
cf.ApplyComponentWhitelist()
objectLoadState = cd.ObjectLoadState()
loadObject = cd.LoadObject()
for componentType in cd.component_order_as_ints.keys():
try:
componentId = components_to_load[componentType]
except KeyError:
continue
try:
match cd.component_int_to_name[componentType]:
case 'COMPONENT_TYPE_CONTROLLABLE_PHYSICS':
if objectLoadState.hasDroppedLootComponent: continue
cf.ControllablePhysFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RENDER':
cf.RenderFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SIMPLE_PHYSICS':
if objectLoadState.hasDroppedLootComponent: continue
cf.SimplePhysFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CHARACTER':
cf.CharacterFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SCRIPT':
cf.ScriptFactory(loadObject, objectLoadState, componentId, CheckIfNeedsPathfindingControl(components_to_load))
case 'COMPONENT_TYPE_BOUNCER':
cf.BouncerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_DESTROYABLE':
cf.DestroyableFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SKILL':
cf.SkillFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SPAWNER':
cf.SpawnerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ITEM':
cf.ItemFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MODULAR_BUILD':
cf.ModularBuildFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_BUILD_CONTROLLER':
cf.BuildControllerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_VENDOR':
cf.VendorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_INVENTORY':
cf.InventoryFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROJECTILE_PHYSICS':
if objectLoadState.hasDroppedLootComponent: continue
cf.ProjectilePhysicsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SHOOTING_GALLERY':
cf.ShootingGalleryFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS':
cf.RigibBodyPhantomPhysicsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CHEST':
cf.ChestFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_COLLECTIBLE':
cf.CollectibleFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_BLUEPRINT':
cf.BlueprintFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MOVING_PLATFORM':
cf.MovingPlatformFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PET':
cf.PetFactory(loadObject, objectLoadState, componentId)
print('Deleting COMPONENT_TYPE_MODEL and COMPONENT_TYPE_ITEM due to COMPONENT_TYPE_PET being loaded')
toDel = cd.components['COMPONENT_TYPE_MODEL']
del components_to_load[toDel]
toDel = cd.components['COMPONENT_TYPE_ITEM']
del components_to_load[toDel]
case 'COMPONENT_TYPE_PLATFORM_BOUNDARY':
cf.PlatformBoundaryFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MODULE':
cf.ModuleFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ARCADE':
cf.ArcadeFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_HAVOK_VEHICLE_PHYSICS':
cf.HavokVehiclePhysicsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MOVEMENT_AI':
cf.MovementAiFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_EXHIBIT':
cf.ExhibitFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MINIFIG':
cf.MinifigFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROPERTY':
cf.PropertyFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MODEL_BUILDER':
cf.ModelBuilderFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SCRIPTED_ACTIVITY':
cf.ScriptedActivityFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PHANTOM_PHYSICS':
if objectLoadState.hasDroppedLootComponent: continue
cf.PhantomPhysicsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SPRING_PAD':
cf.SpringPadFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MODEL':
cf.ModelFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROPERTY_ENTRANCE':
cf.PropertyEntranceFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROPERTY_MANAGEMENT':
cf.PropertyManagementFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_VEHICLE_PHYSICS':
cf.VehiclePhysicsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PHYSICS_SYSTEM':
cf.PhysicsSystemFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_REBUILD':
cf.RebuildFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SWITCH':
cf.SwitchFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ZONE_CONTROL':
cf.ZoneControlFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CHANGELING':
cf.ChanglingFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CHOICE_BUILD':
cf.ChoiceBuildFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PACKAGE':
cf.PackageFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SOUND_REPEATER':
cf.SoundRepeaterFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SOUND_AMBIENT_2D':
cf.SoundAmbient2DFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SOUND_AMBIENT_3D':
cf.SoundAmbient3DFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CUSTOM_BUILD_ASSEMBLY':
cf.CustomBuildAssemblyFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_BASE_COMBAT_AI':
cf.BaseCombatAiFactory(loadObject, objectLoadState, componentId, CheckIfNeedsPathfindingControl(components_to_load))
case 'COMPONENT_TYPE_MODULE_ASSEMBLY':
cf.ModuleAssemblyFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SHOWCASE_MODEL_HANDLER':
cf.ShowcaseModelHandlerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_GENERIC_ACTIVATOR':
cf.GenericActivatorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROPERTY_VENDOR':
cf.PropertyVendorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ROCKET_LAUNCH':
cf.RocketLaunchFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ROCKET_LANDING_COMPONENT':
cf.RocketLandingComponentFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RACING_CONTROL':
cf.RacingControlFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_FACTION_TRIGGER':
cf.FactionTriggerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_MISSION_OFFER':
cf.MissionOfferFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RACING_STATS':
cf.RacingStatsFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_LUP_EXHIBIT':
cf.LupExhibitFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_BBB':
cf.BBBFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_SOUND_TRIGGER':
cf.SoundTriggerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROXIMITY_MONITOR':
cf.ProximityMonitorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RACING_SOUND_TRIGGER':
cf.RacingSoundTriggerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ROCKET_LAUNCH_LUP':
cf.RocketLaunchLupFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_DONATION_VENDOR':
cf.DonationVendorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ACHIEVEMENT_VENDOR':
cf.AchievmentVendorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_GATE_RUSH':
cf.GateRushFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_RAIL_ACTIVATOR':
cf.RailActivatorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_ROLLER':
cf.RollerFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT':
cf.PlayerForcedMovementFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CRAFTING':
cf.CraftingFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_POSSESSABLE':
cf.PossessableFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_POSSESSOR':
cf.PossessorFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_PROPERTY_PLAQUE':
cf.PropertyPlaqueFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_BUILD_BORDER':
cf.BuildBorderFactory(loadObject, objectLoadState, componentId)
case 'COMPONENT_TYPE_CULLING_PLANE':
cf.CullingPlaneFactory(loadObject, objectLoadState, componentId)
except KeyError:
print(f'Unknown component: {componentType}')
if not 'is_smashable' in loadObject.configData and loadObject.bIsSmashable:
loadObject.configData['is_smashable'] = True
is_smashable = loadObject.configData['is_smashable']
if is_smashable and not objectLoadState.hasDestroyable and loadObject.lotToSpawn != 176:
objectLoadState.components.append('DESTROYABLE')
if objectLoadState.hasMissionOffer and not objectLoadState.hasProximityMonitorComponent:
objectLoadState.components.append('PROXIMITY_MONITOR')
objectLoadState.hasProximityMonitorComponent = True
if loadObject.field8_0x20 and loadObject.owner != 0:
objectLoadState.components.append('OVERHEAD_ICON')
trigger_id = loadObject.configData.get('trigger_id', 0)
if trigger_id != 0:
objectLoadState.components.append('TRIGGER')
return objectLoadState
components_to_load = {}
# Testing code to load all components
for i in range(110):
components_to_load[i] = i
objectLoadState = DoObjectPreLoad(components_to_load)
# Convert the components to ints
components_to_int = []
for component in objectLoadState.components:
components_to_int.append([cd.components[f'COMPONENT_TYPE_{component}'], component])
# Print out the components in a more readable format
for comp in components_to_int:
print(comp[0], comp[1])

View File

@@ -11,7 +11,6 @@
#include "eConnectionType.h"
#include "eChatInternalMessageType.h"
#include "ChatPackets.h"
#include "dConfig.h"
PlayerContainer::PlayerContainer() {
}
@@ -20,10 +19,6 @@ PlayerContainer::~PlayerContainer() {
mPlayers.clear();
}
TeamData::TeamData() {
lootFlag = Game::config->GetValue("default_team_loot") == "0" ? 0 : 1;
}
void PlayerContainer::InsertPlayer(Packet* packet) {
CINSTREAM_SKIP_HEADER;
PlayerData* data = new PlayerData();

View File

@@ -18,7 +18,6 @@ struct PlayerData {
};
struct TeamData {
TeamData();
LWOOBJID teamID = LWOOBJID_EMPTY; // Internal use
LWOOBJID leaderID = LWOOBJID_EMPTY;
std::vector<LWOOBJID> memberIDs{};

View File

@@ -1,33 +1,4 @@
#include "CDLootTableTable.h"
#include "CDClientManager.h"
#include "CDComponentsRegistryTable.h"
#include "CDItemComponentTable.h"
#include "eReplicaComponentType.h"
// Sort the tables by their rarity so the highest rarity items are first.
void SortTable(LootTableEntries& table) {
auto* componentsRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
auto* itemComponentTable = CDClientManager::Instance().GetTable<CDItemComponentTable>();
// We modify the table in place so the outer loop keeps track of what is sorted
// and the inner loop finds the highest rarity item and swaps it with the current position
// of the outer loop.
for (auto oldItrOuter = table.begin(); oldItrOuter != table.end(); oldItrOuter++) {
auto lootToInsert = oldItrOuter;
// Its fine if this starts at 0, even if this doesnt match lootToInsert as the actual highest will
// either be found and overwrite these values, or the original is somehow zero and is still the highest rarity.
uint32_t highestLootRarity = 0;
for (auto oldItrInner = oldItrOuter; oldItrInner != table.end(); oldItrInner++) {
uint32_t itemComponentId = componentsRegistryTable->GetByIDAndType(oldItrInner->itemid, eReplicaComponentType::ITEM);
uint32_t rarity = itemComponentTable->GetItemComponentByID(itemComponentId).rarity;
if (rarity > highestLootRarity) {
highestLootRarity = rarity;
lootToInsert = oldItrInner;
}
}
Game::logger->LogDebug("CDLootTableTable", "highest rarity %i item id %i", highestLootRarity, lootToInsert->itemid);
std::swap(*oldItrOuter, *lootToInsert);
}
}
CDLootTable CDLootTableTable::ReadRow(CppSQLite3Query& tableData) const {
CDLootTable entry{};
@@ -61,9 +32,6 @@ void CDLootTableTable::LoadValuesFromDatabase() {
this->entries[lootTableIndex].push_back(ReadRow(tableData));
tableData.nextRow();
}
for (auto& [id, table] : this->entries) {
SortTable(table);
}
}
const LootTableEntries& CDLootTableTable::GetTable(uint32_t tableId) {
@@ -81,7 +49,6 @@ const LootTableEntries& CDLootTableTable::GetTable(uint32_t tableId) {
this->entries[tableId].push_back(ReadRow(tableData));
tableData.nextRow();
}
SortTable(this->entries[tableId]);
return this->entries[tableId];
}

View File

@@ -345,7 +345,7 @@ void Entity::Initialize() {
int buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF);
int rebuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);
int componentID = -1;
int componentID = 0;
if (collectibleComponentID > 0) componentID = collectibleComponentID;
if (rebuildComponentID > 0) componentID = rebuildComponentID;
if (buffComponentID > 0) componentID = buffComponentID;
@@ -353,8 +353,7 @@ void Entity::Initialize() {
CDDestructibleComponentTable* destCompTable = CDClientManager::Instance().GetTable<CDDestructibleComponentTable>();
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); });
bool isSmashable = GetVarAs<int32_t>(u"is_smashable") != 0;
if (buffComponentID > 0 || collectibleComponentID > 0 || isSmashable) {
if (buffComponentID > 0 || collectibleComponentID > 0) {
DestroyableComponent* comp = new DestroyableComponent(this);
if (m_Character) {
comp->LoadFromXml(m_Character->GetXMLDoc());
@@ -374,7 +373,6 @@ void Entity::Initialize() {
comp->SetMaxHealth(destCompData[0].life);
comp->SetMaxImagination(destCompData[0].imagination);
comp->SetMaxArmor(destCompData[0].armor);
comp->SetDeathBehavior(destCompData[0].death_behavior);
comp->SetIsSmashable(destCompData[0].isSmashable);
@@ -395,7 +393,7 @@ void Entity::Initialize() {
}
// extraInfo overrides. Client ORs the database smashable and the luz smashable.
comp->SetIsSmashable(comp->GetIsSmashable() | isSmashable);
comp->SetIsSmashable(comp->GetIsSmashable() | (GetVarAs<int32_t>(u"is_smashable") != 0));
}
} else {
comp->SetHealth(1);
@@ -428,19 +426,6 @@ void Entity::Initialize() {
}
}
// override the factions if needed.
auto setFaction = GetVarAsString(u"set_faction");
if (!setFaction.empty()) {
// TODO also split on space here however we do not have a general util for splitting on multiple characters yet.
std::vector<std::string> factionsToAdd = GeneralUtils::SplitString(setFaction, ';');
int32_t factionToAdd;
for (const auto faction : factionsToAdd) {
if (GeneralUtils::TryParse(faction, factionToAdd)) {
comp->AddFaction(factionToAdd, true);
}
}
}
m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, comp));
}
@@ -719,12 +704,12 @@ void Entity::Initialize() {
const Path* path = Game::zoneManager->GetZone()->GetPath(pathName);
//Check to see if we have an attached path and add the appropiate component to handle it:
if (path) {
if (path){
// if we have a moving platform path, then we need a moving platform component
if (path->pathType == PathType::MovingPlatform) {
MovingPlatformComponent* plat = new MovingPlatformComponent(this, pathName);
m_Components.insert(std::make_pair(eReplicaComponentType::MOVING_PLATFORM, plat));
// else if we are a movement path
// else if we are a movement path
} /*else if (path->pathType == PathType::Movement) {
auto movementAIcomp = GetComponent<MovementAIComponent>();
if (movementAIcomp){
@@ -939,20 +924,10 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
outBitStream->Write1(); //ldf data
RakNet::BitStream settingStream;
int32_t numberOfValidKeys = m_Settings.size();
// Writing keys value pairs the client does not expect to receive or interpret will result in undefined behavior,
// so we need to filter out any keys that are not valid and fix the number of valid keys to be correct.
// TODO should make this more efficient so that we dont waste loops evaluating the same condition twice
for (LDFBaseData* data : m_Settings) {
if (!data || data->GetValueType() == eLDFType::LDF_TYPE_UNKNOWN) {
numberOfValidKeys--;
}
}
settingStream.Write<uint32_t>(numberOfValidKeys);
settingStream.Write<uint32_t>(m_Settings.size());
for (LDFBaseData* data : m_Settings) {
if (data && data->GetValueType() != eLDFType::LDF_TYPE_UNKNOWN) {
if (data) {
data->WriteToPacket(&settingStream);
}
}
@@ -971,6 +946,7 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
RakNet::BitStream settingStream;
settingStream.Write<uint32_t>(ldfData.size());
for (LDFBaseData* data : ldfData) {
if (data) {
data->WriteToPacket(&settingStream);
@@ -1237,7 +1213,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
renderComponent->Serialize(outBitStream, bIsInitialUpdate);
}
if (modelComponent || !destroyableSerialized) {
if (modelComponent) {
DestroyableComponent* destroyableComponent;
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate);
@@ -1576,17 +1552,7 @@ void Entity::Kill(Entity* murderer) {
}
if (!IsPlayer()) {
auto* destroyableComponent = GetComponent<DestroyableComponent>();
bool waitForDeathAnimation = false;
if (destroyableComponent) {
waitForDeathAnimation = destroyableComponent->GetDeathBehavior() == 0;
}
// Live waited a hard coded 12 seconds for death animations of type 0 before networking destruction!
constexpr float DelayDeathTime = 12.0f;
if (waitForDeathAnimation) AddCallbackTimer(DelayDeathTime, [this]() { Game::entityManager->DestroyEntity(this); });
else Game::entityManager->DestroyEntity(this);
Game::entityManager->DestroyEntity(this);
}
const auto& grpNameQBShowBricks = GetVar<std::string>(u"grpNameQBShowBricks");

View File

@@ -1,14 +1,8 @@
#include "TeamManager.h"
#include "EntityManager.h"
#include "Game.h"
#include "dConfig.h"
TeamManager* TeamManager::m_Address = nullptr; //For singleton method
Team::Team() {
lootOption = Game::config->GetValue("default_team_loot") == "0" ? 0 : 1;
}
TeamManager::TeamManager() {
}

View File

@@ -2,15 +2,16 @@
#include "Entity.h"
struct Team {
Team();
struct Team
{
LWOOBJID teamID = LWOOBJID_EMPTY;
char lootOption = 0;
std::vector<LWOOBJID> members{};
char lootRound = 0;
};
class TeamManager {
class TeamManager
{
public:
static TeamManager* Instance() {
if (!m_Address) {

View File

@@ -72,7 +72,6 @@ DestroyableComponent::DestroyableComponent(Entity* parent) : Component(parent) {
m_ImmuneToImaginationLossCount = 0;
m_ImmuneToQuickbuildInterruptCount = 0;
m_ImmuneToPullToPointCount = 0;
m_DeathBehavior = -1;
}
DestroyableComponent::~DestroyableComponent() {

View File

@@ -416,9 +416,6 @@ public:
const bool GetImmuneToQuickbuildInterrupt() {return m_ImmuneToQuickbuildInterruptCount > 0;};
const bool GetImmuneToPullToPoint() {return m_ImmuneToPullToPointCount > 0;};
int32_t GetDeathBehavior() const { return m_DeathBehavior; }
void SetDeathBehavior(int32_t value) { m_DeathBehavior = value; }
/**
* Utility to reset all stats to the default stats based on items and completed missions
*/
@@ -600,11 +597,6 @@ private:
uint32_t m_ImmuneToImaginationLossCount;
uint32_t m_ImmuneToQuickbuildInterruptCount;
uint32_t m_ImmuneToPullToPointCount;
/**
* Death behavior type. If 0, the client plays a death animation as opposed to a smash animation.
*/
int32_t m_DeathBehavior;
};
#endif // DESTROYABLECOMPONENT_H

View File

@@ -18,7 +18,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
&& !character->GetPlayerFlag(flag)) {
// If the player just started the mission, play a cinematic highlighting the target
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
} else if (missionState == eMissionState::READY_TO_COMPLETE) {
} else if (missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
// Makes the guard disappear once the mission has been completed
const auto zoneControlID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),

View File

@@ -43,7 +43,3 @@ maximum_mtu_size=1228
# This cannot just be any arbitrary number. This has to match the same value that is in your client.
# If you do not know what this value is, default it to 171022.
client_net_version=171022
# Turn to 0 to default teams to use the live accurate Shared Loot (0) by default as opposed to Free for All (1)
# This is used in both Chat and World servers.
default_team_loot=1