ID:1614953
 
(See the best response by LordAndrew.)
Code:
Problem description:

I've seen games where the player is able to change turfs or the environment(game world) at run time. Is that done with objects or are the turfs actually being manipulated? If it's turfs can anyone point me in the right direction of learning how to do something like that? All my attempts seemed to fail.

I ended up opting for using objects as structures. In the game I do have limited building space but I still like to think about obj limits ahead of time, not to mention saving all of those objects into a save file and loading them *the game in question is sort of like a sandbox game where you can build your own world , buildings, etc) is rather time consuming already with just a few objects. In short I'm looking for the quickest and most efficient approaches. BUT my main question is about the "turf painting".
var/turf/wall/W = new(locationhere) ??
Should work.. Doesn't it? I think I did that.
In response to Laser50
Doesn't work.
Atleast not that I can get it to work
Remember that turfs ARE locations. So that you're not trying to use src.loc

Any way, I managed to spawn water turfs just fine;
http://puu.sh/9UiIC/945575f137.png

With the following code:
/turf/verb/MakeWater()
set name = "Make Water"
set src in view(1)

var/turf/water/W = new(src)
In response to Laser50
Best response
Admittedly, if you have no plans to do anything with the object you're creating after its creation, you don't really need to declare a new variable to hold it in:

mob/verb/Dirt()
new /turf/dirt(src.loc)
In response to Laser50
Laser50 wrote:
Remember that turfs ARE locations. So that you're not trying to use src.loc

Any way, I managed to spawn water turfs just fine;
http://puu.sh/9UiIC/945575f137.png

With the following code:
> /turf/verb/MakeWater()
> set name = "Make Water"
> set src in view(1)
>
> var/turf/water/W = new(src)
>


Yea. I just can't get it to work no matter how I tried this method.
My turfs all end up deleted instead of whatever turf they are supposed to be.
In response to LordAndrew
LordAndrew wrote:
Admittedly, if you have no plans to do anything with the object you're creating after its creation, you don't really need to declare a new variable to hold it in:

> mob/verb/Dirt()
> new /turf/dirt(src.loc)
>

This works thanks.
In response to LordAndrew
LordAndrew wrote:
Admittedly, if you have no plans to do anything with the object you're creating after its creation, you don't really need to declare a new variable to hold it in:

> mob/verb/Dirt()
> new /turf/dirt(src.loc)
>


Actually, even I have some use for that, time to get rid of 20 "Variable not used" errors.
So thanks.
If you're going to have a building orientated game, you may want to use
var/turf/t=new/turf/water(src.loc)

That way you can set things like who built the turf and any other variables such as passwords or health. Alternatively you can put it in the turf's new() proc but that's less efficient.