Advertisement
Guest User

hot.js

a guest
Jan 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  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:'hot',
  16. desc:'[hot pepper]s are loaded with capsaicin and, depending on who you ask, may produce a pleasant burn when eaten.',
  17. icon:[0,0,'spicySheet'],
  18. 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"
  19. partOf:'food',
  20. category:'food',
  21. });
  22. new G.Res({
  23. name:'hot sauce',
  24. 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.',
  25. icon:[1,0,'spicySheet'],
  26. 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)
  27. partOf:'food',
  28. category:'food',
  29. });
  30.  
  31. //Then we augment the base data to incorporate our new resources :
  32. //adding hot pepper as something that can be gathered from grass
  33. G.getDict('grass').res['gather']['hot pepper']=3;
  34. //adding a new mode to artisans so they can make hot sauce from hot peppers
  35. 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}};
  36. //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"
  37. G.getDict('artisan').effects.push({type:'convert',from:{'hot pepper':3,'herb':3},into:{'hot sauce':1},every:3,mode:'hot sauce'});
  38.  
  39. //Then we add a new technology which is required by the artisans to gain access to the "hot sauce" mode :
  40. new G.Tech({
  41. name:'hot sauce preparing',
  42. 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.',
  43. icon:[0,1,'spicySheet'],
  44. cost:{'insight':10},
  45. req:{'cooking':true},
  46. });
  47.  
  48. //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.
  49. new G.Trait({
  50. name:'hot sauce madness',
  51. desc:'@your people appreciate [hot sauce] twice as much and will be twice as happy from consuming it.',
  52. icon:[1,1,'spicySheet'],
  53. chance:20,
  54. req:{'hot sauce preparing':true},
  55. effects:[
  56. {type:'function',func:function(){G.getDict('hot sauce').turnToByContext['eat']['happiness']=0.2;}},//this is a custom function executed when we gain the trait
  57. ],
  58. });
  59.  
  60. //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!
  61. }
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement