-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathminebot.dm
310 lines (264 loc) · 10.2 KB
/
minebot.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/**********************Mining drone**********************/
#define MINEDRONE_COLLECT 1
#define MINEDRONE_ATTACK 2
/mob/living/simple_animal/hostile/mining_drone
name = "nanotrasen minebot"
desc = "The instructions printed on the side read: This is a small robot used to support miners, can be set to search and collect loose ore, or to help fend off wildlife."
gender = NEUTER
icon = 'icons/mob/aibots.dmi'
icon_state = "mining_drone"
icon_living = "mining_drone"
status_flags = CANSTUN|CANKNOCKDOWN|CANPUSH
mouse_opacity = MOUSE_OPACITY_ICON
weather_immunities = WEATHER_STORM
faction = list("neutral")
combat_mode = TRUE
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
unsuitable_atmos_damage = 0
minbodytemp = 0
move_to_delay = 10
speed = -1 //YOGS - minebot //Buffed to not be a fucking god damn piece of slug matter writhing on the fucking floor pt2
health = 150
maxHealth = 150
melee_damage_lower = 15
melee_damage_upper = 15
obj_damage = 10
environment_smash = ENVIRONMENT_SMASH_NONE
check_friendly_fire = TRUE
stop_automated_movement_when_pulled = TRUE
attacktext = "drills"
attack_sound = 'sound/weapons/circsawhit.ogg'
sentience_type = SENTIENCE_MINEBOT
speak_emote = list("states")
wanted_objects = list(/obj/item/stack/ore/diamond, /obj/item/stack/ore/gold, /obj/item/stack/ore/silver,
/obj/item/stack/ore/plasma, /obj/item/stack/ore/uranium, /obj/item/stack/ore/iron,
/obj/item/stack/ore/bananium, /obj/item/stack/ore/titanium)
healable = 0
loot = list(/obj/effect/decal/cleanable/robot_debris)
del_on_death = TRUE
light_system = MOVABLE_LIGHT
light_range = 6
light_on = FALSE
var/mode = MINEDRONE_COLLECT
var/obj/item/gun/energy/kinetic_accelerator/minebot/stored_gun
/mob/living/simple_animal/hostile/mining_drone/Initialize(mapload)
. = ..()
stored_gun = new(src)
var/datum/action/innate/minedrone/toggle_light/toggle_light_action = new()
toggle_light_action.Grant(src)
var/datum/action/innate/minedrone/toggle_meson_vision/toggle_meson_vision_action = new()
toggle_meson_vision_action.Grant(src)
var/datum/action/innate/minedrone/toggle_mode/toggle_mode_action = new()
toggle_mode_action.Grant(src)
var/datum/action/innate/minedrone/dump_ore/dump_ore_action = new()
dump_ore_action.Grant(src)
var/obj/item/implant/radio/mining/imp = new(src)
imp.implant(src)
access_card = new /obj/item/card/id(src)
var/datum/job/mining/M = new
access_card.access = M.get_access()
SetCollectBehavior()
/mob/living/simple_animal/hostile/mining_drone/Destroy()
for (var/datum/action/innate/minedrone/action in actions)
qdel(action)
return ..()
/mob/living/simple_animal/hostile/mining_drone/sentience_act()
..()
check_friendly_fire = 0
/mob/living/simple_animal/hostile/mining_drone/examine(mob/user)
. = ..()
var/t_He = p_they(TRUE)
var/t_him = p_them()
var/t_s = p_s()
if(health < maxHealth)
if(health >= maxHealth * 0.5)
. += span_warning("[t_He] look[t_s] slightly dented.")
else
. += span_boldwarning("[t_He] look[t_s] severely dented!")
. += {"<span class='notice'>Using a mining scanner on [t_him] will instruct [t_him] to drop stored ore. <b>[max(0, LAZYLEN(contents) - 1)] Stored Ore</b>\n
Field repairs can be done with a welder."}
if(stored_gun && stored_gun.max_mod_capacity)
. += "<b>[stored_gun.get_remaining_mod_capacity()]%</b> mod capacity remaining."
for(var/A in stored_gun.get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
. += span_notice("There is \a [M] installed, using <b>[M.cost]%</b> capacity.")
/mob/living/simple_animal/hostile/mining_drone/welder_act(mob/living/user, obj/item/I)
. = TRUE
if(maxHealth == health)
to_chat(user, span_info("[src] is at full integrity."))
return
if(I.use_tool(src, user, 0, volume=40))
adjustBruteLoss(-15)
to_chat(user, span_info("You repair some of the armor on [src]."))
/mob/living/simple_animal/hostile/mining_drone/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner))
to_chat(user, span_info("You instruct [src] to drop any collected ore."))
DropOre()
return
if(I.tool_behaviour == TOOL_CROWBAR || istype(I, /obj/item/borg/upgrade/modkit))
I.melee_attack_chain(user, stored_gun, params)
return
..()
/mob/living/simple_animal/hostile/mining_drone/death()
DropOre(0)
if(stored_gun)
for(var/obj/item/borg/upgrade/modkit/M in stored_gun.modkits)
M.uninstall(stored_gun)
deathmessage = "blows apart!"
..()
/mob/living/simple_animal/hostile/mining_drone/attack_hand(mob/living/carbon/human/M)
. = ..()
if(.)
return
if(!M.combat_mode)
toggle_mode()
switch(mode)
if(MINEDRONE_COLLECT)
to_chat(M, span_info("[src] has been set to search and store loose ore."))
if(MINEDRONE_ATTACK)
to_chat(M, span_info("[src] has been set to attack hostile wildlife."))
return
/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/O)
. = ..()
if(istype(O, /obj/projectile/kinetic))
var/obj/projectile/kinetic/K = O
if(K.kinetic_gun)
for(var/A in K.kinetic_gun.get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
if(istype(M, /obj/item/borg/upgrade/modkit/minebot_passthrough))
return TRUE
if(istype(O, /obj/projectile/destabilizer))
return TRUE
/mob/living/simple_animal/hostile/mining_drone/proc/SetCollectBehavior()
mode = MINEDRONE_COLLECT
vision_range = 9
search_objects = 2
wander = TRUE
ranged = FALSE
minimum_distance = 1
retreat_distance = null
icon_state = "mining_drone"
to_chat(src, span_info("You are set to collect mode. You can now collect loose ore."))
/mob/living/simple_animal/hostile/mining_drone/proc/SetOffenseBehavior()
mode = MINEDRONE_ATTACK
vision_range = 7
search_objects = 0
wander = FALSE
ranged = TRUE
retreat_distance = 2
minimum_distance = 1
icon_state = "mining_drone_offense"
to_chat(src, span_info("You are set to attack mode. You can now attack from range."))
/mob/living/simple_animal/hostile/mining_drone/AttackingTarget()
if(istype(target, /obj/item/stack/ore) && mode == MINEDRONE_COLLECT)
CollectOre()
return
if(isliving(target))
SetOffenseBehavior()
return ..()
/mob/living/simple_animal/hostile/mining_drone/OpenFire(atom/A)
if(CheckFriendlyFire(A))
return
stored_gun.afterattack(A, src) //of the possible options to allow minebots to have KA mods, would you believe this is the best?
/mob/living/simple_animal/hostile/mining_drone/proc/CollectOre()
for(var/obj/item/stack/ore/O in range(1, src))
O.forceMove(src)
/mob/living/simple_animal/hostile/mining_drone/proc/DropOre(message = 1)
if(!contents.len)
if(message)
to_chat(src, span_notice("You attempt to dump your stored ore, but you have none."))
return
if(message)
to_chat(src, span_notice("You dump your stored ore."))
for(var/obj/item/stack/ore/O in contents)
O.forceMove(drop_location())
/mob/living/simple_animal/hostile/mining_drone/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
if(mode != MINEDRONE_ATTACK && amount > 0)
SetOffenseBehavior()
. = ..()
/datum/action/innate/minedrone/toggle_meson_vision
name = "Toggle Meson Vision"
button_icon_state = "meson"
/datum/action/innate/minedrone/toggle_meson_vision/Activate()
var/mob/living/simple_animal/hostile/mining_drone/user = owner
if(user.sight & SEE_TURFS)
user.sight &= ~SEE_TURFS
user.lighting_cutoff_red += 5
user.lighting_cutoff_green += 15
user.lighting_cutoff_blue += 5
else
user.sight |= SEE_TURFS
user.lighting_cutoff_red -= 5
user.lighting_cutoff_green -= 15
user.lighting_cutoff_blue -= 5
user.sync_lighting_plane_cutoff()
to_chat(user, span_notice("You toggle your meson vision [(user.sight & SEE_TURFS) ? "on" : "off"]."))
/mob/living/simple_animal/hostile/mining_drone/proc/toggle_mode()
switch(mode)
if(MINEDRONE_ATTACK)
SetCollectBehavior()
else
SetOffenseBehavior()
//Actions for sentient minebots
/datum/action/innate/minedrone
check_flags = AB_CHECK_CONSCIOUS
button_icon = 'icons/mob/actions/actions_mecha.dmi'
background_icon_state = "bg_default"
overlay_icon_state = "bg_default_border"
/datum/action/innate/minedrone/toggle_light
name = "Toggle Light"
button_icon_state = "mech_lights_off"
/datum/action/innate/minedrone/toggle_light/Activate()
var/mob/living/simple_animal/hostile/mining_drone/user = owner
user.set_light_on(!user.light_on)
to_chat(user, span_notice("You toggle your light [user.light_on ? "on" : "off"]."))
/datum/action/innate/minedrone/toggle_mode
name = "Toggle Mode"
button_icon_state = "mech_cycle_equip_off"
/datum/action/innate/minedrone/toggle_mode/Activate()
var/mob/living/simple_animal/hostile/mining_drone/user = owner
user.toggle_mode()
/datum/action/innate/minedrone/dump_ore
name = "Dump Ore"
button_icon_state = "mech_eject"
/datum/action/innate/minedrone/dump_ore/Activate()
var/mob/living/simple_animal/hostile/mining_drone/user = owner
user.DropOre()
/**********************Minebot Upgrades**********************/
//Melee
/obj/item/mine_bot_upgrade
name = "minebot melee upgrade"
desc = "A minebot upgrade."
icon_state = "door_electronics"
icon = 'icons/obj/module.dmi'
/obj/item/mine_bot_upgrade/afterattack(mob/living/simple_animal/hostile/mining_drone/M, mob/user, proximity)
. = ..()
if(!istype(M) || !proximity)
return
upgrade_bot(M, user)
/obj/item/mine_bot_upgrade/proc/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
if(M.melee_damage_upper != initial(M.melee_damage_upper))
to_chat(user, "[src] already has a combat upgrade installed!")
return
M.melee_damage_lower += 7
M.melee_damage_upper += 7
qdel(src)
//Health
/obj/item/mine_bot_upgrade/health
name = "minebot armor upgrade"
/obj/item/mine_bot_upgrade/health/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
if(M.maxHealth != initial(M.maxHealth))
to_chat(user, "[src] already has reinforced armor!")
return
M.maxHealth += 50
M.updatehealth()
qdel(src)
//AI
/obj/item/slimepotion/slime/sentience/mining
name = "minebot AI upgrade"
desc = "Can be used to grant sentience to minebots. It's incompatible with minebot armor and melee upgrades, and will override them."
icon_state = "door_electronics"
icon = 'icons/obj/module.dmi'
sentience_type = SENTIENCE_MINEBOT
#undef MINEDRONE_COLLECT
#undef MINEDRONE_ATTACK