Skip to content

Commit

Permalink
[Fixes] Some fixes to the new inventory handler
Browse files Browse the repository at this point in the history
- Also fix a regression where primitive copy-paste was dummied out.
  • Loading branch information
riperiperi committed Dec 18, 2019
1 parent 3f4dc7d commit 986d7cc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TSOClient/FSO.IDE/BHAVEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ public void GetBulletinState(VM vm, VMAsyncBulletinCallback callback)
public void TokenRequest(VM vm, uint avatarID, uint guid, VMTokenRequestMode mode, List<int> attributeData, VMAsyncTokenCallback callback)
{
if (mode == VMTokenRequestMode.GetAttribute) attributeData[1] = 100;
if (mode == VMTokenRequestMode.TotalAttribute) attributeData[1] = (int)(guid % (uint)100);
callback(true, attributeData);
}

Expand Down
16 changes: 16 additions & 0 deletions TSOClient/tso.simantics/Primitives/VMInventoryOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override VMPrimitiveExitCode Execute(VMStackFrame context, VMPrimitiveOpe
var operand = (VMInventoryOperationsOperand)args;

var target = operand.ForStackObject ? context.StackObject : context.Caller;
var oldState = context.Thread.BlockingState;

//first of all... are we in an async wait state?
if (context.Thread.BlockingState != null && context.Thread.BlockingState is VMInventoryOpState)
Expand Down Expand Up @@ -252,6 +253,20 @@ public override VMPrimitiveExitCode Execute(VMStackFrame context, VMPrimitiveOpe
}
break;

case VMInventoryOpMode.FSOTokenTotalAttributeTemp0:
//total all instances of an attribute (guid, attribute) and return value (can be int size)
{
var mypid = target.PersistID;
var data = new List<int>();
data.Add(context.Thread.TempRegisters[0]); //index
data.Add(0);
vm.GlobalLink.TokenRequest(vm, mypid, operand.GUID, VMTokenRequestMode.TotalAttribute, data, (success, result) =>
{
TokenResponse(vm, operand, id, success, result);
});
}
break;

case VMInventoryOpMode.FSOGetUserID:
{
{
Expand All @@ -273,6 +288,7 @@ public override VMPrimitiveExitCode Execute(VMStackFrame context, VMPrimitiveOpe
break;
}
}
if (context.Thread.IsCheck) context.Thread.BlockingState = oldState;
return (context.Thread.IsCheck) ? VMPrimitiveExitCode.GOTO_TRUE : VMPrimitiveExitCode.CONTINUE_NEXT_TICK;
}

Expand Down
1 change: 1 addition & 0 deletions TSOClient/tso.world/Components/ParticleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ private void InternalDraw(GraphicsDevice device, Effect effect, int scale, bool
effect.Parameters["IndoorsTex"].SetValue(Indoors);

var fade = FadeProgress ?? 0f;
if (fade < 0) fade = fade * fade; //give a bias to weather fading in
effect.Parameters["Color"].SetValue(Tint.ToVector4() * (1 - Math.Abs(fade)));
effect.Parameters["TimeRate"].SetValue(Math.Max(1,TimeRate)*0.001f/ FSOEnvironment.RefreshRate);

Expand Down

0 comments on commit 986d7cc

Please sign in to comment.