Advertisement
Guest User

dank memes for legacy orteil

a guest
Mar 27th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. G.AddData({
  2. name:'Example mod',
  3. author:'Orteil',
  4. desc:'A simple example mod that adds hot peppers and hot sauce.',
  5. engineVersion:1,
  6. manifest:'modManifest.js',
  7. requires:['Default dataset*'],
  8. sheets:{'spicySheet':'img/spicyModIconSheet.png'},//custom stylesheet (note : broken in IE and Edge for the time being)
  9. func:function()
  10. {
  11.     //The idea in this simple example mod is to add a few elements focused around hot sauce, because hot sauce is great and I use that stuff everywhere.
  12.    
  13.     //First we create a couple new resources :
  14.     new G.Res({
  15.         name:'grand dad',
  16.         desc:'The grandest dad of them all.//I am not sorry, Orteil.',
  17.         startWith:1,
  18.         visible:true,
  19.         partOf:'population',
  20.     category:'demog',
  21.         icon:[5,3],
  22.     });
  23.     new G.Res({
  24.         name:'hot pepper',
  25.         desc:'[hot pepper]s are loaded with capsaicin and, depending on who you ask, may produce a pleasant burn when eaten.',
  26.         icon:[0,0,'spicySheet'],
  27.         turnToByContext:{'eat':{'health':0.01,'happiness':0.03},'decay':{'spoiled food':0.5}},//this basically translates to : "when eaten, generate some health and happiness; when rotting, turn into either nothing or some spoiled food"
  28.         partOf:'food',
  29.         category:'food',
  30.     });
  31.     new G.Res({
  32.         name:'hot sauce',
  33.         desc:'Made from [herb]s and the [hot pepper,Spiciest peppers], this [hot sauce] stays fresh for a while and will leave anyone panting and asking for more.',
  34.         icon:[1,0,'spicySheet'],
  35.         turnToByContext:{'eat':{'health':0.03,'happiness':0.1},'decay':{'hot sauce':0.95,'spoiled food':0.05}},//that last part makes hot sauce effectively have a 95% chance of simply not rotting (in effect, it decays into itself)
  36.         partOf:'food',
  37.         category:'food',
  38.     });
  39.    
  40.     //Then we augment the base data to incorporate our new resources :
  41.         //adding hot pepper as something that can be gathered from grass
  42.     G.getDict('grass').res['gather']['hot pepper']=3;
  43.         //adding a new mode to artisans so they can make hot sauce from hot peppers
  44.     G.getDict('artisan').modes['hot sauce']={name:'Make hot sauce',desc:'Turn 3 [hot pepper]s and 3 [herb]s into 1 [hot sauce].',req:{'hot sauce preparing':true},use:{'knapped tools':1}};
  45.         //adding a new effect to artisans that handles the actual hot sauce preparing and is only active when the unit has the mode "hot sauce"
  46.     G.getDict('artisan').effects.push({type:'convert',from:{'hot pepper':3,'herb':3},into:{'hot sauce':1},every:3,mode:'hot sauce'});
  47.    
  48.     //Then we add a new technology which is required by the artisans to gain access to the "hot sauce" mode :
  49.     new G.Tech({
  50.         name:'hot sauce preparing',
  51.         desc:'@[artisan]s can now produce [hot sauce] from [hot pepper]s and [herb]s//This special recipe allows a skilled craftsman to fully express the complex aromas present in hot peppers.',
  52.         icon:[0,1,'spicySheet'],
  53.         cost:{'insight':10},
  54.         req:{'cooking':true},
  55.     });
  56.    
  57.     //Finally, we add a trait that amplifies the benefits of consuming hot sauce; it will take on average 20 years to appear once the conditions (knowing the "Hot sauce preparing" tech) is fulfilled.
  58.     new G.Trait({
  59.         name:'hot sauce madness',
  60.         desc:'@your people appreciate [hot sauce] twice as much and will be twice as happy from consuming it.',
  61.         icon:[1,1,'spicySheet'],
  62.         chance:20,
  63.         req:{'hot sauce preparing':true},
  64.         effects:[
  65.             {type:'function',func:function(){G.getDict('hot sauce').turnToByContext['eat']['happiness']=0.2;}},//this is a custom function executed when we gain the trait
  66.         ],
  67.     });
  68.    
  69.     //There are many other ways of adding and changing content; refer to /data.js, the default dataset, if you want to see how everything is done in the base game. Good luck!
  70. }
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement