UMC icon indicating copy to clipboard operation
UMC copied to clipboard

Drop KeyValues usage

Open MAGNAT2645 opened this issue 4 years ago • 2 comments

I know this might sound like a bad idea but i think UMC should use something faster and less bugged. How about ConfigMap? This might fix issue #16.

MAGNAT2645 avatar Dec 20 '20 11:12 MAGNAT2645

Testing plugin: test_configmap.txt

test_configmap.cfg:

"Root" {
	"Section1" {
		"Key1"	"Value1"
		"Key2"	"true"
		"Key3"	"3.55"
		"Key4"	"150"
	}

	"CAPTURE THE FLAG" {
		"ctf_2fort" {
			"display"		"LEGENDARY MAP EH?"
			"allow_every"	"250"
		}

		"ctf_gorge" {
			"weight"	"0.5"
		}

		"ctf_doublecross" {}
	}
}

Output:

L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] Created ConfigMap 0xD420387: 0.000318 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] Get "Root.Section1.Key1" (value: Value1): 0.000262 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] Get "Root.Section1" (0xD45038A): 0.000061 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Root.Section1" keys and values:
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx]     "Key1": "Value1"
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx]     "Key3": "3.55"
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx]     "Key2": "true"
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx]     "Key4": "150"
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Root" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Section1" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Key1" is a keyvalue (value: "Value1", size: 7): 0.0000004462 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Key3" is a keyvalue (value: "3.55", size: 5): 0.0000013387 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Key2" is a keyvalue (value: "true", size: 5): 0.0000004462 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "Key4" is a keyvalue (value: "150", size: 4): 0.0000008924 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "CAPTURE THE FLAG" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "ctf_2fort" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "display" is a keyvalue (value: "LEGENDARY MAP EH?", size: 18): 0.0000004462 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "allow_every" is a keyvalue (value: "250", size: 4): 0.0000008924 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "ctf_doublecross" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "ctf_gorge" is a section
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] "weight" is a keyvalue (value: "0.5", size: 4): 0.0000004462 sec.
L 12/20/2020 - 19:22:24: [aon-test\test_configmap.smx] Deleted ConfigMap 0xD420387: 0.000098 sec.

MAGNAT2645 avatar Dec 20 '20 14:12 MAGNAT2645

I see 2 problems using ConfigMap with UMC:

  1. umc_mapcycle.txt HAS to be in addons/sourcemod/ (not in root folder)
  2. All sections and keys are sorted randomly (that's the StringMap feature, because actually there's no any sorting happens)

MAGNAT2645 avatar Dec 20 '20 17:12 MAGNAT2645