Page MenuHomeFeedback Tracker

Central economy flags
New, NormalPublic

Description

Have you done something to CE spawn flags? Because ECE_NOLIFETIME and ECE_DYNAMIC_PERSISTENCY doesn't seem to work since last update.

I am expecting ECE_NOLIFETIME to create an item that would be deleted on restart and ECE_DYNAMIC_PERSISTENCY to create an item that would be deleted on restart unless player has taken it to inventory at least once.

Instead I got duplicates on restart which means items whern't properly handled by CE.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
22H2
Category
Dedicated Server
Steps To Reproduce
  1. Create a spawn-script that will spawn an item with provided flags on restart
  2. Wait DB to save
  3. Restart server
  4. Check for duplicates
Additional Information

I've tested next flags

const int NO_TRACE_NO_ALIGN         = ECE_KEEPHEIGHT|ECE_NOSURFACEALIGN|ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

const int NO_TRACE_ALIGN            = ECE_KEEPHEIGHT|ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

const int TRACE_ALIGN               = ECE_PLACE_ON_SURFACE|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

const int TRACE_NO_ALIGN            = ECE_TRACE|ECE_NOSURFACEALIGN|ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

And to spawn an object

Object spawnedObj = GetGame().CreateObjectEx(obj.GetType(), obj.GetPosition(), NO_TRACE_NO_ALIGN);

In all cases I've got dupes.
UPD: Item type was WorldContainer_Base
UPD: ItemBase behaviour is the same (dupes)

Event Timeline

Moonny created this task.Sep 14 2023, 12:01 PM
Moonny edited Additional Information. (Show Details)
Moonny edited Additional Information. (Show Details)Sep 14 2023, 12:18 PM

Ok I figured out (seems like). We can apply bitwise operations to constants like here

const int NO_TRACE_NO_ALIGN         = ECE_KEEPHEIGHT|ECE_NOSURFACEALIGN|ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

And there would be no warnings or errors. However, when using this constant as parameter in CreateObjectEx() method it will just not work as it should.
As soon as we change our variable to

int NO_TRACE_NO_ALIGN         = ECE_KEEPHEIGHT|ECE_NOSURFACEALIGN|ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_NOLIFETIME|ECE_DYNAMIC_PERSISTENCY;

everything should work.

I will not go any deeper in researching this issue, but printing both constant and non-constant values of NO_TRACE_NO_ALIGN in this example will give us the same log, so there must be something with bits of this variable or with how CreateObjectEx() is handling constants.