ID:2236771
 
Not a bug
BYOND Version:510
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 57.0.2987.133
Applies to:Map Editor, Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
In this thread, I asked a question about creating a generic monster spawner. For reference, I used the following DM code for monsters and monster spawners:

mob
monster
// Various variables and procs, irrelevant to the bug report.

monster/bug
icon='bug.dmi'

obj
spawner
var
spawnRate = 300 // Attempt to spawn every 30sec.
canSpawn = 1

New()
PeriodicSpawns()

proc
PeriodicSpawns()
set background = 1

while(1 == 1)
if(! canSpawn)
sleep(spawnRate)
continue

Spawn()
canSpawn = 0

spawner/monsterSpawner
var
possibleMonsters[]

Spawn()
var monsterType = pick(possibleMonsters)
var mob/monster/newMonster = new monsterType(loc)
newMonster.spawner = src
..()


I then used the Map Editor to place an instance of the Monster Spawner in a map. I right-clicked the instance to set the 'possibleMonsters' property with the value { /mob/monster/bug }. Upon running the game, when the Spawn() proc was called, I got the following error:

"runtime error: Cannot create objects of type /mob/monster/bug.
proc name: Spawn (/obj/spawnPoint/monsterSpawner/Spawn)
usr: null
src: the monsterSpawner (/obj/spawnPoint/monsterSpawner)
src.loc: the grass (9,5,1) (/turf/terrain/grass)
call stack:
the monsterSpawner (/obj/spawnPoint/monsterSpawner): Spawn()
the monsterSpawner (/obj/spawnPoint/monsterSpawner): PeriodicSpawns()
the monsterSpawner (/obj/spawnPoint/monsterSpawner): New(the grass (9,5,1) (/turf/terrain/grass))"

After consulting the forum post, I attempted a simplified version of the spawn code:

Spawn()
var monsterType = /mob/monster/bug
var mob/monster/newMonster = new monsterType(loc)
// ...Remaining code the same as above...


And found that it worked. When I revised 'possibleMonsters' to not be a list, and gave it the value '/mob/monster/bug', it still worked as expected.
I added a world.log statement to see what was coming into the monsterType variable...

Spawn()
var monsterType = pick(possibleMonsters)
world.log << "Spawning [monsterType]..."
var mob/monster/newMonster = new monsterType(loc)
// ...Remaining code the same as before...


Upon running both sets of code, I observed a difference. When the list was being pulled from the editor, the log message was:

'Spawning the bug...'

While, if the monster type was being pulled from a non-list, the message was:

'Spawning /mob/monster/bug...'

Upon consulting the forums again, user Kaiochao suggested that this might be either a legitimate bug, or possibly 'merely' an undocumented feature.

Numbered Steps to Reproduce Problem:
1. Using Dream Maker, create a new environment
2. Create a basic player mob, and map.
3. Use the code given above to create a /mob/monster/bug object.
4. Create a monster spawner as noted in the code snippet above.
5. On the map you created in Step 2, add an instance of the monster spawner.
6. Right-click the monster spawner, and select Edit... from the context menu.
7. In the list of properties, set 'possibleMonsters' to have a value { /mob/monster/bug }
8. Compile the environment.
9. Run the game
10. Observe that the spawner not only does not spawn mobs, but also throws an exception due to being unable to create a new instance of a mob/monster/bug instance.

Code Snippet (if applicable) to Reproduce Problem:
Relevant code snippets are supplied in the detailed explanation of the phenomena above

Expected Results:
If a property is a list, and I enter a list of paths in the Map Editor, these path literals should be used by DM code.

Alternately, if path literals should be being instantiated, there needs to be a way to denote that a path literal should not be instantiated, so that code that's using DM's typing system can operate without exception.

Actual Results:
If a property is a list, and I enter a list of paths in the Map Editor, these path literals are instantiated into new instances of things, and those instances are being used by DM code. When this instance is used by the new [type](args) syntax, this causes an unhandled exception.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Unknown.
In other user accounts? Unknown.
On other computers? Unknown.

When does the problem NOT occur?
Per above, this problem does not occur if I store a path literal in a non-list.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Unknown.

Workarounds:
I could probably write map-specific monster spawners that inherit from the
'base' monster spawner, and circumvent using the Map Editor completely. That being said, this is in conflict with the ability to specify a path literal which is interpreted as a type. I'm not sure what the correct behavior either is or should be.
Nadrew resolved issue (Not a bug)
In the instance editor

{/obj/one,/obj/two,/obj/three}


Is the same as doing

newlist(/obj/one,/obj/two,/obj/three)


The instance editor will actually convert newlist() to this format.