Skip to content

Commit 9bbf264

Browse files
improve TypeOfValue system
1 parent 7a901e8 commit 9bbf264

File tree

16 files changed

+41
-36
lines changed

16 files changed

+41
-36
lines changed

Code/ContextSystem/Contexts/FunctionDefinitionContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public TypeOfValue? Returns
4343

4444
if (varTypeToken == null) return null;
4545

46-
return new TypeOfValue(varTypeToken.CreateInstance<VariableToken>().ValueType);
46+
return new SingleTypeOfValue(varTypeToken.CreateInstance<VariableToken>().ValueType);
4747
}
4848
}
4949

Code/MethodSystem/Methods/DoorMethods/DoorInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class DoorInfoMethod : LiteralValueReturningMethod, IReferenceResolvingMe
1717
{
1818
public Type ReferenceType => typeof(Door);
1919

20-
public override TypeOfValue LiteralReturnTypes => new([
20+
public override TypeOfValue LiteralReturnTypes => new TypesOfValue([
2121
typeof(TextValue),
2222
typeof(BoolValue),
2323
typeof(NumberValue)

Code/MethodSystem/Methods/HealthMethods/DamageInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DamageInfoMethod : ReturningMethod, IReferenceResolvingMethod, IAdd
1616
{
1717
public Type ReferenceType => typeof(DamageHandlerBase);
1818

19-
public override TypeOfValue Returns => new([
19+
public override TypeOfValue Returns => new TypesOfValue([
2020
typeof(TextValue),
2121
typeof(ReferenceValue)
2222
]);

Code/MethodSystem/Methods/IntercomMethods/IntercomInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class IntercomInfoMethod : ReturningMethod
2525
)
2626
];
2727

28-
public override TypeOfValue Returns => new([
28+
public override TypeOfValue Returns => new TypesOfValue([
2929
typeof(TextValue),
3030
typeof(PlayerValue),
3131
typeof(DurationValue)

Code/MethodSystem/Methods/ItemMethods/FirearmItemInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class FirearmItemInfoMethod : ReturningMethod
1010
{
1111
public override string Description => "Returns info about provided firearm";
1212

13-
public override TypeOfValue Returns => new([
13+
public override TypeOfValue Returns => new TypesOfValue([
1414
typeof(BoolValue),
1515
typeof(NumberValue)
1616
]);

Code/MethodSystem/Methods/ItemMethods/ItemInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class ItemInfoMethod : ReturningMethod, IReferenceResolvingMethod
1717

1818
public Type ReferenceType => typeof(Item);
1919

20-
public override TypeOfValue Returns => new([
20+
public override TypeOfValue Returns => new TypesOfValue([
2121
typeof(TextValue),
2222
typeof(PlayerValue),
2323
typeof(BoolValue)

Code/MethodSystem/Methods/ItemMethods/UsableItemInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class UsableItemInfoMethod : ReturningMethod
1010
{
1111
public override string Description => "Returns information about provided usable item, like Painkillers, Medkit, etc.";
1212

13-
public override TypeOfValue Returns => new([
13+
public override TypeOfValue Returns => new TypesOfValue([
1414
typeof(NumberValue),
1515
typeof(BoolValue)
1616
]);

Code/MethodSystem/Methods/PickupMethods/PickupInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class PickupInfoMethod : ReturningMethod, IReferenceResolvingMethod
1515
{
1616
public override string Description => "Returns information about a pickup.";
1717

18-
public override TypeOfValue Returns => new([
18+
public override TypeOfValue Returns => new TypesOfValue([
1919
typeof(PlayerValue),
2020
typeof(BoolValue),
2121
typeof(TextValue),

Code/MethodSystem/Methods/PlayerVariableMethods/ShowMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public override void Execute()
3737

3838
if (!PlayerExpressionToken.PropertyInfoMap.TryGetValue(property, out var propInfo) ||
3939
propInfo is not { ReturnType: var type, Handler: var handler } ||
40-
!typeof(LiteralValue).IsAssignableFrom(type))
40+
!typeof(LiteralValue).IsAssignableFrom(type.Type))
4141
{
4242
throw new ScriptRuntimeError(this, ErrorReasons[0]);
4343
}

Code/MethodSystem/Methods/RespawnMethods/RespawnWaveInfoMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class RespawnWaveInfoMethod : LiteralValueReturningMethod, IReferenceReso
1616
{
1717
public Type ReferenceType => typeof(RespawnWave);
1818

19-
public override TypeOfValue LiteralReturnTypes => new([
19+
public override TypeOfValue LiteralReturnTypes => new TypesOfValue([
2020
typeof(NumberValue),
2121
typeof(TextValue)
2222
]);

0 commit comments

Comments
 (0)