Player Built Houses in Developer Help
Question on Keys.
Lummox JR using the key code you gave me how would I make a copy of the key?
obj/key ... verb/Copy() var/mob/M=usr if(keyname!="[M.client.ckey]:[M.name]") usr << "You can't make a copy of [src]." return new /obj/key(loc,purpose,keyname)
How would I add the area plot to the deed like I mentioned earlier.
obj/item/landdeed name="land deed" var/keyname // indicates the owner var/list/history // keeps track of previous owners var/area/plot New(newloc,area/A,mob/M) ..() plot=A history=list() Transfer(M) proc/Transfer(mob/M) if(M.client) keyname="[M.client.ckey]:[M.name]" else keyname=":[M.name]" history["[world.realtime]"]=keyname // tell the area it's been sold, so it can adjust housekeys and such if(hascall(A,"Transfer")) A:Transfer(M)
how would I check variables made in the area. I think I mentioned these earlier but I am not sure.
Every area has variables like price and size so how can I get it so the seller mob can access the variables in the area.
mob // you should check buyer.gold before an offer is made, // but be sure to check a second time in case he does // other buying before the seller says yes proc/BuyOffer(mob/buyer,area/plot) if(!client) ... // handle AI yourself return var/obj/landdeed/deed for(deed in src) if(deed.plot==plot) break if(!deed) buyer << "[src] isn't carrying the deed." src << "[buyer] wants to buy a plot of land (#[plot.n]) from you, but you need the deed if you want to sell it." return var/ans=alert(src,"[buyer] has made an offer to buy a plot of land from you. (Plot #[plot.n], [plot.width*plot.height] square yard\s, worth $[plot.price].) Would you like to sell it?","Buy offer from [buyer]","Yes","It's not for sale") if(ans!="Yes") buyer << "Sorry, but [src] won't sell that plot." return if(buyer.gold<plot.price) src << "Nevermind. Turns out [buyer] doesn't have enough money." buyer << "You can't afford to pay $[plot.price] for the land." return buyer.gold-=plot.price gold+=plot.price deed.Transfer(buyer) src << "You've just sold plot #[plot.n] to [buyer] for $[plot.price]." buyer << "You've just bought plot #[plot.n] from [buyer] for $[plot.price]."
mob/landdeedseller icon = 'deedseller.dmi' speed = 10 warea = /area/doffice var plotbuy wantbuy proc buyland(plotnumbuying) usr << "You bought plot number [plotnumbuying]. Happy Building" var/obj/deed/POH/D = new(usr) D.plotnumber = plotnumbuying verb Purchase_land() set src in oview(1) plotbuy = input("What plot number would you like to buy","Buying POH land") for(var/obj/deed/POH/D in world) if (D.plotnumber == src.plotbuy) usr << "Sorry someone else already owns that piece of land" return 0 usr << "Lucky you that plot of land has not been purchased yet" sleep(10) wantbuy = input("Would you like to buy plot number [plotbuy]","Buying POH land")in list("Yes","No") if (wantbuy == "No") return 0 else for(var/obj/gold/G in usr.contents) if(istype(G,/obj/gold/fifth)) for(var/area/POH/A in world) if (A.num == plotbuy) if (G.amount >= A.price) G.amount -= A.price buyland(plotbuy) return else usr << "You don\'t have enough cash." return else usr << "You must have the gem currency type" obj/door/POH // Begin POH door code var/keyname density = 1 icon = 'door.dmi' proc/openme() usr << "Unlocking" density = 0 proc/closeme() usr << "Locking" density = 1 proc/SetOwner(mob/M) if(M.client) M.keyname="[M.client.ckey]:[M.name]" // no idea why client would be null, but just in case... else M.keyname=":[M.name]" proc/CreateKey(atom/newloc) new /obj/key/POH(newloc,src,keyname) verb/UnLock() set src in oview(1) var/mob/M=usr for(var/obj/key/POH/key in M) if(key.purpose==src && key.keyname==keyname) openme() src.verbs += /obj/door/POH/verb/Lock src.verbs -= /obj/door/POH/verb/UnLock return 1 usr << "You don't have a key for this door." return 0 verb/Lock() set src in oview(1) var/mob/M=usr for(var/obj/key/POH/key in M) if(key.purpose==src && key.keyname==keyname) closeme() src.verbs -= /obj/door/POH/verb/Lock src.verbs += /obj/door/POH/verb/UnLock return 1 usr << "You don't have a key for this door." return 0obj/key/POH var/keyname var/authusername var/purpose icon = 'key.dmi' icon_state = "POH" verb Drop() src.Move(usr.loc) New(atom/newloc,_purpose,_keyname) ..() if(_purpose) name = "key to [_purpose]" purpose = _purpose keyname = _keynameobj/deed/POH var/plotnumber var/price icon = 'deed.dmi' insurance = 200 verb Examine() set src in usr.contents usr << "This is the deed to plot number [plotnumber]" proc Plotnumbercreate(plotbought,priceboughtat) src.plotnumber = plotbought src.price = priceboughtat
verb//POH verbs Build_Door() set category = "POH" for(var/obj/deed/POH/D in usr.contents) for(var/area/POH/A in world) if(A.num == D.plotnumber && A.loc == dd_area()) break var/obj/door/POH/N = new(src.loc) N.SetOwner(usr) N.CreateKey(usr) continue return 1 else usr << "You cannot build here" return