Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

Commit 0ba84ed

Browse filesBrowse files
committed
Added ads and adware event.
1 parent 1231db6 commit 0ba84ed
Copy full SHA for 0ba84ed

8 files changed

+253-16Lines changed: 253 additions & 16 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/datums/software/ads.dm‎

Copy file name to clipboard
+184Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
//<a href='byond://?src=\ref[topic_ref];ad_click=1'>Advertisement</a>
2+
3+
/proc/get_random_popup_ad(var/topic_ref)
4+
var/datum/popup_ad/ad = null
5+
var/list/ad_options = list(/datum/popup_ad/ad1, /datum/popup_ad/ad2, /datum/popup_ad/ad3)
6+
ad = pick(ad_options)
7+
if(ad)
8+
ad = new ad()
9+
ad.generate_content(topic_ref)
10+
return ad
11+
12+
/datum/popup_ad
13+
var/size = "390x400"
14+
var/content = ""
15+
16+
/datum/popup_ad/proc/generate_content(var/topic_ref)
17+
return ""
18+
19+
/datum/popup_ad/ad1
20+
size = "400x350"
21+
22+
/datum/popup_ad/ad1/generate_content(var/topic_ref)
23+
content = {"
24+
<head><title>NT Product Ads</title></head>
25+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
26+
<img src=ad1.png>
27+
</a>
28+
"}
29+
30+
31+
/datum/popup_ad/ad2
32+
size = "400x430"
33+
34+
/datum/popup_ad/ad2/generate_content(var/topic_ref)
35+
content = {"
36+
<head><title>Click-o-Tron</title></head>
37+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
38+
<img src=ad2.png>
39+
</a>
40+
"}
41+
42+
/datum/popup_ad/ad3
43+
size = "460x120"
44+
45+
/datum/popup_ad/ad3/generate_content(var/topic_ref)
46+
content = {"
47+
<style>
48+
body
49+
{
50+
font-size: 18pt;
51+
}
52+
</style>
53+
<body>
54+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
55+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>Nanotrasen mum finds best way to cure brainrot, leaves doctors baffled with her 5$ trick</a>
56+
</body>
57+
</a>
58+
"}
59+
60+
/datum/popup_ad/ad4
61+
size = "430x200"
62+
63+
/datum/popup_ad/ad4/generate_content(var/topic_ref)
64+
content = {"
65+
<style>
66+
body
67+
{
68+
font-size: 18pt;
69+
}
70+
</style>
71+
<body>
72+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
73+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>18 best griefs of all time. #9 is really shocking!</a>
74+
</body>
75+
</a>
76+
"}
77+
78+
/datum/popup_ad/ad5
79+
size = "430x200"
80+
81+
/datum/popup_ad/ad5/generate_content(var/topic_ref)
82+
content = {"
83+
<style>
84+
body
85+
{
86+
font-size: 18pt;
87+
}
88+
</style>
89+
<body>
90+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
91+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>Man steals dog, puts it in washing machine with his laundry</a>
92+
</body>
93+
</a>
94+
"}
95+
96+
/datum/popup_ad/ad6
97+
size = "430x200"
98+
99+
/datum/popup_ad/ad6/generate_content(var/topic_ref)
100+
content = {"
101+
<style>
102+
body
103+
{
104+
font-size: 18pt;
105+
}
106+
</style>
107+
<body>
108+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
109+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>This assistant makes $1300 space bucks an hour working from Dorms. Find out how!</a>
110+
</body>
111+
</a>
112+
"}
113+
114+
/datum/popup_ad/ad7
115+
size = "430x200"
116+
117+
/datum/popup_ad/ad7/generate_content(var/topic_ref)
118+
content = {"
119+
<style>
120+
body
121+
{
122+
font-size: 18pt;
123+
}
124+
</style>
125+
<body>
126+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
127+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>ASSISTANTS SECRET TO ALL ACCES DISCOVERED! CLICK QUICK BEFORE IT GETS REMOVED!!</a>
128+
</body>
129+
</a>
130+
"}
131+
132+
/datum/popup_ad/ad8
133+
size = "430x200"
134+
135+
/datum/popup_ad/ad8/generate_content(var/topic_ref)
136+
content = {"
137+
<style>
138+
body
139+
{
140+
font-size: 18pt;
141+
}
142+
</style>
143+
<body>
144+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
145+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>WARNING!! Your PDA has <font color='red'><b>13</b></font> viruses! Click here to remove them now!</a>
146+
</body>
147+
</a>
148+
"}
149+
150+
/datum/popup_ad/ad9
151+
size = "430x200"
152+
153+
/datum/popup_ad/ad9/generate_content(var/topic_ref)
154+
content = {"
155+
<style>
156+
body
157+
{
158+
font-size: 18pt;
159+
}
160+
</style>
161+
<body>
162+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
163+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>Warning, your AI is malfunctioning and has been hacked, click here to revert to asimov</a>
164+
</body>
165+
</a>
166+
"}
167+
168+
/datum/popup_ad/ad10
169+
size = "430x200"
170+
171+
/datum/popup_ad/ad10/generate_content(var/topic_ref)
172+
content = {"
173+
<style>
174+
body
175+
{
176+
font-size: 18pt;
177+
}
178+
</style>
179+
<body>
180+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>
181+
<a href='byond://?src=\ref[topic_ref];ad_click=1'>Security has tracked you! Click here to pay your $1000 bail NOW or face prosecution!</a>
182+
</body>
183+
</a>
184+
"}
Collapse file

‎code/datums/software/malware.dm‎

Copy file name to clipboardExpand all lines: code/datums/software/malware.dm
+34-7Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/datum/software/malware/mutate()
1212
if(..())
13-
antivirus_resistance = Clamp(infect_chance + rand(-2, 2), 0, 100)
13+
antivirus_resistance = Clamp(infect_chance + rand(-2, 2), 0, 98)
1414
return 1
1515
return 0
1616

@@ -102,8 +102,13 @@
102102
var/popup_chance = 20
103103
var/popup_chance_min = 20
104104
var/popup_chance_max = 20
105+
var/ads_left = 10
105106
var/global/ad_id = 0
106107

108+
/datum/software/malware/adware/New()
109+
ads_left = rand(7, 15)
110+
..()
111+
107112
/datum/software/malware/adware/mutate()
108113
..()
109114
popup_chance = Clamp(popup_chance + rand(-2, 4), popup_chance_min, popup_chance_max)
@@ -123,15 +128,28 @@
123128
return 0
124129

125130
/datum/software/malware/adware/proc/showAd(mob/user)
126-
if(!user)
131+
if(!user || !user.client)
127132
return
133+
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/adware)
134+
assets.send(user)
128135
popup_chance = max(popup_chance - 2, popup_chance_min) //have mercy
129-
var/dat = "this is an ad."
130-
user << browse(dat, "window=ad[ad_id++];size=400x450;border=1;can_resize=0;can_minimize=0")
136+
var/datum/popup_ad/ad = get_random_popup_ad(src)
137+
user << browse(ad.content, "window=ad[ad_id++];size=[ad.size];border=1;can_resize=0;can_minimize=0")
138+
qdel(ad)
139+
ads_left--
140+
if(ads_left <= 0)
141+
uninfect()
142+
143+
/datum/software/malware/adware/Topic(href, href_list)
144+
if(href_list["ad_click"])
145+
ads_left++
146+
showAd(usr)
131147

132148
///////////////////////
133149
//Stuxnet
134150
///////////////////////
151+
#define STUXNET_MESSAGE_ADMINS_COOLDOWN 120
152+
135153
/datum/software/malware/stuxnet
136154
name = "stuxnet"
137155
flags = SOFTWARE_SPREAD_POWERNET
@@ -140,6 +158,7 @@
140158
can_infect = list(/obj/machinery/power, /obj/machinery/particle_accelerator/control_box)
141159
var/timerID = 0
142160
var/wait_time = 300
161+
var/global/last_admin_message = -STUXNET_MESSAGE_ADMINS_COOLDOWN
143162

144163
/datum/software/malware/stuxnet/infect()
145164
if(!..())
@@ -159,7 +178,9 @@
159178
if(istype(host, /obj/machinery/power/emitter))
160179
var/obj/machinery/power/emitter/E = host
161180
E.active = 0
162-
message_admins("Emitter turned off by <b>[src] virus</b> in ([E.x],[E.y],[E.z]) <a href='?_src_=holder;del_all_stuxnet=1'>\[DELETE STUXNET VIRUS\]</a>",0,1)
181+
if(world.time - last_admin_message > STUXNET_MESSAGE_ADMINS_COOLDOWN)
182+
last_admin_message = world.time
183+
message_admins("Emitter turned off by <b>[src] virus</b> in ([E.x],[E.y],[E.z]) <a href='?_src_=holder;del_all_stuxnet=1'>\[DELETE STUXNET VIRUS\]</a>",0,1)
163184
log_game("Emitter turned off by <b>[src] virus</b> in ([E.x],[E.y],[E.z])")
164185
E.investigate_log("turned <font color='red'>off</font> by <b>[src] virus</b>","singulo")
165186
E.locked = 1
@@ -173,15 +194,21 @@
173194
if(!PA.active)
174195
if(!PA.wires.is_cut(WIRE_POWER))
175196
PA.investigate_log("PA Control Computer turned ["<font color='red'>ON</font>"] by <b>[src] virus</b>","singulo")
176-
message_admins("PA Control Computer turned ["<font color='red'>ON</font>"] by <b>[src] virus</b> <a href='?_src_=holder;del_all_stuxnet=1'>\[DELETE STUXNET VIRUS\]</a>",0,1)
197+
if(world.time - last_admin_message > STUXNET_MESSAGE_ADMINS_COOLDOWN)
198+
last_admin_message = world.time
199+
message_admins("PA Control Computer turned ["<font color='red'>ON</font>"] by <b>[src] virus</b> <a href='?_src_=holder;del_all_stuxnet=1'>\[DELETE STUXNET VIRUS\]</a>",0,1)
177200
log_game("PA Control Computer turned ["<font color='red'>ON</font>"] by <b>[src] virus</b> in ([PA.x],[PA.y],[PA.z])")
178201
PA.toggle_power(FALSE)
179202
return
180203

181204
if(PA.strength < PA.strength_upper_limit)
182205
if(!PA.wires.is_cut(WIRE_STRENGTH))
183206
PA.add_strength(FALSE)
184-
message_admins("PA Control Computer increased to [PA.strength] by <b>[src] virus</b> <a href='?_src_=holder;del_all_stuxnet=1>\[DELETE STUXNET VIRUS\]</a>",0,1)
207+
if(world.time - last_admin_message > STUXNET_MESSAGE_ADMINS_COOLDOWN)
208+
last_admin_message = world.time
209+
message_admins("PA Control Computer increased to [PA.strength] by <b>[src] virus</b> <a href='?_src_=holder;del_all_stuxnet=1>\[DELETE STUXNET VIRUS\]</a>",0,1)
185210
log_game("PA Control Computer increased to [PA.strength] by <b>[src] virus</b>")
186211
PA.investigate_log("PA Control Computer increased to [PA.strength] by <b>[src] virus</b>" ,"singulo")
187212
timerID = addtimer(src, "overpowerPA", wait_time)
213+
214+
#undef STUXNET_MESSAGE_ADMINS_COOLDOWN
Collapse file

‎code/game/objects/items/devices/PDA/PDA.dm‎

Copy file name to clipboardExpand all lines: code/game/objects/items/devices/PDA/PDA.dm
+10-9Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,24 @@ var/global/list/obj/item/device/pda/PDAs = list()
9494
return
9595

9696
/obj/item/device/pda/attack_self(mob/user)
97-
if(software)
98-
var/failUse = 0
99-
for(var/V in software)
100-
var/datum/software/M = V
101-
failUse |= M.onActivate(user)
102-
if(failUse)
103-
return
10497

10598
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/pda)
10699
assets.send(user)
107100

108-
user.set_machine(src)
109-
110101
if(hidden_uplink && hidden_uplink.active)
111102
hidden_uplink.interact(user)
112103
return
113104

105+
user.set_machine(src)
106+
107+
if(software)
108+
var/failUse = 0
109+
for(var/V in software)
110+
var/datum/software/M = V
111+
failUse |= M.onActivate(user)
112+
if(failUse)
113+
return
114+
114115
var/dat = "<html><head><title>Personal Data Assistant</title></head><body bgcolor=\"#808000\"><style>a, a:link, a:visited, a:active, a:hover { color: #000000; }img {border-style:none;}</style>"
115116

116117
dat += "<a href='byond://?src=\ref[src];choice=Refresh'><img src=pda_refresh.png> Refresh</a>"
Collapse file

‎code/modules/client/asset_cache.dm‎

Copy file name to clipboardExpand all lines: code/modules/client/asset_cache.dm
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ You can set verify to TRUE if you want send() to sleep until the client has the
224224
"large_stamp-law.png" = 'icons/stamp_icons/large_stamp-law.png'
225225
)
226226

227+
/datum/asset/simple/adware
228+
assets = list(
229+
"ad1.png" = 'icons/ads/ad1.png',
230+
"ad2.png" = 'icons/ads/ad2.png',
231+
)
232+
227233

228234
//Registers HTML Interface assets.
229235
/datum/asset/HTML_interface/register()
Collapse file

‎code/modules/events/adware.dm‎

Copy file name to clipboard
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/datum/round_event_control/adware
2+
name = "Adware"
3+
typepath = /datum/round_event/adware
4+
weight = 20
5+
max_occurrences = 2
6+
earliest_start = 6000
7+
8+
/datum/round_event/adware/start()
9+
var/list/PDAs = get_viewable_pdas()
10+
for(var/i in 1 to 3)
11+
if(!PDAs.len)
12+
break
13+
var/obj/item/device/pda/PDA = pick(PDAs)
14+
if(istype(PDA))
15+
var/datum/software/malware/adware/A = new /datum/software/malware/adware()
16+
A.infect(PDA)
17+
PDAs -= PDA
Collapse file

‎icons/ads/ad1.png‎

Copy file name to clipboard
22.2 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎icons/ads/ad2.png‎

Copy file name to clipboard
34 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎yogstation.dme‎

Copy file name to clipboardExpand all lines: yogstation.dme
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
#include "code\datums\martial\wrestling.dm"
241241
#include "code\datums\ruins\lavaland.dm"
242242
#include "code\datums\ruins\space.dm"
243+
#include "code\datums\software\ads.dm"
243244
#include "code\datums\software\antiviruses.dm"
244245
#include "code\datums\software\malware.dm"
245246
#include "code\datums\software\software.dm"
@@ -1072,6 +1073,7 @@
10721073
#include "code\modules\emoji\emoji_parse.dm"
10731074
#include "code\modules\events\_event.dm"
10741075
#include "code\modules\events\abductor.dm"
1076+
#include "code\modules\events\adware.dm"
10751077
#include "code\modules\events\alien_infestation.dm"
10761078
#include "code\modules\events\anomaly.dm"
10771079
#include "code\modules\events\anomaly_bluespace.dm"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.